Repository navigation
fix(platform): require targets for model access rules - #4216
Conversation
yannickmonney
left a comment
There was a problem hiding this comment.
Independent review — REQUEST CHANGES
Task TALE-541; reviewer agent b7c66e31-fc10-4e92-ae49-80c467ee7feb, run 5c646e0d-cf1b-49f0-975c-bc9190af1f5b; distinct from implementation agent/run. Reviewed exact head f1986688398a990459f5c16da9fe0031dc9d6534, parent 6524150fe108180696b9364a46adfbd621349f00. Review-only: no merge, push, card move or CI rerun/cancellation.
R1 — P2: Preserve legacy model-access restrictions in the default-model editor's read path
The stricter write schema introduced at packages/shared/src/schemas/governance.ts:582 also changes an existing read consumer: services/platform/app/features/settings/governance/components/default-model-editor.tsx:94 still parses a stored policy with modelAccessConfigSchema and returns null when it fails. A stored policy with a valid default block plus any old targetless User/Team/Role row therefore becomes “no access policy” in this editor. computeAccessConflict then returns no conflict, and the rule dialog no longer warns that its selected default model is blocked by the valid neighboring rule.
Fresh jsdom proof against the actual DefaultModelEditor: render an enabled blocklist with a default rule blocking openai/gpt-4o, open the existing default-model rule for that model, and assert the conflict alert. With only the valid rule, the alert exists. Add { scope: 'user', allowedModels: [], blockedModels: ['other/model'] } and the alert disappears. Exact head: 1 passes / 1 fails, reproduced twice. Replacing only the shared governance schema with the PR parent's schema gives 2/2 passing; restored head schema's SHA-256 matches the Git object. This is a newly introduced loss of the warning, not a runtime enforcement bypass: backend file reads preserve the valid block and still deny the model.
Please use the existing storedModelAccessConfigSchema for this display/read consumer, keep strict modelAccessConfigSchema at write boundaries, and add a regression covering the neighboring valid restriction plus a legacy targetless row. Re-review the repaired head before acceptance.
Verified criteria and evidence
- User/Team/Role confirmation remains open with a localized target error and no save; nonblank targets are required by the shared write schema, in both modes. Default rules stay target-free; scope changes clear stale targets.
- Model-access editor recovery preserves old rows, displays missing-target warnings, permits repair while disabled, stages multiple repairs, and only submits the fully valid policy.
- JSON/YAML policy reads and fresh snapshots retain legacy rows, model-API settings and neighboring restrictions; invalid serialization remains rejected. Real evaluator controls still deny the blocked model after a valid target is selected. The editor controls exercise the real save adapter through a schema-validating fixture transport.
- Independently reran 164 existing tests, all passing: 82 shared governance/target schemas, 21 model-access editor tests, 37 file/evaluator/save-adapter/contract tests, 24 locale checks. One worker, existing dependencies,
/opt/node/bin/node; no dependency installation. The targeted HTTP route suite did not collect because this existing install lacks pinned[email protected]; no substitute version or stubs were introduced. - EN/DE/FR docs accurately explain required targeted scopes, scope reset and explicit legacy repair. Nonblocking copy nit:
targetsNeedRepairin EN/DE/FR says “all rules have targets”; “all targeted rules” would avoid implying default rules need one.
Unrun proof / CI
No real browser, visual/focus/mobile rendering, screen-reader audio, local stack, E2E, container, live backend integration, full-workspace lint/typecheck or actual administrator repair was run. jsdom accessibility assertions are not browser proof. Author's 347-test receipt was read but its delivery logs are not mounted here; the 164-test count above is my own fresh execution. CI was passively read, with checks still pending; green badges are not claimed as fresh executions and this review does not authorize merge.
Delivery evidence: /agent/output/d54fa2ad-bed0-431e-a399-204d1a41ca28/ — probe source; exact-head and base-schema-control logs; existing-suite logs; PR/CI readbacks; review receipt. Next owner: implementation author for R1, then independent re-review and the remaining browser/integration/CI disposition through TALE-359.
a3f9f7e to
07aa632
Compare
The v0.5.89 notes said the upgrade needs no database migration or manual configuration change and described only the native CLI fix. The release adds migration 0204_usage_ledger_provider.sql, moves the API contract from 3.43.0 to 3.44.0, and turns coding-agent sign-in on by default, although the v0.5.88 notes said it stays off unless an operator turns it on. The Upgrade notes now name the migration, applied at boot, and the contract version. They say that sign-in is on by default, which public surfaces that opens, what it needs, and the two switches that keep agents on API keys, with a pointer to the v0.5.90 notes that repeat it. They also name what else asks something of an operator: the two sandbox settings of #4169 that behave differently, the model-access rules without a target that block model-access changes since #4216, and the OIDC claim mappings that form saves before #4212 removed. The Highlights add agent sign-in, the Connected agents settings page, trigger readiness in the automations list and agent runs in a task's activity. A last bullet says the notes were corrected after publication. The published Release body is not changed by this commit; a person edits it. Closes #4970 Task: TALE-199
The v0.5.89 notes said the upgrade needs no database migration or manual configuration change and described only the native CLI fix. The release adds migration 0204_usage_ledger_provider.sql, moves the API contract from 3.43.0 to 3.44.0, and turns coding-agent sign-in on by default, although the v0.5.88 notes said it stays off unless an operator turns it on. The Upgrade notes now name the migration, applied at boot, and the contract version. They say that sign-in is on by default, which public surfaces that opens, what it needs, and the two switches that keep agents on API keys, with a pointer to the v0.5.90 notes that repeat it. They also name what else asks something of an operator: the two sandbox settings of #4169 that behave differently, the model-access rules without a target that block model-access changes since #4216, and the OIDC claim mappings that form saves before #4212 removed. The Highlights add agent sign-in, the Connected agents settings page, trigger readiness in the automations list and agent runs in a task's activity. A last bullet says the notes were corrected after publication. The published Release body is not changed by this commit; a person edits it. Closes #4970 Task: TALE-199
What changed
scopeIdfor User, Team and Role model-access rules at confirmation and the shared server/write schema boundary. Default rules remain target-free. Changing scope clears the old target while retaining the target picker.Verification
6524150fe108180696b9364a46adfbd621349f00: three missing-target schema cases and three real-editor confirmation cases fail; controls pass.Remaining proof
No local stack, browser, E2E or containers were run under this dispatch's resource constraints. Real browser focus/layout, narrow-width EN/DE/FR presentation, screen-reader announcements and live backend integration remain unrun locally. No production policy was changed. CI and independent acceptance are required; queued checks are not treated as failures or passes.
Closes #3639