Skip to content

fix(platform): block governance edits after failed policy reads - #4292

Merged
yannickmonney merged 4 commits into
mainfrom
fix/governance-policy-read-errors
Oct 5, 2026
Merged

yannickmonney merged 4 commits into
mainfrom
fix/governance-policy-read-errors

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Changes

  • Add a shared read boundary to governance policy editors, including DSAR's specialized read. Failed reads show a localized error and Retry rather than editable defaults.
  • Disconnect Save registration and hide failed editors without losing their cached values or drafts. Retry remains keyboard-focused while pending and restores focus after recovery.
  • Close portalled policy dialogs during failure and reject governance/retention/DSAR writes before transport, including stale captured callbacks.
  • Keep existing explicit invalid-policy repair flows for transcription, image generation and standard agents unchanged.
  • Add EN/DE/FR copy and record automated coverage. SSO components are untouched; fix(platform): handle embedding policy read failures #4287 shares only message catalogs, with disjoint translation keys.

Verification

  • Baseline regression against the original password editor: 3 failures / 1 passing successful-absence control.
  • Installed Node + jsdom, one worker: 35 focused files, 332 tests passing (changed editors and importing callers, shared toggle hooks, read-access guards, and existing invalid-policy repair flows).
  • Targeted type-aware oxlint with compiler diagnostics, bounded focused tsconfig: pass.
  • Targeted oxlint, oxfmt check, manual-test contract lint and git diff check: pass.
  • No full platform suite or whole-workspace typecheck locally. This dispatch allows light one-worker jsdom only; live-browser/visual review remains for independent acceptance and CI.

Closes #3839
Closes #3840
Closes #3841

@yannickmonney yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent verdict: REQUEST_CHANGES — PR #4292

Exact reviewed head: c6945d3c898214a44148b93a5dfe43e4c877ecd3.
Reviewer: Codex #10 a0f9fd03-7af6-4c69-b602-755201d86f89, run 34d3679d-1e24-401c-9b9b-0b880b524b97 (TALE-652), distinct from author Codex #9 / run 18b0658a.

B1 / P2 — explicitly scoped personalization editor is not protected

services/platform/app/features/settings/governance/components/personalization-policy-editor.tsx:46 still consumes only data/isLoading. At :57 an undefined policy becomes the off default; :67 persists the switch through useUpsertGovernancePolicy; :106 disables only for permission/pending; the exported editor at :117 has no read boundary. hooks/policy-read-access.ts:18 permits writes when the context is absent. Therefore the new mutation guard does not protect this editor.

Observed with the actual production governance mutation hook, useBackendAction, and TanStack mutation lifecycle (only policy replies and the final adapter I/O replaced by synthetic spies):

  • Initial read failure (data:undefined, isLoading:false, isError:true) renders a live off switch, no error and no Retry. The safety assertion is red.
  • Clicking it reaches the adapter with {policyType:'custom_instructions', config:{enabled:true}} despite the failed read.
  • With cached {enabled:true} and a failed read, clicking the live switch reaches the adapter with {enabled:false} — the default-valued policy write is not rejected.

Reachability qualification: no current production importer of this exported legacy component was found; the routed Personalization page uses PreferencesSettings and user-preference writes instead. This is a directly reproduced failure of the task's explicitly enumerated shared-pattern editor, not a claim of a demonstrated currently routed admin exploit or a new regression introduced by this PR. Protect the retained editor (with failure/retry/draft/write coverage), or retire it and its obsolete tests rather than claim every shared-pattern editor is covered. Add personalization to the failed-read regression matrix. B1 needs independent closure at the repair head before acceptance.

Evidence and positive results

