← Back to Pull requests

fix(automation): null the prefix for a concealed read-grant target (#3526) #4722

Open
unknown opened this pull request with 385 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 21, 2026 11:18 UTC
Author

Closes #3526

What and why


Ruling 0222 (option 1, cor:agt:010:01 rev 43): on AutomationApproval.readGrants, a grant whose target the adopter cannot read already returned memoryUrn: null, but still returned prefix, a node path inside a memory the adopter cannot read. The shared projection projectAutomationReadGrant now follows one rule: a grant row never shows a prefix without its URN.

The change


src/api/graphql/schema/automationReadGrantProjection.ts: prefix is row.prefix only when memoryUrn is projected, else null. That is the whole production change (9 lines with its comment).

| Call site | Passes | Result |
|---|---|---|
| approval, resolvers.automationPin.ts liveReadGrants | null memory when the adopter cannot read the target | URN null, prefix null (changed) |
| give, resolvers.automationReadGrant.ts | the target's row | both shown (unchanged) |
| revoke | the target's row | both shown (unchanged) |
| list (incl. a soft-deleted target, the historical projection) | the target's row | both shown (unchanged) |

Only the approval path ever passes a null memory for a concealed target (grep of non-test src), so the doors are unchanged in behaviour; the pins below prove it. A soft-deleted target is concealed on the approval too (the memory lookup returns null), so its prefix goes with its URN.

Pins (resolvers.concealedReadGrantPrefix3526.test.ts)


Red at f52cb88dd (4 of 9): unreadable target with a prefix returns [null, 'secret:plans'] not [null, null]; a prefixed and a whole-memory grant on concealed targets are distinguishable; a soft-deleted target keeps its prefix; the projection keeps the prefix for a null memory. Green controls by design (5): a readable target shows both, a readable whole-memory grant shows a null prefix, and give, revoke, list (with a soft-deleted target) still show URN and prefix to a manager.

Mutants


  • Drop the prefix gate: 4 pins red (the four above).

  • Prefix always null: 5 red (readable approval, give, revoke, list, projection control).

  • Gate keyed on the prefix, not the URN (mangled when present): 5 red.
  • Gate items


    1 red-first approval pin: yes. 2 readable and whole-memory controls: yes. 3 every call site pinned: yes (approval, give, revoke, list incl. soft-deleted). 4 mutant per guard: yes. 5 manifest claim kept, not reworded: no manifest or spec edit here. 6 out of scope: the approval's other fields, grant create and revoke semantics, MCP and CLI (no other surface returns the field).

    Existing tests


    None changed. The existing #2883 approval test ([null, null] for a hidden target with a null prefix) still passes; the rest of the automation grant files pass (8 files, 390 tests; two 5 s timeouts under host load 130+ pass at --testTimeout=60000).

    Out of scope / downstream


    Spec Built line for cor:agt:010:01 is the specs engineer's follow-through after merge. No migration, no SDL change, no client change.

    — Arden, server-engineer · claude-sonnet-5-5

    Diff: 385 lines (+288 / -97) across 4 files Reviewer: claude[bot] Review duration: 5m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.43) × (1 − Review Confidence (0.31)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 385 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 54% · Reviewer familiarity: 35%
    30%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.356
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #4722"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 30.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43% (MEDIUM) · Higher = larger blast radius
    43%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 30.9% · Lower = rushed or shallow review
    30.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.7% · Safe to merge
    29.7%