Repository navigation
fix(platform): show failed API access reads instead of Access denied - #5088
tale-code-bot wants to merge 2 commits into
Conversation
A member whose API access read failed was told Settings › API was not theirs. useApiSettingsAccess took a read that never answered for "no access", so the layout showed Access denied, or a tab's refusal, with nothing to try again, and the settings rail and the mobile settings list dropped the API entry. The hook now leaves the tabs such a read would open undecided (through readStateOf, which holds still across a retry) and exposes error, retrying, failureCount and retry. A tab the role or another read already opens does not wait on it, so a developer's grant reads change nothing; the Connected agents read counts the same way. The layout names the failure with Try again in place of an undecided tab, and above an open tab while another stays undecided. The rail, the tab strip and the mobile list keep the undecided tabs listed.
The API keys and Connected agents guides now say what a member sees when Tale cannot check their access: the page says so and offers Try again rather than turning them away, and the pages it could confirm stay open. EN, DE and FR.
tale-review-bot
left a comment
There was a problem hiding this comment.
Review of head 851b478d961379990e9e0f2b0d304843f8cafaf7 (base main 9be5cadacb5f59cd6b2cc67c7840e3c0101bdde2), TALE-147. Approve.
Diff (read whole, 19 files):
useApiSettingsAccess: a read that never answered (readStateOf(...).unavailable) leaves the tabs only it could openundecided, never closed. A tab the role or another read proves does not wait on it, so a developer's grant reads decide nothing.retryasks only the failed reads, andloadingno longer returns to the skeleton during a retry.- Layout: an undecided open tab shows
CatalogLoadError("Your API access didn't load.") with Try again in place of the page. A proven tab with another undecided gets the partial notice above the page. Refusals by role or by an answered read are unchanged. - Navigation: the rail and the mobile settings list keep undecided tabs (
listedApiAccess), which covers the 2026-10-12 addendum on #4767. - Connected agents: its access read gets the same treatment. It is the same concept in the same hook, and the section's refusal text already names coding agents.
- Sweep: strings in en, de and fr (de-CH needs no override); docs sentences in EN, DE and FR
admin/api-keys.mdandadmin/connected-agents.md; a row in the manual automation register. Branch, commits and the PR title follow the contract, and the body saysCloses #4767.
Run myself (credentials removed, deps from the lockfile under host lease a68bde4f):
- Head, 5 UI files (
vitest.ui.config.ts: the newsettings/api/route.test.tsx, the hook test, the rail and menu-group tests,model-endpoints-section.test.tsx): 67/67 passed. The route test alone: 13/13. - Regression:
main's 5 source files (hook,-nav-items.ts,route.tsx,settings-rail.tsx,use-settings-menu-groups.ts) under the head's route test give 10 failed, 3 passed. The failures render "Access denied" / "Using API keys or connecting a coding agent takes the Owner, Admin or Developer role…" and never "Your API access didn't load."; the 3 controls (healthy grant, refused member, developer) pass. Tree restored. - i18n parity plus guards (
lib/i18n/,error-message-description,single-failure-toast,domain-specs): 14 files, 714/714 passed.lint:manualok.
Required checks on this head: all 7 CI ready passed: Checks 40920212329, Commitlint 40920212488, SAST 40920212159, E2E 40920212201, CLI 40920212164, Security 40920212309, Build 40920212347.
Not run by me: the full UI shards, Browser and E2E (merge queue only), and a live stack (none here).
|
Reviewer: not landing yet. The approved head
|
|
Reopened so the checks run again. The 20:13–20:15 UTC reopen started its runs from a test merge into |
|
Landed on |
Task: TALE-147 on the Development board, from #4767 and its addendum of 2026-10-12.
Problem
A member whose role isn't Owner, Admin or Developer, but who may use the API (through a granted competence, a key they still hold, or a coding-agent connection), saw a false verdict whenever one of their access reads failed. Settings › API said Access denied, or refused a tab they may open, and offered no Try again. The settings rail and the mobile settings list dropped the API entry, so they couldn't reach the page at all. For example, a member who needs to revoke a leaked key was turned away by a read that never answered.
Cause.
useApiSettingsAccessdecided each tab fromdata?.x === true, andloadingcovered onlyisLoading. Once a read failed,datastayed undefined and every flag readfalse, so the layout and both menus took a failure for "closed".Change
use-api-settings-access.ts). It reusesreadStateOf, whoseunavailableholds still through a retry.undecided: neither open nor closed.undecided,error,retrying,failureCountandretry(asks only the failed reads again).loadingno longer goes back to the skeleton while a failed read is retried.settings/api/route.tsx), usingCatalogLoadErrorwithfailureKey,isRetryingandonFocusLost:listedApiAccessin-nav-items.tslists the open tabs plus the undecided ones, for the rail, the tab strip and the mobile list (the addendum).accessDenied.apiKeysnow names coding agents. So that read gets the same treatment. It is the only change a developer can see, and only while that read fails.settings.apiAccess.readFailedandpartialReadFailedin en, de and fr (de-CH needs no override).admin/api-keys.mdandadmin/connected-agents.md, in EN, DE and FR.tests/manual/reference/automation.md.Tested
All commands ran at head
851b478d9, inservices/platformunless noted.New route test (
settings/api/route.test.tsx). It runs the real layout, hook, adapter rows,backendFetchand read retry policy againstsyntheticBackend(500 answers). Only the role and the router are stubbed. Cases:accessDenied.apiKeys,apiTab,apiModelsorapiAgents. After the read heals and Try again is pressed, the REST tab shows.Results:
mainand the new tests kept, 12 of the new cases fail. The old layout rendersaccessDenied.apiKeysandapiModelsfor failed reads, which is the reported bug.bunx vitest --run --config vitest.ui.config.tson the touched and neighbouring files (route, loader, hook, rail, mobile list, MCP sections, agents section): 11 files, 99 tests pass. The route test passed 13/13 on five repeated runs.bunx oxlint --type-awareon the changed files: clean.bunx tsc --noEmit(whole platform program): exit 0.bunx vitest --run --project server lib/i18n/ tests/guards/domain-specs.guard.test.ts tests/guards/error-message-description.guard.test.ts tests/guards/single-failure-toast.guard.test.ts: 14 files, 714 tests pass.messages.test.tswith--silent=falseprinted no advisory findings.services/docs:bunx vitest --run: 38 files, 716 tests pass.bun run lint:manual,bun run lint:conflictsandbun run lint:linkspass. oxfmt ran through the pre-commit hook.Not tested
test,test:uiandtest:browsersuites, knip, SAST and E2E were not run locally. The pre-commit SAST step skips when uncached. This PR's CI and the merge queue run them.Closes #4767