Skip to content

feat(data): one record lock read owned by the data layer (ADR-0162 D9) - #38913

Merged
objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/project-thread-zy4rim
Dec 1, 2026
Merged

objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/project-thread-zy4rim

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Fixes #37770

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #38961

维护者速读

What changes

ADR-0162 D9: one answer to "is this record locked, and by which lock", for both locks a record can be under.

  • Answer shape (packages/spec/src/api/record-lock.zod.ts): RecordLockSchema, GetRecordLocksRequestSchema, RecordLockEntrySchema, GetRecordLocksResponseSchema, RECORD_LOCKS_MAX_RECORD_IDS = 200. Spelled as two strict arms (locked: true with both kinds, locked: false with none) so the published JSON Schema carries the "both kinds exactly when locked" rule too. Done-when item 5 (N12): the internal seam requires the source, so lockSource is never optional under approval.
  • The read (packages/objectql/src/record-lock-read.ts, ObjectQL#getRecordLock / #getRecordLocks). Readability is read as the caller, with each form's approvals-counterpart anchor (seat ruling 7152650156): the single read counts any row its by-id read returns and judges the engine-spelled id; the page counts a row only when its id is the asked id. The closed-state producer reads straight from the driver, above the caller's grants (so field permissions on the state field do not hide the answer, per D9) and inside the caller's org scope (buildDriverOptions). A store read that fails is thrown, never read as open. Order: closed_state before approval; within a reason master before record.
  • The approvals producer (packages/plugins/plugin-approvals/src/record-lock-producer.ts): pending under a locking node, or a passage on a closedStates object, for the record itself and for master_detail lines of such a master. It reuses the lock hooks' own helpers (four of them gain export in lifecycle-hooks.ts, which the package entry does not re-export). It is bound beside the lock hooks inside the disableAutoHooks block and cleared in destroy(), so a composition that binds no approval lock answers no approval lock.
  • Data protocol (packages/metadata-protocol/src/protocol-record-lock.ts): getRecordLock / getRecordLocks, the object-existence gate first, then the engine. An engine without the read answers undefined, which the REST doors turn into 501.
  • REST (packages/rest/src/record-lock-routes.ts, registered from data-action-routes.ts, so rest-server.ts does not move): closed empty query sets, sendOk envelope, the by-id read's localized 404 RECORD_NOT_FOUND with Vary, 400 for a bad page body, 501 when the read is missing. Two ledger rows (data.getRecordLock, data.getRecordLocks) with their response schemas.
  • SDK (packages/client): data.getRecordLock(object, id) and data.getRecordLocks(object, recordIds), with the types re-exported.
  • Upload-link door (packages/services/service-storage/src/record-file-access.ts): asks engine.getRecordLock as the caller before it issues a field link and refuses 409 RECORD_LOCKED with "the record is closed, so no file can be added to it" on closed_state, or the existing approval sentence on approval. An engine without the read falls back to the approvals service, as before.
  • Docs: content/docs/api/data-api.mdx § Record locks, content/docs/api/client-sdk.mdx, and a pointer from the approvals lock reads in content/docs/automation/approvals.mdx.
  • Engine line ceiling: engine.ts gains one import line and two one-statement forwarders (+3, 6857 → 6860). The check:facade-delegation-only row is raised by that measured growth, per the maintainer's ruling record 7314474264 on One lock read owned by the data layer: "is this record locked, and by which lock" for closed states and pending approvals (ADR-0162 item 2) #37770 (「提到 6861」): baseLines 6860 at dd7675de60, maxLines 6860. No other engine growth is covered by that ruling.
  • Level: the two new request and response shapes enter the api authorable-surface shard, which the changeset level axis reads as Metadata-protocol: added, so @objectstack/spec is a minor; the other packages are patch.

Out of scope here: moving the console askers (record page, grid, line grid) onto this read belongs to #37773, together with its wording.

Follow-ups: #38961 (the skills page § Reading the lock points at this read) and #38962 (the contract review's nits: pin the passage arm and the read's jsdoc on a failed store read; the closed-state lines' semi-join and the repeated foreign-key read).

Why

A client could only ask the approvals read, which knows nothing of closed states, so a closed invoice looked editable until the save was refused. ADR-0162 D9 (adopted, ruling record 7200732942) puts one read in the data layer for both.

Tests

  • plugin-approvals/src/record-lock-one-read-37770.integration.test.ts (11): real ObjectQL over better-sqlite3 with the real ApprovalsServicePlugin. Every Done-when combination: closed own, line of a closed master, held by an approval, line of a held master, both at once, neither, unreadable, missing; agreement with the write path; the reader whose field permissions hide the state field is told closed_state; no read on the object refuses the same for every id; lockRecord: false and a decided request let go; the approvals-family read still calls a closed record unlocked; without the plugin only closed states lock; destroy() empties the slot, and the cross-package key is the one the engine reads; the page answers entry by entry, refuses 201 ids and takes 200.
  • rest/src/record-lock-routes.test.ts (10): both doors, parsed against the ledgered schemas; only the three members are served; 404/Vary; relayed refusals; 501; 400 for each bad body; closed query sets.
  • rest/src/rest-write-route-hook-refusal-sentence.ledger.test.ts: the page door's write-verb row is driven.
  • service-storage/src/record-file-access.integration.test.ts: the fixture's approvals stand-in now also fills the engine slot; a new case pins the closed-state sentence and that closed wins over held.

Acceptance notes

  • git diff origin/main -- packages/rest/src/approvals-routes.ts packages/spec/src/contracts and the client's approvals.* methods: no change (Done-when item 7).
  • The read answers for a caller. A system context is bound by neither lock and is not described.
  • No permission or sharing boundary moves: readability is the caller's existing read, and the answer carries no field, value, request id or participants.

Verification

  • Package typechecks: objectql, metadata-protocol, rest, client, plugin-approvals, service-storage — clean.
  • Spec build with generated baselines regenerated and committed (authorable surface, json-schema manifest, api surface, export origins, strictness ledger counts, reference pages, llms.txt inventory).
  • dispatch-gates --commands: every derived gate was run locally. The ones that failed were fixed (route envelope, query-options erasure, ADR-0122 alias pins, api surface, docs, export origins, llms.txt, facade ceiling under ruling 7314474264). Four could not run here, for environment reasons only: check-plugin-teardown-shape --self-test needs an unshallow clone, and check:skill-examples, check:dual-build-cjs-loads and check:i18n need built dists. CI runs all four.
  • Package suites: objectql 14662, rest census and route tests, plugin-approvals, service-storage 94, metadata-protocol canonical-fold census — green.
  • overlap-check: clean against origin/main, feat(spec)!: a view holds lists only; view-held forms are tombstoned #38908, feat(spec)!: a view holds lists only; view-held forms are tombstoned #38888.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM

The engine answers { locked, lockSource?, lockReason? } | null for one
record and for a page of up to 200, composing its closed-state judgement
with the approvals plugin's, which it reads through an internal engine
slot the plugin fills beside its lock hooks. The data protocol, two data
routes, two SDK methods and the upload-link door ask it; docs and the
changeset come with it. Tests follow.

Claude-Session: https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM
Co-authored-by: Claude <noreply@anthropic.com>
…nk door

Every combination on a real engine with the real approvals plugin (and
without it), the page bound and entry-by-entry answers, the field-hidden
state field, the slot's lifetime; the two REST doors against the ledgered
schemas; the upload-link door's two sentences by the lock's reason.

Claude-Session: https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl 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 Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 7 package(s): @objectstack/client, @objectstack/metadata-protocol, @objectstack/objectql, @objectstack/plugin-approvals, @objectstack/rest, @objectstack/service-storage, @objectstack/spec, touching 102 documentable anchor(s). ⚠️ 9 changed file(s) yielded no anchor (packages/spec/api-surface/api.json, packages/spec/authorable-surface/api.json, packages/spec/docs/references/README.md, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

32 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json ec7b37d091aabf26a0bc47aaf7b811dab6ba9557.

⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 9 changed file(s) yielded no anchor (packages/spec/api-surface/api.json, packages/spec/authorable-surface/api.json, packages/spec/docs/references/README.md, …) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: responseSchema (7 routes)
  • 1 anchor(s) matched too much of the corpus to be a work list: VALIDATION_ERROR (literal, 40 pages)
  • 10 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 254 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 193 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 ec7b37d091aabf26a0bc47aaf7b811dab6ba9557 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from e60168e94017f126187ced3b7790e71c0de3178f — the merge of head 1eb27e75b91a3da4f1bf9aa4ad2d54a970e572d3 into base ec7b37d091aabf26a0bc47aaf7b811dab6ba9557, 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 e60168e94017f126187ced3b7790e71c0de3178f && git checkout e60168e94017f126187ced3b7790e71c0de3178f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ec7b37d091aabf26a0bc47aaf7b811dab6ba9557 1eb27e75b91a3da4f1bf9aa4ad2d54a970e572d3 && git checkout -B drift-repro ec7b37d091aabf26a0bc47aaf7b811dab6ba9557 && git merge --no-ff 1eb27e75b91a3da4f1bf9aa4ad2d54a970e572d3

node scripts/docs-audit/affected-docs.mjs --json ec7b37d091aabf26a0bc47aaf7b811dab6ba9557

⚠️ 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 ec7b37d091aabf26a0bc47aaf7b811dab6ba9557 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…erated reference page

Claude-Session: https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM
Co-authored-by: Claude <noreply@anthropic.com>
… so spec is a minor

The authorable-surface api shard records the two new request and response
shapes, which the level axis reads as Metadata-protocol: added.

Claude-Session: https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM
Co-authored-by: Claude <noreply@anthropic.com>
…lock read module

Claude-Session: https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM
Co-authored-by: Claude <noreply@anthropic.com>
…c pins (#37770)

- engine.ts: getRecordLock/getRecordLocks are one-statement forwarders
  handing record-lock-read.ts the update facet host and the engine.
- record-lock-routes.ts answers refusals through handleRouteError and is
  declared conformant in check-route-envelope.
- RecordLockSource/RecordLockReason are z.input aliases; the six record
  lock shapes are pinned isomorphic (ADR-0122).
- The integration test passes its engine options untyped-cast-free.

Claude-Session: https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM
Co-authored-by: Claude <noreply@anthropic.com>
…acet names (#37770)

- record-lock-routes.ts joins REST_SERVER_REGISTRAR_FILES, with its
  query-slot floor (0) and docblock floor (9); the page door's #8497
  disposition is no-record-echo.
- The protocol facet functions are readRecordLock / readRecordLocks, so
  the canonical-fold census resolves the stubs to their bodies.
- The approvals producer's record-id sets no longer read as pending slates.
- engine.ts drops the blank line after the two forwarders (+3).

Claude-Session: https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzfGw8DS75kHUYrjbLM

CI status (2026-12-01T13:47Z): one known red, waiting on a maintainer ruling

Lint · repo & tooling gates / Lint & Repo Gates fail on check:facade-delegation-only N6. packages/objectql/src/engine.ts has a line ceiling of 6857 (ruling 7051956587), and main is already at exactly 6857. The read's body lives in its own module (record-lock-read.ts). The engine gains one import line plus two one-statement forwarders (getRecordLock, getRecordLocks), and the gate accepts both as delegations. That makes the file 6860 lines (+3). Only a maintainer can raise the ceiling, so the seat has asked for a ruling on 6857 → 6860. The registry row is not touched until that ruling is recorded.

The other reds on the earlier heads (route-envelope, ADR-0122 aliases, query-options erasure, the protocol fold census, the approver-address census, the REST registrar censuses) are fixed at dd7675de.


Generated by Claude Code

…4264 (#37770)

The maintainer ruled the engine.ts line ceiling may rise by the measured
growth of the record lock read's two forwarders and their import (+3),
ruling record 7314474264 on #37770. baseLines/baseCommit re-measured at
dd7675d (6860 lines); maxLines 6860.

Claude-Session: https://claude.ai/code/session_01WGufzfGw8DS75kHUYrjbLM
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzfGw8DS75kHUYrjbLM

The brief handed to the isolated contract reviewer for the record that follows (filled template, record-recognisers.mjs --brief-template).

Contract review brief — PR #38913 @ 1eb27e75b91a3da4f1bf9aa4ad2d54a970e572d3 (card #37770)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #37770: its body and EVERY comment (rulings and earlier records included)
· PR #38913: its body, its file list, and the net diff against main at 1eb27e75b91a3da4f1bf9aa4ad2d54a970e572d3
· the check-runs on 1eb27e75b91a3da4f1bf9aa4ad2d54a970e572d3: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: packages/spec/src/api/index.ts, packages/spec/src/api/record-lock.zod.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

Security — if a hits path is under skills/** or ui/skills/** and the change teaches security, auth or permission
behaviour the path name doesn't show, the record says so and the seat adopting the record adds the security label.
The record says so on its Security-touching: line, and the arm lands on no alone: write no ONLY when no changed
hunk teaches permission, sharing, credential, token, authentication or other security behaviour, else yes.

Rule change — if a hits path is under .claude/**: the PR body declares Rule-change: and you verify it against the diff.
Write Rule-change-verified: none ONLY when no changed hunk alters what an agent may do without the maintainer
(merge, bypass a check, change repository settings), what gets done and in what order (grading, dispatch, scope), or
what must go to him (decisions, maintainer actions); process steps, scripts, wording, slimming and file moves are not rule
changes. Write ruled ONLY when every such hunk copies the ruling the PR body quotes on its Ruling-ref: line — check the
copy against the quoted words, do not re-rule it. Otherwise yes: the pull request then waits for the maintainer.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-claude/dae20778-95ca-5f16-8b18-aea1464b88bf/scratchpad/pr-38913/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzfGw8DS75kHUYrjbLM

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 1eb27e75b91a3da4f1bf9aa4ad2d54a970e572d3
Local-runs: none
Scope: packages/spec/src/api/index.ts, packages/spec/src/api/record-lock.zod.ts + packages/objectql/src/record-lock-read.ts, packages/objectql/src/engine.ts, packages/plugins/plugin-approvals/src/record-lock-producer.ts, packages/plugins/plugin-approvals/src/approvals-plugin.ts, packages/plugins/plugin-approvals/src/lifecycle-hooks.ts, packages/metadata-protocol/src/protocol-record-lock.ts, packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/src/host-engine.ts, packages/rest/src/record-lock-routes.ts, packages/rest/src/data-action-routes.ts, packages/rest/src/rest-route-ledger.ts, packages/client/src/index.ts, packages/services/service-storage/src/record-file-access.ts
Security-touching: yes
Rule-change-verified: none

PR #38913 for card #37770, reviewed read-only: the card with its five comments, the PR body and file list (40 files), the net diff against main, and the check-runs on this head. The rest of the diff (tests, generated spec baselines, docs, changeset, the census and envelope registries) is outside this record and is the lane seat's ACCEPT at TIER_DEFAULT.

① Derived judgments

Every accept-set and public-surface change the diff implies:

  • @objectstack/spec/api gains 13 exports (RECORD_LOCKS_MAX_RECORD_IDS, and the schema and type of RecordLockSource, RecordLockReason, RecordLock, RecordLockEntry, GetRecordLocksRequest, GetRecordLocksResponse). Additive. Right.
  • The api authorable-surface shard gains two keys (GetRecordLocksRequest:recordIds, GetRecordLocksResponse:records). The PR declares Metadata-protocol: added; the card and the claim said none. The PR's line is the right one: the level gate refuses none beside a moved authorable-surface shard, so the card's value was an estimate the tree corrected.
  • Two new REST routes, GET /api/v1/data/:object/:id/lock and POST /api/v1/data/:object/locks, each with a ledger row and a response schema. No existing data-family route collides with either path and none changes its answer. Right.
  • Two new SDK methods, client.data.getRecordLock and client.data.getRecordLocks, and four type re-exports. Additive. Right.
  • ObjectQL gains two public members and one engine slot. The slot's key is a Symbol.for spelled in both packages and exported from neither package entry (the objectql and plugin-approvals export maps were read), so the seam is internal to the two packages, as the card requires. Right.
  • The data protocol gains two members, and MetadataHostEngine two optional ones. Additive. Right.
  • plugin-approvals: four helpers gain export in lifecycle-hooks.ts. The package entry does not re-export that module and the export map holds . alone, so nothing published moves. Right.
  • The upload-link mint door's accept set moves, in both directions. Narrower: a field link for a closed record, or for a record held in a passage of an approval, is now refused 409 RECORD_LOCKED when it is minted; on main the link was issued and the upload was refused by the lock when the link was used. Wider: where the approvals service is present but binds no lock (disableAutoHooks), a pending request no longer refuses the mint, which now agrees with the write (no hook, the write lands). The PR declares (widening) and no narrowing arm. Right: the earlier refusal makes the lock's own refusal real one door sooner and takes no declared capability away, it is what ADR-0162 D8 and D9 and Done-when item 6 ask for, and the changeset body names the move in its own sentence.
  • The approvals family is untouched. git diff is empty for packages/rest/src/approvals-routes.ts, packages/spec/src/contracts/ and packages/plugins/plugin-approvals/src/approval-service.ts, and the client diff carries no approvals.* hunk. Done-when item 7 holds.

② Semver level

Clause-②: yes (widening)

The changeset names seven packages and the diff moves exactly those seven. @objectstack/spec is minor, which the added kind requires on a package the diff moves; the other six are patch, which a non-protocol widening ships. Both declaration lines read the same in the PR body and in the changeset body. Both Check Changeset runs concluded success on this head. The level matches what the diff publishes.

③ Boundary flags

  • Done-when item 5 (review note N12), the dev's choice: the internal seam requires the source. Answered, and right. The producer's answer is a map from an id to 'record' or 'master', so a held id always carries its source, and RecordLockSchema's locked arm requires both members. The approvals contract, which lets an implementation omit lockSource, is not the seam and is not touched.
  • Console askers deferred to Console: read the one lock read, word "closed" apart from "in approval", and save a closing header last (ADR-0162 item 4) #37773 (scope note 7311133382). Answered: acceptable. ADR-0162 Execution item 4 gives the console's reading of the one read to the console card, this card's Done-when names no console item, and until that card lands the console asks the approvals-family read exactly as on main, so nothing regresses. One thing for the seat at close: the card's Expected line "First-party askers move to it" is delivered for the upload-link door only, and Fixes #37770 closes the card. Console: read the one lock read, word "closed" apart from "in approval", and save a closing header last (ADR-0162 item 4) #37773 was not among this review's inputs, so that it carries the remainder is the seat's statement and is not verified here.
  • Metadata-protocol moved from none (card, claim) to added (PR). Answered in ①.
  • The engine.ts line ceiling. Covered by the maintainer's ruling record 7314474264 on the card (「提到 6861」). Verified on the tree: engine.ts is 6857 lines on main and 6860 at this head, the growth is one import line and two one-statement forwarders, and the registry row reads baseLines 6860, maxLines 6860 and cites the ruling, inside the 6861 the ruling allows. Lint · CI, release & engine gates concluded success.
  • Four gates the dev could not run locally (check-plugin-teardown-shape --self-test, check:skill-examples, check:dual-build-cjs-loads, check:i18n). CI's to answer; see the next item.
  • Check-runs on this head, read at 2026-12-01T14:49Z: 75 runs; 29 success, 14 skipped, none failed, cancelled or timed out. Still in progress, 32: Build Core, Type Check · workspace, Type Check UI, Build & E2E UI, Test Core 1/12 to 12/12 and Test UI 1/16 to 16/16. No test verdict was in when this record was written. This record judges the contract; the gate verdicts for the tests are the check-runs' own, and landing waits on them.
  • open_questions: none declared in the PR body or on the card.
  • Security-touching reads yes because the jsdoc and the schema descriptions in record-lock.zod.ts teach who is told the lock (every reader of the record, field permissions on the state field notwithstanding) and what the answer never carries. No hits path is under skills/**, so no label follows from it.
  • Rule-change-verified reads none: no path of the diff is under .claude/**, and no changed hunk alters what an agent may do without the maintainer.
  • SQL push-down (Prime Directive 5). Two findings, both graded in ④ (N2, N3). The approvals producer's in-app judgement is not a third: it reuses the write hook's own helpers, whose stated reason on main is that the judgement reads each request's JSON snapshot and must be the hook's own, bounded by the door's 200 ids.

④ Design judgment

packages/spec/src/api/record-lock.zod.ts against ADR-0162 D9, the card and its first consumers (the two data doors, the SDK, the upload-link door). Holds.

  • The answer is D9's shape. Two strict arms make "both kinds exactly when locked" a property of the published JSON Schema, and the page entry's locked: null arm is the approvals page read's "unreadable or missing, told apart by nothing". D9's null for one record is the engine's and the protocol's; the single door turns it into the by-id read's 404, which the module comment says.
  • Every sentence was read against the code. The paths are the routes registered. The 200 bound equals the approvals bound and is refused whole by the door and by the engine. closed_state before approval and master before record is composeAnswer's order. The delete reading on RecordLockSourceSchema agrees with both enforcers: the approvals record lock is a beforeUpdate hook only, the detail-row lock also guards delete, and the engine's closed-state lock refuses a caller's delete for either source.
  • The file holds schemas, types and one constant, and no runtime logic.

packages/spec/src/api/index.ts: one barrel line. The api-surface and export-origins baselines carry exactly the 13 names. Holds.

Implementing files, against the contract:

  • record-lock-read.ts, engine.ts. Readability is read as the caller with each form's approvals anchor: the single read counts any row and judges the engine-spelled id, the page counts a row only when its id is the asked id. The closed-state producer reads through the driver with buildDriverOptions, above the caller's grants and inside its organization scope, which is how the write path's own anyClosedAmong reads; it uses the write path's closedStateUnitOf and closedPredicate, so the read and the write judge "closed" by one definition. A line under two masters is judged on every edge. Agrees.
  • record-lock-producer.ts, approvals-plugin.ts, lifecycle-hooks.ts. Pending under a locking node is the hooks' own recordsHeldByLockingApproval and detailRowsHeldByLockingApproval. The passage is the hooks' own passageRequestsFor and approvalInPassage, so the revise window, a newer pending request and an abandoned approval let go where the hooks let go. I tried to make a pending request under a lockRecord: false node read as held through the passage arm: it cannot, because the mark is written only in the update that sets approved or rejected. What belongs to a write (the approval's own runs, a mirror-only write, a system context) is left out, as D9 says. The slot is bound inside the disableAutoHooks block beside the two locks and cleared at both unbindAllHooks call sites. Agrees.
  • protocol-record-lock.ts, protocol.ts, host-engine.ts. The object-existence gate runs first, the engine answers, and an engine without the read answers undefined. Agrees.
  • record-lock-routes.ts, data-action-routes.ts, rest-route-ledger.ts. Auth and API access run before anything is read, both query sets are closed, the page body is refused whole in each bad shape, the answer is rebuilt member by member so nothing else a producer hands back is served, and a missing read is 501 and never "unlocked". The page door validates by hand, not by GetRecordLocksRequestSchema, but refuses exactly what the schema refuses. Agrees.
  • packages/client/src/index.ts. The two methods call the two routes and return the two schema types. Agrees.
  • record-file-access.ts. The door asks the engine's read as the caller and chooses its sentence by lockReason; closed wins over held because the read orders the reasons. Agrees with D8 and Done-when item 6.

Nits. None changes a served answer on a path the contract names. Each is left as an accepted deviation or a follow-up card; none is to be fixed on this head.

  • N1 (nit) — the passage arm of the approvals producer has no pin. D9, and this PR's own approvals.mdx hunk, promise lockReason: 'approval' through a passage, and recordsHeldInPassage and detailRowsHeldInPassage implement it, but no test in the diff drives a marked request (the integration test's "decided request releases" case opens its request with no stamp, so the mark is never set). By reading, the code agrees with the hooks. A follow-up card should pin it: a record in a passage, a line of such a master, and the two let-go cases.
  • N2 (nit) — SQL push-down, no reason given. closedStateLocks judges the lines of a closed master by reading the lines' foreign keys and then asking the master with an id list, where the same module's predicate judgement already runs that question as one semi-join statement per edge when the store serves it (lineProbeServes, ReadableIds.compose). The cost here is bounded by the door: at most 200 ids and one extra read per page. The reason the file should have stated is that bound, plus the masters on another driver or tenancy class that need the two-read path anyway.
  • N3 (nit) — a repeated read. detailRowsHeldInPassage reads the same rows' foreign-key columns that detailRowsHeldByLockingApproval reads in the same call, and reads them on every detail object, also where no master declares closedStates and the passage arm can answer nothing. One read too many per call on a detail object.
  • N4 (nit) — one jsdoc sentence overclaims. record-lock-read.ts says under "Reads" that a store read that fails is thrown and never read as open. That holds for the closed-state producer. The approvals producer's bookkeeping reads (pendingRequestsForRecords, passageRequestsFor) catch a failure and answer none, so a failed read of sys_approval_request answers unlocked. That is the write hook's own documented degradation, so the read and the write still agree; the sentence should be scoped to the closed-state reads.
  • N5 (nit) — a line whose stored master_detail value is not one id. The by-id write refuses it as cannot_judge with RECORD_LOCKED; the read's scalarId drops the value and answers that edge as not held. It needs a corrupt foreign key to arise.

No must-fix, no should-fix.

Implemented-by: claude/project-thread-zy4rim
Reviewed-by: session_01WGufzfGw8DS75kHUYrjbLM (isolated L2 subagent of this session; it read the brief's inputs and nothing else)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

L1 review · PR #38913 (#37770) · head 1eb27e7 · 2026-12-01T15:05Z

Not yet ACCEPT: one paper must-fix, which does not move the head. The code and the docs are ACCEPT-ready. I read L2 7314973164 at this head: PASS at the contract-review tier, no must-fix and no should-fix, N1 to N5 nits. I adopt it as the contract record.

P1 (must-fix, PR body only) · the Skills-docs: line is owed and missing

  • l1-face flags skills-docs: owed (kind added) and absent. SKILL.md's dispatch shape (Metadata-protocol: row) says a kind other than none owes the PR body a third line: Skills-docs: updated here | follow-up owed — FILES | follow-up #N | none — REASON.
  • added is right. L2 ① confirms the api authorable-surface shard gains two keys, and the level gate refuses none beside it.
  • The skill the new read most plausibly teaches is objectstack-api, the server API surface, or objectstack-query/objectstack-ui for a page that asks before a save. This is a client read, so none — REASON may hold, but the seat chooses.
  • If it is follow-up owed — FILES, the seat files the card and rewrites it to #N before ACCEPT (seat-post-protocol.md).
  • Add the line, tell me, and I confirm on this head with no new round.

What I checked (pass)

  • l1-face: 64 success and 0 failed or pending. mergeable_state is clean. The changeset entries cover all 7 touched published packages. The declarations read Clause-②: yes (widening) · Metadata-protocol: added in both the PR body and the changeset.
  • Semver. @objectstack/spec is minor, which added requires, and the other six packages are patch.
  • Facade ceiling. engine.ts goes from 6857 to 6860 (+3: one import and two forwarders). The row is raised to the measured 6860, below the 6861 that ruling 7314474264 allowed (「提到 6861」). The PR body quotes the ruling.
  • Owed prose reads. I read the changeset and the four docs pages sentence by sentence: client-sdk.mdx, data-api.mdx 〈Record locks〉, approvals.mdx, and the references/index.mdx counts. They match the schema (locked, with lockReason and lockSource present exactly when locked), the two doors (404 versus locked: null, the 200-id cap refused whole, 501 with no lock read), and the approvals read left as published.
  • Scope. This is the read, the seam, the two data doors, the SDK, the upload-link door and the docs, as agreed with the seat. The console askers move to Console: read the one lock read, word "closed" apart from "in approval", and save a closing header last (ADR-0162 item 4) #37773. Fixes #37770 is right on that scope.
  • L2 timing. The record was written while 32 test runs were still in progress. All of them have since concluded green on this head, so the gate verdicts are in.

For the seat: the follow-ups from L2's nits are N1 (pin the passage arm) and N2/N3 (one read too many per call). N4's jsdoc sentence can ride along with N1's card.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

L1 confirm · PR #38913 · head 1eb27e7 (unchanged) · 2026-12-01T15:07Z

P1 is closed, and L1 is ACCEPT on this head. The PR body now reads Skills-docs: follow-up owed — skills/objectstack-automation/references/state-machines-and-approvals.md. That is the right page: its § Reading the lock teaches only the approvals read, and no other skills/** page teaches the lock read or closedStates. As seat-post-protocol.md requires, the seat files that follow-up card and rewrites the line to follow-up #N before its own ACCEPT. With L2 7314973164 adopted, nothing else is open, and the PR goes to the seat.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

席位核对

ACCEPT — PR #38913 @ 1eb27e75b91a3da4f1bf9aa4ad2d54a970e572d3 (card #37770, ADR-0162 D9, card thread of seat os-support-ai).

落地

reading value
check-governed-merges.mjs --pr 38913 NOT governed (0 of 40 paths); 1946 changed lines ≤ 3000
pr-state.mjs on 1eb27e75 68 success · 18 expected skip · 0 failed · 0 pending; mergeable_state clean
landing-k.mjs K = 4 < 15
l1-face.mjs every leg ok; skills-docs names #38961

State change: ready for review + auto-merge, by the owning seat; on merge it closes #37770.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 1, 2026 15:17
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 1, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhPdWmTd47Fi2bKYZS

落地

Re-arm after a dequeue read as a timing flake. Queue group gh-readonly-queue/main/pr-38913-d38006b9 (merge commit c04a9b5), run 46677410580: job 142751016827 "Test Core (11/12)" failed on one timeout, no assertion: plugin-approvals src/flow-route.integration.test.ts › "[#38838] a fan-out to two approval steps is refused at publish" › its first case, "Test timed out in 5000ms" at 5235 ms. That case cold-boots a whole kernel (ObjectQL, automation, approvals, sqlite). The suite came from main (#38871) and is in this PR's base; the same shard was green on this PR's head; the other 2270 approvals tests passed in the queue. This diff only binds and clears one slot at approvals start and destroy, with no I/O.

Head unchanged at 1eb27e75; L2 7314973164, L1 7315402848 and land record 7315667979 stand. This is the one re-arm the timeout gets. A second timeout of the same case goes to a card on the suite's boot budget, not a third arm.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46677410580 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (11/12) — 失败步骤: Run this shard's tests

    @objectstack/plugin-approvals:test:  FAIL  src/flow-route.integration.test.ts > [#38838] a fan-out to two approval steps is refused at publish > an active save is refused with 422 INVALID_METADATA, na
      ↳ 失败原因: @objectstack/plugin-approvals:test: Error: Test timed out in 5000ms.
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • src/flow-route.integration.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 1 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

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/xl 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.

One lock read owned by the data layer: "is this record locked, and by which lock" for closed states and pending approvals (ADR-0162 item 2)

2 participants