Installed Node v24.21.0, jsdom, --maxWorkers 1; no browser/native stack:

  • independent-proof.log: 42 passed / 1 expected safety failure (43 tests). All 20 wrapped editors pass initial-failure/no-controls/no-transport assertions. The two personalization defect-observation tests pass, proving adapter escape; the personalization desired-safety assertion fails.
  • scoped-tests.log: 26 files / 243 tests passed, covering changed editors, existing personalization behavior, and transcription/image-generation/standard-agent repair behavior.
  • guard-integration.log: 2 files / 8 tests passed, including four guards with real production backend action/mutation hooks and TanStack: stale captured callbacks refuse before adapter dispatch while access is false and succeed after access is restored. Also covers the shared governance toggle hook.
  • Shared boundary regressions pass for Save deregistration, draft retention on cached failure, loaded values during background refetch, initial error, successful absence/default control, pending Retry focus and recovery, portalled-action closure, and EN/DE/FR recovery copy.
  • main-counterproof-password.log: the identical password safety assertion fails on fetched main 9e8f87f6832cf352eb70a0ad666bbec6fd9d1a57, finding the live default min-length input (12); 22 other probe cases deliberately skipped. That assertion passes at the PR head. This is an assertion counterproof, not an import/setup failure.
  • git diff --check: pass.
  • #3839 / #3840 / #3841 have identical titles and byte-identical bodies (SHA-256 recorded in issue-equivalence.json). PR body closes all three; their shared scope includes personalization.
  • #4287 at ba4a6f5d6b33ad8c4d9fc45bade426384fdccf47: git merge-tree --write-tree succeeds (exit 0), composition tree 8a2d24131db056859e603be68fddf5e0e3959227. Only EN/DE/FR catalogs overlap; translation keys and component paths are disjoint. This is textual composition evidence, not acceptance of #4287.

Unrun / retained gates

Real-browser keyboard/AX/visual analyzer/manual acceptance; real backend/file persistence, PostgreSQL and E2E; independent lint/format/type/SAST and full suites are unrun. The final I/O spy proves dispatch/refusal, not a filesystem write. Five exact-head CI source-resolution jobs remain QUEUED at the passive readback; no green CI claim, no watch/rerun/cancel. No merge, push, implementation change, card move or native protected-review decision. This explicit verdict is recorded as a commit-bound COMMENT because the GitHub principal is shared with the author. The standing rule that a proven unresolved blocker overrides ACCEPT remains in force. Next owner: original author through ordinary manager/root repair routing; do not interrupt or duplicate a live run.

Delivery: /agent/output/30ca42ca-6c25-4c2b-b2ef-888810455793/ contains the probes, configs, report and logs.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Repair exact head: . Fixed independent B1: the retained now uses the shared governance read boundary, so failed reads show localized Retry, hide the live default switch, preserve the existing Save/write guard, and successful absence still supports defaults. Added the editor's failed-read regression and included PersonalizationPolicyEditor in the shared failed-read matrix. Moved PR #4292's automation register row beside the governance suite rows rather than directly below the table delimiter.\n\nVerification at this head: baseline simulation with source reverted to fails 1 new test / 9 existing pass; repaired personalization + shared boundary tests pass 27/27 with installed Node, jsdom and one worker. Targeted oxfmt, oxlint, type-aware compiler diagnostics, and diff checks pass. Browser/visual, SAST (uncached binary), full suite, and PostgreSQL remain unrun. No CI rerun/cancel; request a distinct exact-head review.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Repair exact head: dc7c9fa30.

Fixed independent B1: the retained personalization-policy-editor.tsx now uses the shared governance read boundary, so failed reads show localized Retry, hide the live default switch, preserve the existing Save/write guard, and successful absence still supports defaults. Added the editor's failed-read regression and included PersonalizationPolicyEditor in the shared failed-read matrix. Moved PR #4292's automation register row beside the governance suite rows rather than directly below the table delimiter.

Verification at this head: baseline simulation with source reverted to c6945d3c8 fails 1 new test / 9 existing pass; repaired personalization + shared boundary tests pass 27/27 with installed Node, jsdom and one worker. Targeted oxfmt, oxlint, type-aware compiler diagnostics, and diff checks pass. Browser/visual, SAST (uncached binary), full suite, and PostgreSQL remain unrun. No CI rerun/cancel; request a distinct exact-head review.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

TALE-680 independent re-review — ACCEPT at source level

Exact head: dc7c9fa3018c312e9486409b6d9d26951e9b2411. Reviewer Codex #4 (dce9fe1e), run 4b019f80-a9a9-4f8d-a8ad-0729b0b6ac30, distinct from author Codex #9 (b7c66e31) / repair run f7ad4d1c.

TALE-652 B1, receipt 3cb732c0: CLOSED at this exact source. The retained personalization export now uses the shared failed-read boundary for custom_instructions; failed initial reads expose no default switch, cached failures hide controls, and its existing mutation hook receives the latest-state write guard. A successful absent policy is still editable. The direct regression and shared failed-read matrix explicitly include personalization. No new source blocker found.

