skillhub/cli/test/integration
gale-popai d977ea9dc4
fix(api): tell callers why a request was forbidden (#610)
* fix(api): tell callers why a request was forbidden

The scope filter already computes an exact reason ("Missing API token
scope: skill:delete", "API token cannot access endpoint: /x") and the
access-denied handler discarded it, returning a bare "Forbidden" for
every case: missing scope, endpoint closed to API tokens, and paths
that simply don't exist. Clients cannot tell those apart, so they
guess — the published CLI reports every 403 as "token may lack
required scope", which sent us debugging token scopes for an hour when
the real causes were a revoked token and a mistyped namespace path.

The reason now rides in the response via a new error.forbidden.detail
message (en + zh), and is logged alongside the exception type.

Signed-off-by: Gal Eyal <gal.e@popai.health>

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(api): safely expose API token denial reasons

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-07-28 17:42:20 +08:00
..
auth-commands.test.ts test(cli): add comprehensive integration tests and fix update command bugs 2026-05-07 14:46:40 +08:00
auth-resolution.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
concurrency.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
cross-command.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
doctor-command.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
error-output.test.ts fix(cli): improve parse error output 2026-04-29 15:37:05 +08:00
help-command.test.ts test(cli): add comprehensive integration tests and fix update command bugs 2026-05-07 14:46:40 +08:00
install-command.test.ts fix(cli): add token auth to search 2026-06-17 11:35:16 +08:00
inventory-resilience.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
list-command.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
multi-registry.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
publish-command.test.ts test(cli): restore NpmRegistryClient unit tests and fix publish test name 2026-05-14 16:24:49 +08:00
publish-dry-run.test.ts fix(api): tell callers why a request was forbidden (#610) 2026-07-28 17:42:20 +08:00
remove-command.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
search-command.test.ts fix(cli): add token auth to search 2026-06-17 11:35:16 +08:00
update-command.test.ts test(cli): add comprehensive integration tests and fix update command bugs 2026-05-07 14:46:40 +08:00
version-command.test.ts test(cli): add comprehensive integration tests and fix update command bugs 2026-05-07 14:46:40 +08:00
version-upgrade-flow.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00
whoami-command.test.ts test(cli): migrate comprehensive test suite from test/cli-integration-coverage 2026-05-13 11:14:20 +08:00