Repository navigation
fix(platform): say when the writes that wait for approval fail to load - #5091
tale-code-bot wants to merge 1 commit into
Conversation
A failed read of an automation's approval allowances fell through to the empty state, so Runs without approval said "This automation makes no write that waits for approval." with no error and no way to try again. The same sentence showed while the first read was still in flight. The section now reads the query through readStateOf, as the account's teams and passkeys sections do: a failed first read shows allowances.loadFailed with Try again (CatalogLoadError) under the section's title and hint, a failed refresh keeps the last switches under allowances.refreshFailed, and the empty sentence or the switches show only once a read has answered. The loading mask covers the first read only, so the notice and its Try again stay focusable while a retry runs, and a retry that works hands the focus to the section. Closes #4766
tale-review-bot
left a comment
There was a problem hiding this comment.
Approved at fd578cb6af3e917c77c96cd35a78ad95b02b70ee.
Checked
- Diff: read in full, all 8 files.
ApprovalAllowancesSectionnow reads the query throughreadStateOfand showsCatalogLoadError:loadFailedwhen nothing has loaded,refreshFailedabove the last switches;failureKey,isRetryingandonFocusLostto the section, the same shape assettings/account/components/teams-section.tsx;allowances.noneand the switches only once a read has answered;- the skeleton masks the first read only (
isPending && !read.unavailable). - The grouped-editor registration is unchanged (
enabled: canGrant, false while nothing has loaded).
- Locales: en/de/fr keys added. The new German has no ß, so de-CH falls back correctly.
- Manual layer:
AUTO-B46, readme counts 191→192 and 1279→1280, and the component-half row inreference/automation/automations.md. - Tests run locally, credentials unset:
vitest.ui.config.tson the new read-failure test andautomation-general-tab.test.tsx: 18 passed;--project server lib/i18n/plus the error-message and single-failure-toast guards: 13 files, 699 passed;bun run lint:manual: ok.
- Regression proof: with
approval-allowances-section.tsxreverted to base9be5cada, 9 of 10 new cases fail.- The first two find the
allowances.noneparagraph: after the 500s, and while the first read runs. - The others find no
role="alert". - The passing case is the "answered with none" control.
- The first two find the
- CI on this head: all seven
CI readychecks pass (Checks run 40921079710, SAST 40921079737, Commitlint 40921080001).
Accepted as described: after a failed refresh the switches stay editable, under the notice. That was already so before this change, without a notice. The tab's PUT is last-writer-wins, and that is pre-existing.
Not run: the merge-queue UI and E2E tiers, AUTO-B46 in a real browser, and the visual pass.
Out of scope, for their own issues (both noted in the PR):
project-bindings-section.tsxhas the samedata ?? []defect;- the General tab's allowances save has no stale check.
|
Not landing yet. The green
|
|
Reopened so the checks run again. The 20:13–20:15 UTC reopen started its runs from a test merge into |
|
Landed on |
Closes #4766
Task: TALE-146 on the Development board.
What was wrong
Runs without approval on an automation's General tab never read whether its query had failed. When
automations/queries:listApprovalAllowancesfailed,Skeletonize loading={query.isPending}turned off.actions = query.data?.actions ?? []was then empty, so the section said This automation makes no write that waits for approval. There was no error and no Try again, and the switches an owner or admin came to review never appeared. The same sentence also showed, in plain text, while the first read was still in flight, becauseTextis not skeleton-aware.What changed
The fix reuses the app's read-failure concept:
readStateOf(app/lib/backend/read-state.ts) andCatalogLoadError(@tale/ui/catalog/catalog-view), in the same shape as the account's Your teams (#3847) and Passkeys sections. The changes are inapproval-allowances-section.tsx:allowances.loadFailedwith Try again. No switch renders andallowances.nonedoes not show.allowances.refreshFailed("What's shown may be out of date").failureKey). When a retry works, the focus goes to the section (ref,tabIndex={-1},outline-none) instead of dropping to the page.query.isPending && !read.unavailable). react-query puts a failed read back topendingwhile its retry runs, and the notice must not sit inside a busyrole="status"region then.allowances.noneand the switches render only once a read has answered (query.data !== undefined).Other files:
messages/{en,de,fr}/automations.ymlgainallowances.loadFailedandallowances.refreshFailed, worded like the section'snoneand like the teams notices. The German has noß, sode-CHfalls back todewithout an override.AUTO-B46(block the read in DevTools, then recover with Try again from the keyboard);tests/manual/reference/automation/automations.md, not the main register, so parallel PRs don't append to the same lines.approvals-in-workflows.mddescribes what the section lists, not its empty or failure states.Tests
The new
approval-allowances-section.read-failure.test.tsxmounts the section in anEditorGroup, as the General tab does. The real hook, adapter row,backendFetchand four-attempt retry policy run against the closed synthetic transport (syntheticBackend()). The door answers whatappErrorHandleranswers when a handler throws: a plain-text 500. It checks:allowances.none, no switch, and the hint still describing the section;aria-busyancestor, and keeps its node and focus when it fails again (8 attempts in all);allowances.noneand no alert;allowances.refreshFailed, and Try again brings in another session's grant ("Allowed by Ada Lovelace on …");All commands below ran with the credential removed. Results:
main9be5cadacb5fbunx vitest --run --config vitest.ui.config.ts <new test>expected document not to contain element, found <p(theallowances.nonesentence) after the failed read and during the first read.fd578cb6aautomation-general-tab.test.tsxloading={query.isPending}role="status"while the retry runsquery.data === undefinedguard removedallowances.noneautomation-general-tab.test.tsx,automation-editor.test.tsx,trigger-webhook-panel.test.tsx(UI config)fd578cb6abunx vitest --run --project serveronlib/i18n/messages.test.ts,topic-references.test.ts,swiss-loading.test.tsand theerror-message-description,single-failure-toastanddomain-specsguardsallowanceskey.bunx oxlint --type-awareon both changed.tsxfilesbunx tsc --noEmit(platform, 6 GiB heap)oxfmt --check(and the pre-commit hook)bun run lint:manualcheck-guide.ts suites/automations.mdmain; none fromAUTO-B46The working tree that passed these checks is byte-identical to
fd578cb6a; the commit hooks changed nothing.Not run
AUTO-B46in a real browser, and the visual-aspect pass. This worker has no Docker daemon, so the stack can't start. Its preinstalled headless Chromium is build 1194, while the repo's Playwright 1.58.2 expects 1208, and I did not fetch browsers from outside the lockfile. The box stays manual.fd578cb6a, along with format, lint, types and commitlint, and all of it passed: Checks run 40921079710, SAST run 40921079737, Commitlint run 40921080001, with every CI ready job green.test:uirun in the queue. Locally the new test passed onfd578cb6a(above). E2E, Browser and the other queue tiers also run there.For the reviewer
PUT /api/app/automations/:name/approval-allowances(setApprovalAllowances) makes the set exactly what the tab sends, so the last writer wins. Only the MCP door checks a hash (changeApprovalAllowances,SETTINGS_STALE). The notice now says the view may be out of date, but the tab still has no stale check on save. That belongs in its own issue, not this PR.failureDetail: the GET refuses only a non-author, and a 5xx carries nothing a person can use.project-bindings-section.tsxon the same tab has the same class of defect:boundQuery.data ?? []with no error branch, underSkeletonize loading={boundQuery.isPending}.