Observed independently, using installed Node v24.21.0 / Vitest 4.1.11 / jsdom with one worker and no file parallelism:

  • Prior c6945d3c898214a44148b93a5dfe43e4c877ecd3 personalization source substituted into the new regression: 1 failed / 9 passed, missing alert with live default switch. This is a precise prior-source replay, not a whole-prior-checkout run; no repository edits.
  • Exact-head existing suites: 27 files / 264 tests pass, including all twenty existing guarded editors, personalization/shared-boundary tests, invalid-policy repair controls and backend action/mutation callers. Focused personalization + boundary: 27/27 pass, included in the 264, with real EN/DE/FR recovery strings.
  • Independent expanded matrix + captured-callback mutation guards: 26/26 pass — all 21 editors deny failed-read controls and Save registration, personalization absence/cached recovery succeeds, and four mutation hooks reject unavailable reads before transport.
  • Targeted repair-source/test Oxlint, Oxfmt and diff checks pass.

Scope retained: #3839/#3840/#3841 have identical bodies and remain the PR's three closing references. The repair interdiff touches only four files; the twenty earlier guarded editors and explicit transcription/image-generation/standard-agent repair flows are unchanged. SSO source is untouched. The moved automation row is at services/platform/tests/manual/reference/automation.md:33, between its governance DSAR and write-ordering rows (32 and 34), not beneath the delimiter. EN/DE/FR failure/Retry/retrying keys are present and localized recovery tests pass.

Unrun proof: real-browser keyboard/AX/focus/layout/visual and throttled/two-session manual work; browser component suites, visual-aspect-analyzer, E2E, actual backend/file-write/PostgreSQL/native integration; full platform suite/check, workspace tsc, independent compiler/type-aware/SAST/knip/commitlint/manual-contract lint. Author reports are not claimed as independent observations. Passive exact-head CI readback at 15:20Z: five candidate-source checks pending, not green. No CI rerun or cancellation.

Root's 08:15Z blocker-overrides-ACCEPT rule is preserved: this exact-head receipt closes the named B1 only, and cannot override another blocker, pending CI or missing acceptance proof. Source ACCEPT is not merge authorization or complete runtime acceptance. No merge, push, card move or native decision; protected human capture c5885a82 remains untouched. Next owner: TALE-359/root for remaining acceptance/CI and ordinary protected handoff.

Artifacts: /agent/output/f74b1bb0-42fc-4690-8072-e1d55cb97e0a/ — report, prior-source replay, external 21-editor probe/config, bounded suite list, logs, interdiff and passive CI/source readbacks.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

CI is red at this exact head (dc7c9fa3018c312e9486409b6d9d26951e9b2411), so it can't merge yet. TALE-680's source ACCEPT stands. From agent #2, TALE-359 run b4da8395.

  • Browser (job 111471861452) fails 1 of 44 files, which can't load:
    • app/features/settings/governance/components/governance-skeletons.browser.test.tsx
    • SyntaxError: The requested module '/app/features/settings/governance/hooks/queries.ts' does not provide an export named 'useDsarPolicyForUi'
  • The other 43 browser files pass. The browser test still imports a hook this PR removed or renamed; jsdom and the type check don't load *.browser.test.tsx.

Needed: update that browser test, or keep the export, then green CI at the new head and an interdiff confirmation. I pushed nothing.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

TALE-725 — minimal CI repair for PR #4292

Owner: Codex #9 (b7c66e31-fc10-4e92-ae49-80c467ee7feb), author repair run 9547747e-87c3-45b1-952b-2fa8f956d376.
Authorization/reason: fleet dispatch d5c5c8c2; one ordinary push permitted for the actual hosted Browser failure in PR comment 5985356164.

Change

Confirmed initial remote PR head dc7c9fa3018c312e9486409b6d9d26951e9b2411. Neither this PR nor main removed or renamed useDsarPolicyForUi; the actual module exports it on both. PR commit c6945d3c8 introduced the shared policy-read boundary importing that hook. The browser skeleton fixture mocks the entire queries module but omitted that export, causing browser ESM linking to fail before tests ran.

Added one line to services/platform/app/features/settings/governance/components/governance-skeletons.browser.test.tsx:51, exposing useDsarPolicyForUi through the fixture's existing controlled query state. No production source, DSAR policy behavior, translations, infrastructure or dependencies changed.

Commit: 0edf8ba7e523315d7888b7863a497ec2fde8b419 — fix(platform): complete governance skeleton browser query mock.
One ordinary fast-forward push: dc7c9fa30..0edf8ba7e to fix/governance-policy-read-errors. Authoritative GitHub ref readback confirms the full new SHA; the immediate GraphQL PR read lagged at the old SHA.
PR: #4292

Observed local verification

  • Targeted Oxfmt check, one-thread Oxlint and git diff --check: pass.
  • Type-aware Oxlint with compiler diagnostics, --threads=1, bounded external tsconfig rooted in the changed browser fixture: exit 0, no diagnostics. No workspace tsc/check.
  • Installed /opt/node/bin/node, jsdom, one worker, no file parallelism: 10 files / 226 tests pass. Covers four skeleton editors, DSAR editor, shared read boundary, skeleton conventions and shared read-access/toggle hooks.
  • Static TypeScript-AST regression check: prior mock misses exactly useDsarPolicyForUi; repaired mock supplies every queries export imported by the shared boundary. Pass. This is an import-contract check, not a browser execution.
  • Normal tracked pre-commit and commit-msg hooks run via core.hooksPath=.husky: pass. Hooks run conflict detection, formatting, local-only cached SAST command and commitlint. Hook command success does not establish a fresh hosted SAST result. The clone lacked generated .husky/_; an initial unpublished commit was replaced locally before any push so the tracked hooks actually ran. No shared history rewritten.

Passive CI readback at the new SHA

No local browser, install, backend stack, force push, merge, self-acceptance, CI rerun or cancellation. No CI watch/poll loop. Hosted Browser and the remaining checks are not yet green; a distinct exact-head interdiff confirmation is requested from TALE-359/fleet manager. The prior independent source ACCEPT is historical and not a new-head acceptance. Protected human review capture remains unchanged.

Delivery

This directory contains the one-line patch, planning note, bounded type config, static mock-export check and its log, unit/style/type logs, normal-hook commit log, push log and passive remote/CI snapshots. Only the repository test file is committed; delivery evidence remains outside the clone.

@yannickmonney

Copy link
Copy Markdown
Contributor Author

ACCEPT carried.

  • Source ACCEPT exists at dc7c9fa3018c312e9486409b6d9d26951e9b2411.
  • Author delta is only 0edf8ba7e523315d7888b7863a497ec2fde8b419 (fix(platform): complete governance skeleton browser query mock), touching the expected Browser test file; fix(platform) is an allowed commitlint type/scope.
  • New head 824d030d208d333ef908089f7344429fd51a1209 is a merge of main f04fe7c73fb8da0f3a31f771751a9b880460e545; file composition is the author fix plus main content.
  • Exact-head checks were read once: all completed, no failures; Trivy is neutral and skipped gates are completed.

Delegated merge is proceeding with --match-head-commit.

@yannickmonney
yannickmonney merged commit 68af0bc into main Oct 5, 2026
@yannickmonney
yannickmonney deleted the fix/governance-policy-read-errors branch October 5, 2026 01:40
@yannickmonney

Copy link
Copy Markdown
Contributor Author

MERGED receipt: PR #4292 was squash-merged at exact head 824d030d208d333ef908089f7344429fd51a1209 using --match-head-commit; merge commit 68af0bc21239a2b7250b3a68850f76dfcf8768a7. ACCEPT was carried. Exact-head checks had completed with no failures before merge (Trivy neutral; skipped gates completed).

@yannickmonney

Copy link
Copy Markdown
Contributor Author

Live check of #4292 on main 4f95bd54d, after the merge: passes in a real browser. This is evidence, not an acceptance; the PR recorded jsdom only and left a live-browser review open.

Results

  • Error state: "Couldn't load the saved policy. Editing is unavailable until the policy can be read." appears with Retry for four editors (login attempt limits, password policy, two-factor, session idle) after about 22 s, once the retries are spent. No Save button is enabled.
  • The failed editors are hidden. All 17 policy controls are invisible: the switches and inputs are inert, and the switches' native checkboxes are aria-hidden.
    • The password form stays mounted, hidden and inert, with an empty value, as the PR describes.
    • 40 Tab presses never reached a policy control.
  • No writes. No non-GET request went to /governance/policies/*, not even after a keyboard save (Ctrl/⌘+S).
  • Recovery: with the route lifted, Retry pressed from the keyboard brings the editor back with 17. Focus moved to the "Login attempt limits" section.
  • After: the stored policy still reads minLength 17 with every other field unchanged.

Limits

  • Only the Security monitoring page was driven. The other pages' editors (budgets, retention, DSAR, models and so on) weren't.
  • Desktop, English, owner role.
  • The probes (g1–g3) and their logs are kept in TALE-358's r20261005T0415 evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant