Skip to content

fix(plugin-approvals): a locked record's refusal names it only by a field the writer may read - #38555

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/sec2-h2hw
Nov 29, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/sec2-h2hw

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:审批锁定期间编辑记录被拒时,提示只会用编辑者能读到的字段称呼这条记录;若该字段是内部字段或凭据字段,提示改为只写对象名称,其余不变。
  • 为什么做:加固审批插件的记录锁提示,让拒绝提示与其它读取路径一样,不出现任何人都读不到的字段。
  • 出错会怎样:最坏情况是某条普通记录的拒绝提示少了记录标题、只剩对象名称,编辑仍照常被拒;改动可直接撤回。
  • 要你做什么:无

What changes

A locked record's refusal names it only by a field the writer may read.

  • While an approval holds a record, the RECORD_LOCKED refusal names the record by its display field only when that field is one a caller can be served at all. A display field declared internal: true, or of a credential type (secret, password), never titles the refusal, whether it is the object's explicit nameField or the derived one.
  • When the field-visibility source cannot answer, the refusal names no title.
  • The refusal keeps its code (RECORD_LOCKED), its status (409) and its sentence. Without a title it names the object's label ("This Vault Entry is locked while an approval is in progress, ..."). An ordinary display field still names the record as before, with or without a field-visibility source wired.
  • Changeset: @objectstack/plugin-approvals patch.

Read first, by risk:

  1. packages/plugins/plugin-approvals/src/lifecycle-hooks.ts: the new isWithheldTitleField and its one call in recordTitleOf, plus the failClosedOnThrow argument at the per-row refusal.
  2. packages/plugins/plugin-approvals/src/payload-redaction.ts: the opt-in failClosedOnThrow branch. Callers that do not pass it are unchanged.
  3. packages/plugins/plugin-approvals/src/record-lock-refusal-writer-fls.integration.test.ts: the new top-level describe.

Tests

The new pins sit in the existing harness file as a top-level describe. They run against a real ObjectQL, a real sqlite driver and the real lock hooks:

  • an internal display field named by the object: by-id update and predicate update;
  • an internal display field the object derives;
  • a credential-typed display field;
  • a line under a locked master, on update and on delete;
  • a field-visibility source that cannot answer;
  • with no source wired, a withheld display field still gives no title;
  • controls: an ordinary display field still names the record, with a source wired and with none.

Red on base, green on head:

Readings
  • Base (pins only, commit da50bf0): 6 failed, 8 passed (14).
  • Head 33765d4: 14/14 passed. With the neighbouring lock suites (record-lock-user-facing-message, detail-row-lock): 3 files, 54/54.
  • Ablation, each guard reverted on disk through scripts/ablation-replace.mjs, then restored (blob equals HEAD, git diff HEAD empty):
    • withheld-field guard removed: 5 failed, 9 passed. These are the five withheld-field pins; the throw pin stays green.
    • fail-closed argument flipped to false: 1 failed, 13 passed. That one is the throw pin.
    • A first attempt at the second ablation ran nothing: the tool refused it because the replacement text already occurred in the file. It was re-run with a distinct replacement.
  • pnpm --filter @objectstack/plugin-approvals test: 131/131 files, 1997/1997 tests.
  • pnpm --filter @objectstack/plugin-approvals typecheck: exit 0. That covers tsc, the scripts project and check:test-typecheck OK.

Acceptance notes

  • The line-under-master refusal (detail-row lock) already named only the master's label on base. Its new pin is green on base and guards it. Deleting the locked record itself is not refused, by design, so it has no refusal to pin.
  • origin/main moved 7 commits past the base. None of them touches packages/plugins/plugin-approvals, packages/core/src or packages/spec/src/data, so the branch was not merged.

Verification

Gates
  • node scripts/pm/dispatch-gates.mjs --commands (head 33765d4) derived 71 families. Local results: 69 exit 0. 2 exit 3 (PREREQUISITE NOT MET, a whole-repo build is absent), so they are NOT MEASURED locally and CI carries them: pnpm check:dual-build-cjs-loads, pnpm check:i18n.
  • --ran reconciliation: 71 accounted, 69 run, 2 NOT-MEASURED, 0 UNRUN.
  • Dogfood battery on head 33765d4 (pnpm --filter @objectstack/dogfood test, after building its closure): the lock VERDICT reads command-exit 0. Test Files: 495 passed, 3 skipped (498). Tests: 4183 passed, 68 skipped (4251). No failures. The lock was held 3602 s on a shared box, closure build included, and it flagged holder-side starvation for that length.

Two-minute check:

pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/record-lock-refusal-writer-fls.integration.test.ts

Expect 14 passed. Revert the fix files to origin/main and expect 6 failed.

🤖 Generated with Claude Code

https://claude.ai/code/session_017xRBcW9L8Noz9BxEwjwiov

…nly by a field the writer may read

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcW9L8Noz9BxEwjwiov
…ield the writer may read

A display field declared internal or of a credential type never titles the
refusal, and a field-visibility source that cannot answer gives no title.
Code, status and the rest of the sentence are unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcW9L8Noz9BxEwjwiov
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 29, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract-review-claim: session_017xRBcW9L8Noz9BxEwjwiov · head 33765d4 · 2026-11-29T09:22Z

The full round at CONTRACT_REVIEW_TIER, in-seat, by an isolated reviewer.

@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-approvals, touching 4 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/permissions/system-context.mdx (via bindApprovalLockHook (symbol, a top-level function))
What this run could not see
  • the SDK route bridge reached 69 of 253 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 9e5be7bb461274c8adf3204f2a179f86a485cf7d → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 620f0359ae603e04ba38abdd44542ed1eba2c56c — the merge of head 33765d47cf9765fa845da2a1f3b137ad1360e73a into base 9e5be7bb461274c8adf3204f2a179f86a485cf7d, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 620f0359ae603e04ba38abdd44542ed1eba2c56c && git checkout 620f0359ae603e04ba38abdd44542ed1eba2c56c
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9e5be7bb461274c8adf3204f2a179f86a485cf7d 33765d47cf9765fa845da2a1f3b137ad1360e73a && git checkout -B drift-repro 9e5be7bb461274c8adf3204f2a179f86a485cf7d && git merge --no-ff 33765d47cf9765fa845da2a1f3b137ad1360e73a

node scripts/docs-audit/affected-docs.mjs --json 9e5be7bb461274c8adf3204f2a179f86a485cf7d

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 9e5be7bb461274c8adf3204f2a179f86a485cf7d → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 33765d47cf9765fa845da2a1f3b137ad1360e73a
Reviewed-by: an isolated reviewer session (effort high), full round
Local-runs: probe — the reviewer built the closure in a throwaway worktree, removed after, and ran the new pins on base and head, a per-guard ablation, an edge-case probe on the real engine with the real lock hook, and the plugin-approvals suite, typecheck and lint. Private probe files were deleted.

What the reviewer measured:

  • The two field sets the guard uses match the sets the read path withholds.
  • The new pins are red on base and green at head, and each half of the guard ablates to its own pins.
  • Every display-field shape probed names no title when its field is withheld: an alias, a derived field, a non-existent field, a formula, and an extension.
  • The adjacent approval paths read through the engine's read path. None of them serves a withheld value.
  • The refusal keeps its code, status and sentence, and an ordinary display field still names the record.
  • plugin-approvals: 131 files and 1997 tests pass; typecheck and lint are clean.

No must-fix, no should-fix.

Nits (optional): the changeset's "cannot answer" means a throw only; the JSDoc on the lock hook still describes the old behaviour when no source is wired.

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

席位核对

ACCEPT · head 33765d47cf9765fa845da2a1f3b137ad1360e73a · 2026-11-29T09:35Z

  1. Form: draft; Clause-②: no, Metadata-protocol: none; the changeset is patch. Four files: packages/plugins/plugin-approvals and the changeset.
  2. Premise measured: the new pins are red on base and green at head. Each guard half is ablated (record 7253853554).
  3. Gates: the developer's dispatch-gates --ran reconciled 71 families: 69 ran, and 2 were not measured because the whole-repo dist was absent. CI carries those two. Dogfood: 4183 passed. Check-runs on this head are read at landing.
  4. Accepted deviations: the line-under-master pin is a regression guard, green on base, as the premise reading found.
  5. Out of scope, and where it goes: recorded privately on the seat's record.
  6. Landing: not governed (check-governed-merges --pr 38555: 0 of 4 paths, 244 lines). This seat lands it through the queue once CI is green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Landing 2026-11-29T09:47Z, head 33765d47.

reading value
check-runs on head 39 success, 16 skipped, 0 failed
check-governed-merges --pr 38555 not governed (0 of 4 paths), 244 lines
mergeable clean

State: ready, with auto-merge through the merge queue.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 29, 2026 09:47
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit d08d2ae Nov 29, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/sec2-h2hw branch November 29, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants