Skip to content

fix(platform): require targets for model access rules - #4216

Merged
yannickmonney merged 2 commits into
mainfrom
fix/model-access-required-target
Oct 13, 2026
Merged

yannickmonney merged 2 commits into
mainfrom
fix/model-access-required-target

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

What changed

  • Require a non-whitespace scopeId for 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.
  • Preserve old targetless rules on file reads and policy snapshots instead of dropping the policy and its valid restrictions. Show an accessible, localized missing-target warning and keep the affected rows editable, including disabled policies. Administrators explicitly choose targets or delete rules; writes remain blocked until all targeted rules are repaired. No targets are guessed and no stored policy is automatically changed.
  • Add EN/DE/FR validation/recovery copy and admin documentation, with a manual automation-register entry.

Verification

  • Regression on base 6524150fe108180696b9364a46adfbd621349f00: three missing-target schema cases and three real-editor confirmation cases fail; controls pass.
  • Scoped suites: 107 shared-schema tests, 21 editor tests, 170 backend tests, 19 save-adapter/contract tests, 24 locale checks and six docs locale/structure checks pass.
  • Editor controls drive the real save adapter through a schema-validating fixture HTTP transport and the real model-access evaluator for all three targeted scopes. File tests preserve JSON/YAML legacy rules, model-API settings and neighboring restrictions, permit repair snapshots and reject invalid serialization.
  • Scoped TypeScript diagnostics, type-aware lint, formatting, manual-layer gate, conflict/diff gates and local scoped SAST pass (no findings).

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

@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 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: targetsNeedRepair in 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.

@yannickmonney
yannickmonney force-pushed the fix/model-access-required-target branch from a3f9f7e to 07aa632 Compare October 13, 2026 10:37
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 13, 2026
@yannickmonney
yannickmonney removed this pull request from the merge queue due to a manual request Oct 13, 2026
@yannickmonney
yannickmonney merged commit 86296ed into main Oct 13, 2026
@yannickmonney
yannickmonney deleted the fix/model-access-required-target branch October 13, 2026 12:17
tale-review-bot pushed a commit that referenced this pull request Oct 30, 2026
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
tale-code-bot added a commit that referenced this pull request Oct 31, 2026
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
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): model access saves targeted block rules without a target, so they enforce nothing

1 participant