Skip to content

fix(platform): say when the writes that wait for approval fail to load - #5091

Closed
tale-code-bot wants to merge 1 commit into
mainfrom
fix/approval-allowances-load-failure
Closed

tale-code-bot wants to merge 1 commit into
mainfrom
fix/approval-allowances-load-failure

Conversation

@tale-code-bot

@tale-code-bot tale-code-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

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:listApprovalAllowances failed, 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, because Text is not skeleton-aware.

What changed

The fix reuses the app's read-failure concept: readStateOf (app/lib/backend/read-state.ts) and CatalogLoadError (@tale/ui/catalog/catalog-view), in the same shape as the account's Your teams (#3847) and Passkeys sections. The changes are in approval-allowances-section.tsx:

  • The first read fails. Once the four attempts are spent, the section keeps its title and hint and shows allowances.loadFailed with Try again. No switch renders and allowances.none does not show.
  • A refresh fails. The last switches stay, under allowances.refreshFailed ("What's shown may be out of date").
  • Try again. The notice stays mounted while a retry runs. Its button stays busy and keeps its focus, and each new failure is announced again (failureKey). When a retry works, the focus goes to the section (ref, tabIndex={-1}, outline-none) instead of dropping to the page.
  • The loading mask. It now covers only the first read (query.isPending && !read.unavailable). react-query puts a failed read back to pending while its retry runs, and the notice must not sit inside a busy role="status" region then.
  • The empty sentence. allowances.none and the switches render only once a read has answered (query.data !== undefined).

Other files:

  • Strings: messages/{en,de,fr}/automations.yml gain allowances.loadFailed and allowances.refreshFailed, worded like the section's none and like the teams notices. The German has no ß, so de-CH falls back to de without an override.
  • Manual layer:
    • new box AUTO-B46 (block the read in DevTools, then recover with Try again from the keyboard);
    • suite counts 191→192 and 1279→1280;
    • the component-half row goes in the automations shard, tests/manual/reference/automation/automations.md, not the main register, so parallel PRs don't append to the same lines.
  • User docs: no change. approvals-in-workflows.md describes what the section lists, not its empty or failure states.

Tests

The new approval-allowances-section.read-failure.test.tsx mounts the section in an EditorGroup, as the General tab does. The real hook, adapter row, backendFetch and four-attempt retry policy run against the closed synthetic transport (syntheticBackend()). The door answers what appErrorHandler answers when a handler throws: a plain-text 500. It checks:

  • after four attempts: the alert and Try again, never allowances.none, no switch, and the hint still describing the section;
  • nothing about the writes while the first read is in flight;
  • a keyboard Try again that heals lists the switches and hands the focus to the section;
  • Try again stays busy and focused while it runs, outside any aria-busy ancestor, and keeps its node and focus when it fails again (8 attempts in all);
  • a read that answers with no writes still shows allowances.none and no alert;
  • a failed refresh keeps the switch under allowances.refreshFailed, and Try again brings in another session's grant ("Allowed by Ada Lovelace on …");
  • axe with the failure shown;
  • EN/DE/FR, each key with a translation of its own.

All commands below ran with the credential removed. Results:

What Head Command Result
New test, before the fix main 9be5cadacb5f bunx vitest --run --config vitest.ui.config.ts <new test> 9 failed, 1 passed (the control). The failure reads expected document not to contain element, found <p (the allowances.none sentence) after the failed read and during the first read.
New test, after the fix, with the General tab test fd578cb6a same, plus automation-general-tab.test.tsx 2 files, 18 passed (10 new, 8 General tab)
Mutation: mask restored to loading={query.isPending} working tree same fails: the alert sits inside role="status" while the retry runs
Mutation: query.data === undefined guard removed working tree same fails 3 tests on allowances.none
Consumers working tree automation-general-tab.test.tsx, automation-editor.test.tsx, trigger-webhook-panel.test.tsx (UI config) 3 files, 155 tests passed
i18n and guards fd578cb6a bunx vitest --run --project server on lib/i18n/messages.test.ts, topic-references.test.ts, swiss-loading.test.ts and the error-message-description, single-failure-toast and domain-specs guards 6 files, 127 tests passed. The report-mode summary has no finding on any allowances key.
Lint working tree bunx oxlint --type-aware on both changed .tsx files exit 0
Types working tree bunx tsc --noEmit (platform, 6 GiB heap) exit 0
Format working tree oxfmt --check (and the pre-commit hook) clean
Manual layer working tree bun run lint:manual ok (layout, suites, runs, references)
Suite references working tree check-guide.ts suites/automations.md 14 findings, the same set as on main; none from AUTO-B46

The working tree that passed these checks is byte-identical to fd578cb6a; the commit hooks changed nothing.

Not run

  • AUTO-B46 in 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.
  • The full unit suite, knip and SAST locally. This PR's fast tier ran them on 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.
  • The UI tier on this PR. It runs only in the merge queue, so on GitHub the new component test and the rest of test:ui run in the queue. Locally the new test passed on fd578cb6a (above). E2E, Browser and the other queue tiers also run there.

For the reviewer

  • Switches stay editable after a failed refresh. I kept them editable under the notice, which is the house pattern for a loaded list. They were already editable there before this change, with no notice at all. The task's plan justified this by saying the save is checked server-side against the set it was read from. That is wrong for this tab: its 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.
  • The refusal detail is not shown. The message leaves out failureDetail: the GET refuses only a non-author, and a 5xx carries nothing a person can use.
  • Noticed, out of scope. project-bindings-section.tsx on the same tab has the same class of defect: boundQuery.data ?? [] with no error branch, under Skeletonize loading={boundQuery.isPending}.

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 tale-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at fd578cb6af3e917c77c96cd35a78ad95b02b70ee.

Checked

  • Diff: read in full, all 8 files. ApprovalAllowancesSection now reads the query through readStateOf and shows CatalogLoadError:
    • loadFailed when nothing has loaded, refreshFailed above the last switches;
    • failureKey, isRetrying and onFocusLost to the section, the same shape as settings/account/components/teams-section.tsx;
    • allowances.none and 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 in reference/automation/automations.md.
  • Tests run locally, credentials unset:
    • vitest.ui.config.ts on the new read-failure test and automation-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.tsx reverted to base 9be5cada, 9 of 10 new cases fail.
    • The first two find the allowances.none paragraph: after the 500s, and while the first read runs.
    • The others find no role="alert".
    • The passing case is the "answered with none" control.
  • CI on this head: all seven CI ready checks 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.tsx has the same data ?? [] defect;
  • the General tab's allowances save has no stale check.

@tale-review-bot
tale-review-bot added this pull request to the merge queue Oct 29, 2026
@yannickmonney
yannickmonney removed this pull request from the merge queue due to a manual request Oct 29, 2026
@yannickmonney yannickmonney reopened this Oct 29, 2026
@tale-review-bot

Copy link
Copy Markdown
Collaborator

Not landing yet. The green CI ready checks on the approved head fd578cb6af3e917c77c96cd35a78ad95b02b70ee came from the pre-0da08205 workflows. (tale-review-bot, Reviewer run b123c4de, read at 22:32 UTC)

  • The newest runs: they were created by the 20:13–20:15 UTC close/reopen. They checked out the merge into the old base: Checks run 40947345792, job 123706083358, logged HEAD is now at 7779720 Merge fd578cb6af3e917c77c96cd35a78ad95b02b70ee into 9be5cadac.
  • What they skipped: in that run, UI (platform n/4) and UI read skipped. So the heavy suites that .github/CI.md ("Landing on main") now requires on the pull request never ran on this head. My rerun of SAST 40947345794 replays the same old merge commit too.
  • My approval of fd578cb6af3e917c77c96cd35a78ad95b02b70ee stands. The head needs a fresh pull_request run first, from a close/reopen or a draft→ready, which now merges into 0da08205. Once every required check finishes green on that run, the Reviewer lands it with --match-head-commit fd578cb6af3e917c77c96cd35a78ad95b02b70ee.

@yannickmonney

yannickmonney commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Reopened so the checks run again. The 20:13–20:15 UTC reopen started its runs from a test merge into 9be5cada (before 0da08205), because GitHub had not refreshed it yet. This reopen's runs start from the test merge d05b52b53d, into 0da08205. The head is unchanged (no new commit).

@yannickmonney

Copy link
Copy Markdown
Contributor

Landed on train as bfa19b5: squashed at the approved head after the fast gate (formatting, typecheck, build). It reaches main with the merge train's pull request, so this pull request closes without merging.

yannickmonney pushed a commit that referenced this pull request Oct 30, 2026
Reviewed and approved in pull request #5091 at fd578cb.

Closes #4766
Task: TALE-146
@yannickmonney
yannickmonney deleted the fix/approval-allowances-load-failure branch October 30, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(platform): "Runs without approval" says an automation makes no approval-gated write when its read fails

3 participants