Skip to content

feat(plugin-audit, cli)!: hold the audit seal lock across an os migrate audit-* --apply run, and skip a sealer pass while it is held (P4b3) - #33675

Merged
objectstack-fleet[bot] merged 35 commits into
mainfrom
claude/area-A2-31908-p4b3
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 35 commits into
mainfrom
claude/area-A2-31908-p4b3

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Part of #31908 (slice P4b3; seat ruling 6885005594)
Blocked-by: #33489, #33637

Clause-②: yes (narrowing) — narrowed: os migrate audit-key-material, os migrate audit-mail-bodies and os migrate audit-metadata-bodies with --apply now refuse a run that rewrites an object declaring lifecycle.seal when that object's database offers no session lock (SQLite, Turso) unless --sealer-stopped is passed, and on Postgres or MySQL refuse when a sealer pass or another run still holds the audit seal lock after ten minutes; 18.4.0 ran both. os migrate audit-side-copies, new in this release, holds the lock and takes the flag from its first release. Widened: the --sealer-stopped flag, and new exports — @objectstack/objectql acquireDatabaseSessionLock, tryDatabaseSessionLock, databaseSessionLockPgKey and the types DatabaseSessionLock, DatabaseSessionLockRunOptions, DatabaseSessionLockWait; @objectstack/plugin-audit holdAuditSealLock, AUDIT_SEAL_LOCK_NAME, AUDIT_SEAL_LOCK_WAIT_MS, STORED_METADATA_BODY_REWRITTEN_OBJECTS and the types AuditSealLockEngine, AuditSealLockFinish, AuditSealLockHold.
Metadata-protocol: none
Skills-docs: none — skills/** teaches declaring lifecycle.seal, and no line there names an os migrate audit-* command, its flags, or the sealer's locks; the stale sealing lines in skills/objectstack-data/rules/lifecycle.md (one checkpoint per hour, no verifier) are follow-up #33773's, from P4b2.

BREAKING for an os migrate audit-* --apply run on a deployment where an app declared lifecycle.seal: on SQLite or Turso it now stops before writing anything and asks for --sealer-stopped; on Postgres or MySQL it waits for a sealer pass in flight and refuses after ten minutes. A run that rewrites no sealed object is unchanged on every database, and so is every dry run. No object declares lifecycle.seal by default (that is P4c), so nothing changes for a deployment that did not opt in. ADR-0087 disposition, in the changeset: not-required (no-migration-prescription).

Maintainer quick read

What changes

E: the audit seal lock (ADR-0154 D3 as amended in #33489).

  • A second named database session lock, objectstack:audit-seal, beside the schema-migration lock. Both now ride on one extracted module, packages/objectql/src/database-session-lock.ts: a Postgres advisory lock or a MySQL GET_LOCK on a connection of its own outside the pool. The dialect statements live there once. acquireSchemaMigrationLock keeps its name, key, wait, statements and words; only its body moved.
  • The module gains what the sealer needs and the migration lock never did: a try-once form that never waits and never prints (tryDatabaseSessionLock, answering the lock, 'held' or null), and isHeld(), a probe on the lock's own session (a session that ended took the lock with it, so a failed probe reads false).
  • Where it is taken: on the datasource that holds the audit rows, that is each sealed object's hot store (engine.getDriverForObject(object)). Where the hot store differs from the primary, the lock goes on the hot store. One lock per database, not per datasource: two datasources can reach one lock namespace (one Postgres database, or two schemas of one MySQL server, whose GET_LOCK names are server-wide). Each session a run or pass opens is marked with a second lock under a random name, taken before the named lock. A later session of the same run that finds the named lock held asks the database whether the session holding it there is the marked one (pg_locks in the current database; on MySQL, IS_USED_LOCK of the marker against the name). If it is, that lock already covers the database: the session is closed and nothing waits. A holder the run cannot prove its own is contention, as before (review 6894679963 M1).
  • The sealer: each pass takes audit.sealer as before, then try-locks the audit seal lock on each sealed object's database. If another session holds it, the pass lets go of everything it took, writes nothing, and says so at info once an hour while it lasts. Both locks are held for the whole pass and let go when it ends. Before each checkpoint is written, the pass checks that audit.sealer and the seal lock of that object's database both still stand. A lapse of either fails the object's pass, as any lock lapse does (seat ruling 6884540128 item 2), and the seed it sealed is dropped.
  • The migrations: os migrate audit-key-material, audit-mail-bodies, audit-metadata-bodies and audit-side-copies with --apply hold the lock from before their first rewrite to after their last, hot and archive runs included. Contended, they print one line and wait up to AUDIT_SEAL_LOCK_WAIT_MS (ten minutes, the schema-migration lock's wait), then refuse, having changed nothing. A run whose objects declare no lifecycle.seal takes no lock: no sealer pass reads its rows. Dry runs take none.
  • Before any wait, the hold tries every database once. A sealed object on a database that offers no session lock is refused (B) before the run waits on another database (review 6894679963 N2).
  • A run that finds its lock's session ended by the time it finishes says so at error, names os audit verify, and exits non-zero.

B: where the database offers no session lock. On SQLite, Turso and every other dialect, the lock answers null. There, an --apply run that rewrites an object declaring lifecycle.seal is refused before anything is written, naming the object and --sealer-stopped. With --sealer-stopped it goes ahead and prints one line saying it rests on the operator's word. The sealer takes no lock there and seals as before.

os migrate audit-side-copies. main brought this fourth ledger-copy rewrite (#33607) while this PR was open. D3 as amended holds the lock for every os migrate audit-* run, so it gets the same hold (on the copy tables it rewrites, which --object narrows), --sealer-stopped, and the non-zero exit on a lost lock. It is not in 18.4.0, so for it this is no narrowing: it ships with the hold.

The lines an operator reads. The wait, the timed-out refusal and the sealer's skip line name the four commands in full (one constant, AUDIT_SEAL_LOCK_REWRITE_COMMANDS), so check:cli-command-ids holds each name to a real command. The commands hand the hold a callback that calls logger.warn(line) rather than the bare channel (check:logger-receiver-detach).

Not changed: the cluster lock audit.sealer, the unique (sealed_object, chain_key, sequence) index, D7's amend-before-rewrite order, the dry-run default.

Tests

Pins first, red before the fix (bfece9b: the objectql primitive's file fails to load, and the sealer and hold pins fail on behaviour against a constants-only stub).

  • packages/objectql/src/database-session-lock.test.ts: the key derivation (equal to the pinned schema-migration key), the try-once form on each dialect, a failed try handed on, the session probe, a lock of another name waiting and refusing in its caller's words; ownLocks: no marker without it (the schema-migration lock's statements unchanged), the marker taken before the lock, the Postgres check scoped to the current database and bound to both keys' halves, the MySQL check bound to the marker and the name, and a holder that is not the marked session read as contention.
  • packages/plugins/plugin-audit/src/audit-seal/audit-seal-sealer.test.ts, new describe: the pass holds the seal lock at every checkpoint write and lets it go; the hot store and not the primary; a pass skipped while another session holds it, said once, sealing on the first pass after; a session ended mid-pass stores nothing and drops the seed; no lock on a database that offers none.
  • packages/plugins/plugin-audit/src/audit-seal/audit-seal-lock.test.ts: the name, key and wait pinned; the hold on the hot store and not the primary; one lock per database; two datasources on one database (Postgres and MySQL) locked once with no wait and no line; a lost shared lock reported for every object it covered; the run's own lock on another database never read as cover (still waited for and refused); a sealer pass sealing both objects of two datasources on one database; a lockless database refused before any wait on another; none for a run with no sealed object; a failure to take it handed on; a lost session reported; a real sealer pass in flight waited out with the default wait; a timed-out wait refused; a sealer pass skipped while a run holds it; B refused without the flag, with a memory driver too, only for sealed objects, and going ahead with it.
  • packages/cli/src/commands/migrate/audit-redaction-seal.contract.test.ts: each of the four commands declares --sealer-stopped, runs every rewrite under the hold on the objects it rewrites, and exits non-zero on a lost lock.
  • The fake database in seal-store.testkit.ts (sessionLockDatabase) keeps session locks the way Postgres does, waits for real, and ends sessions, so the sealer and a hold contend on one database in-process.

Readings are under Verification below.

Acceptance notes

  • The rulings' wording, as read here. "--apply on any object declaring lifecycle.seal is refused": the whole run is refused before its first write when any object it rewrites is sealed and that object's database offers no lock. "Holds it for the whole run": the lock is held on the databases of the sealed objects the run rewrites; a run that rewrites none takes none, since no sealer pass reads those rows. Lapse: the sealer follows seat ruling 6884540128 item 2 (a lock lapse fails the pass); the migration checks its lock at the end and reports a lost one, because it cannot undo rows it already rewrote.
  • The wait's length (ruling item 6). Ten minutes. A pass in step with the clock seals the one window newly due and re-counts the late horizon, a few hundred reads; a backlog pass is cut at 24 windows, and between two passes the lock is free. The value is pinned, and the staged test waits out a real sealer pass with the default wait.
  • MySQL's GET_LOCK names are server-wide, so two databases on one MySQL server share the audit seal lock, as they already share the schema-migration lock. Across deployments, a rewrite on one makes the other's sealer skip passes while it runs. Not changed here. Within one run or pass, datasources on one server share one lock and never contend with each other (see What changes). On MySQL older than 5.7.5, which keeps one GET_LOCK per session, taking the named lock drops the marker, so such a run reads its own lock as contention, as before this fix. It fails closed and never runs unexcluded.
  • A side effect: two replicas with no cluster service, whose audit.sealer lock is in-process only, now also keep their passes apart through the database lock on Postgres and MySQL. The in-process lock's info line says so.
  • Shared package touched: @objectstack/objectql (schema-migration-lock.ts refactored onto the new module, new exports). No open PR touches schema-migration-lock.ts, the objectql barrel, the audit CLI commands or audit-redaction-seal.ts; sealer.ts was touched by fix(plugin-audit)!: seal a window into checkpoints of at most 10,000 rows, and bound the idle re-walk (P4b2) #33637, which has merged; origin/main is merged in (fbdc0b8), and this PR's diff against main is P4b3 alone, 19 files.

Verification

Local runs are at head fbdc0b8 (origin/main merged in at 4b5024d, after #33637 landed), after a full turbo run build (119 tasks, exit 0), unless a line names 06589fe, the head before that merge. The merge changed none of this PR's 19 files and nothing in plugin-audit (P4b2's squash equals the P4b2 tip this branch already held); among the three touched packages it brought main's changes to four objectql files and two cli tests. Heavy runs went through scripts/pm/os-verify-lock.sh.

  • pnpm --filter @objectstack/plugin-audit test and typecheck: 95 files / 1560 tests passed; typecheck exit 0, tests included through check:test-typecheck.
  • pnpm --filter @objectstack/cli exec vitest run --project unit and typecheck: 421 files / 6008 tests passed; typecheck exit 0. The integration layer is CI's (Test Core).
  • pnpm --filter @objectstack/objectql exec vitest run and typecheck: 598 files / 13155 tests passed; typecheck exit 0.
  • dispatch-gates --commands at fbdc0b8: 78 derived (19 paths against merge base 4b5024d), all run; 77 exit 0, including check:cli-command-ids (the four os migrate audit-* ids in the seal-lock lines resolve) and check:logger-receiver-detach. 1 exits 3, PREREQUISITE NOT MET, so NOT MEASURED: check-plugin-teardown-shape --self-test (needs an unshallow clone). dispatch-gates --ran: "78 derived famil(ies) accounted for — 77 run, 1 NOT-MEASURED", exit 0. Outside the derived list: check-nul-bytes exit 0; eslint --no-inline-config on the 18 changed .ts files exit 0.
  • check:type-check-debt: exit 0.
  • Full dogfood battery (owed by the (narrowing) arm), pnpm --filter @objectstack/dogfood test under os-verify-lock: at fbdc0b8, Test Files 467 passed | 3 skipped (470), Tests 3959 passed | 42 skipped (4001), VERDICT command-exit 0 (29m16s), no failure. At 06589fe, before the merge: Test Files 467 passed | 3 skipped (470), Tests 3958 passed | 42 skipped (4000), VERDICT command-exit 0.
  • At 06589fe: direct dependents of @objectstack/objectql (it is touched), tests through turbo after a full build, all exit 0: client, cloud-connection, connector-mcp, driver-mongodb, driver-odata, organizations, plugin-approvals, plugin-auth, plugin-dev, plugin-email, plugin-pinyin-search, plugin-security, plugin-sharing, plugin-webhooks, http-conformance, scenarios, rest, runtime, the ten service-* packages that import it, trigger-record-change, verify and the four examples. Not re-run after the merge, which changed none of this PR's files; CI's Test Core runs them at the head.
  • At 06589fe, once, inside one lock hold (node scripts/ablation-replace.mjs): in trySealPassLocks, 'held' read as no lock. The anchor hit once and landed (blob f29b5b44 to e07c4727). audit-seal-lock.test.ts and audit-seal-sealer.test.ts went red on exactly the two skip pins, "a sealer pass skips while a run holds it" and "skips the pass while another session holds it", each expected 1 to be +0 (Tests 2 failed | 69 passed (71)). Restored: blob f29b5b44 equals HEAD, git diff HEAD empty, marker count 0. The tests import seal-lock.ts from source by a relative path, so no dist/ leg applies. The merge left seal-lock.ts and both test files as they were.
  • CI: all 51 check runs at fbdc0b8 completed: 35 success, 16 skipped by their selectors, 0 failure. The successes include TypeScript Type Check, Lint & Repo Gates, Check Changeset, Build Core, Governed Surface Queue Guard, Test Core (1/8 to 8/8 and the roll-up), Test UI, Live E2E UI and the PR-body guards. The Dogfood Regression Gate roll-up is success with its three shards skipped by the selector, so the local battery above is this PR's dogfood reading.

Generated by Claude Code

…, the keyset tie arm, and one opening per checkpoint per run

New pins, written before the fixes: a late checkpoint never lists a row
another sealer sealed since the pass read the window's lists (N1); the seed
of a checkpoint whose sequence another checkpoint holds is dropped (N2);
rows of one created_at straddling the page boundary are each read once
(S2 tie arm, N3); and one redaction run verifies each checkpoint and opens
each seed once, while still refusing every row a checkpoint that does not
verify, or whose seed does not open, lists.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…run; re-read a window's lists before a late checkpoint; drop a seed whose sequence another checkpoint holds

The redaction amendment writer verified every listed checkpoint, rebuilt its
root and opened its seed once per row (#32737). Each is now worked out once
per checkpoint per run and reused for every row it lists, the answer that
refuses included, so a checkpoint that does not verify, or whose seed does
not open, still refuses every row it lists.

The sealer re-read a chain's window head before a window insert only (S1).
A late checkpoint now re-reads the window's checkpoints once the chain head
is known and drops the rows already listed, so a row another sealer sealed
in between is not listed twice (N1). When a rejected insert reads back a
checkpoint at its sequence holding another seed, the seed it sealed can
never be stored and is dropped rather than left an orphan (N2).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…the package registers sys_audit_amendment too

The comment still called sys_audit_amendment the one name in the group the
package does not register; AuditPlugin registers and provisions it beside
the checkpoints and the signing keys. Comment only. Adds the changeset for
this slice.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…lt skips only its chain, sealed_through holds, verify stays loud

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…lt skips only its chain, each chain resumes from its own cursor, sealed_through holds at a skipped window

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…s crypto provider, never over an explicit one

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…s provider when the instance was composed with none

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…d AuditPlugin, real class only

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…Plugin composed with none

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…lation and the app AuditPlugin hand-over

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…n recovers into window checkpoints, never late ones

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
P4a merged into main as its own commit, so sealer.ts and
audit-seal-sealer.test.ts conflicted. Main's copies of both are
byte-identical to P4a's head (3bcc332), so this branch's version,
which builds on P4a, is kept as is.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…ng fault and the bounded idle re-walk (S7, review#3 S1)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…most 10,000 leaves, and bound the idle re-walk (S7, review#3 S1)

A chain's window seals into parts cut in D1 order, each with its own seed;
the signed body carries part_index and final_part. A pass that stopped
mid-window resumes it as further window parts. Late sealings split the same
way. The verifier faults a row id two checkpoints list. Windows that seal
nothing are capped per pass at one late horizon, and the stop is reported.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…ads as one final part, and the checkpoint part columns are nullable

Also regenerates the plugin-audit translation bundles for the two new
checkpoint columns, and adds the changeset.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…en the two reads, an emptied last part and its resume, removed parts, the pre-amendment S1 refusal, and re-sealing after the idle cap

The seal-store testkit now judges a where the way a SQL driver does: a
comparison with a NULL column is never true, where JavaScript's null >= 0 is
true, and { $null: true } is IS NULL. Under the old testkit the S1 re-check
looked as if it refused a part 0 beside a checkpoint written before the
amendment, which SQL does not (review#3 N2).

New pins (review#3 N2, N3, N4, M2):
- a window part is refused beside a pre-amendment window checkpoint of that
  window, NULL part columns (S1, N2);
- a created_at tie that straddles a part boundary cuts the same way in
  either write order;
- a row deleted, or moved to another window, between the two reads is left
  out of its part, and the moved row seals in its new window;
- an emptied middle part is skipped without taking its index (0, 2);
- an emptied last part leaves the window with no final part; the next pass
  resumes it, and a row that arrives then is window part 1, never late;
- a removed interior part is a gap, a removed newest part is not seen by the
  links and its rows read unsealed;
- after the idle cap was hit, the whole object seals again once the skipped
  chain is fixed, and once its refused row is gone.

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

# Conflicts:
#	packages/plugins/plugin-audit/src/audit-seal/audit-seal-sealer.test.ts
#	packages/plugins/plugin-audit/src/audit-seal/sealer.ts
…lds rows back, not a measured count of them

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
… and the S1 re-check refuses a part beside a pre-amendment checkpoint of its window

The idle cap (review#3 S1) counted every window that sealed nothing,
whether or not a chain was skipped. Once the skipped chain was fixed, or
had nothing left to seal, the windows the cap had left behind still
counted: the walk stopped short of the next window that seals something,
no checkpoint was written, and the floor never moved, so the object never
sealed past the cap again. It now counts only while a chain is skipped in
the pass; with none skipped the walk reaches the next window that seals
something and the floor moves past the rest.

The relaxed S1 re-check matched part_index >= n. On SQL a NULL part index
(a checkpoint written before the amendment) matches no comparison, so a
part 0 beside such a checkpoint of the same window was not refused. A
third arm matches it as NULL (review#3 N2).

The part_index and final_part docblocks say that the count may skip an
emptied part, that a window whose last part emptied has no final part,
and what the links do and do not show of a removed part (review#3 N4, M2).

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
…KING banner and its ADR-0087 disposition, and states the one-way upgrade

review#3 M1: listed_twice refuses a chain the released 18.4.0 sealer could
write when two late sealings overlapped and the 18.4.0 verifier accepted,
so the arm is (narrowing). Metadata-protocol stays none, so the level stays
patch. The disposition is not-required (no-migration-prescription): nothing
stored is rewritten and no tolerance or repair ships.

review#3 M2: what verify's links show of a removed part, interior and
newest. N1: the one-way upgrade note. The skipped-chain paragraph states
the idle cap as it now counts, only while a chain is skipped.

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
…aler, the --apply hold and B (ADR-0154 D3 amended)

Red before the fix. Seat ruling 6885005594 (E + B): each sealer pass
try-locks a database session lock on the sealed object's hot store and skips
while another session holds it; an os migrate audit-* --apply run holds it
for the whole run, waits, then refuses; where the database offers no session
lock, an --apply run on a sealed object is refused without --sealer-stopped.
The objectql pins hold the named-lock primitive both locks ride on. The
seal-lock module is a constants-only stub here.

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/cli, @objectstack/objectql, @objectstack/plugin-audit, touching 64 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/objectql/src/index.ts, packages/plugins/plugin-audit/src/audit-seal/index.ts, packages/plugins/plugin-audit/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/api/error-handling-client.mdx (via waitMs (symbol, a field of interface AuditSealLockHoldOptions; a field of interface DatabaseSessionLockWait))
  • content/docs/deployment/cli.mdx (via os migrate audit-key-material (command, read off packages/cli/src/commands/migrate/audit-key-material.ts), os migrate audit-mail-bodies (command, read off packages/cli/src/commands/migrate/audit-mail-bodies.ts), os migrate audit-metadata-bodies (command, read off packages/cli/src/commands/migrate/audit-metadata-bodies.ts), os migrate audit-side-copies (command, read off packages/cli/src/commands/migrate/audit-side-copies.ts))
  • content/docs/kernel/cluster.mdx (via waitMs (symbol, a field of interface AuditSealLockHoldOptions; a field of interface DatabaseSessionLockWait))
  • content/docs/upgrading.mdx (via os migrate audit-key-material (command, read off packages/cli/src/commands/migrate/audit-key-material.ts), os migrate audit-side-copies (command, read off packages/cli/src/commands/migrate/audit-side-copies.ts))

⛔ 4 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-6.mdx (via os migrate audit-metadata-bodies (command, read off packages/cli/src/commands/migrate/audit-metadata-bodies.ts))
  • content/docs/releases/v17/17-7.mdx (via os migrate audit-metadata-bodies (command, read off packages/cli/src/commands/migrate/audit-metadata-bodies.ts))
  • content/docs/releases/v18/18-3.mdx (via os migrate audit-key-material (command, read off packages/cli/src/commands/migrate/audit-key-material.ts))
  • content/docs/releases/v18/18-5.mdx (via os migrate audit-side-copies (command, read off packages/cli/src/commands/migrate/audit-side-copies.ts))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/objectql/src/index.ts, packages/plugins/plugin-audit/src/audit-seal/index.ts, packages/plugins/plugin-audit/src/index.ts) — pages documenting those are invisible to this run
  • 26 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 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; 123 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 — 58 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 63e47feeca6350f72e77bb05d5475a9a76ac8728 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 63e47feeca6350f72e77bb05d5475a9a76ac8728

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

…the audit seal lock, with --sealer-stopped (ADR-0154 D3 amended)

Red before the fix: the three commands neither declare --sealer-stopped nor
hold the lock, and none exits non-zero on a lost lock yet.

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
…te audit-* --apply run, and skip a sealer pass while it is held

ADR-0154 D3 as amended, seat ruling 6885005594 options E + B.

- objectql: one named database session lock (Postgres advisory lock,
  MySQL GET_LOCK, on a connection outside the pool) in
  database-session-lock.ts, with a try-once form and a session probe;
  the schema-migration lock now rides on it with the same statements,
  lines and refusal.
- plugin-audit: the audit seal lock 'objectstack:audit-seal' on each
  sealed object's hot store. Each sealer pass try-locks it beside
  audit.sealer and skips while another session holds it; a checkpoint is
  written only while both locks still stand. holdAuditSealLock holds it
  for a rewrite run, waits up to ten minutes, then refuses; where the
  database offers no session lock, a run on a sealed object is refused
  unless the operator passes --sealer-stopped.
- cli: os migrate audit-key-material, audit-mail-bodies and
  audit-metadata-bodies run every --apply rewrite inside one hold, take
  --sealer-stopped, and exit non-zero when the lock was lost mid-run.

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
… check:logger-receiver-detach stays green

The three os migrate audit rewrites handed logger.warn on bare in the
options bag of underAuditSealLock, which check:logger-receiver-detach reds
(a receiver-sensitive logger would throw on that channel). Each now passes
a callback that calls logger.warn(line); the contract test's pin on the
hold's options bag follows.

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
The base branch moved to 5ef334e (P4b2 round 2, its merge of origin/main
at 412fbf7, and its docs and changeset commits). That merge brings in
os migrate audit-side-copies, the fourth ledger-copy rewrite, which the
contract test now lists. Three files changed on both sides and merged
without conflict: the CLI contract test, audit-seal-sealer.test.ts and the
plugin-audit barrel.

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
…oss an --apply run and takes --sealer-stopped, as its three twins do

The merged base brings os migrate audit-side-copies, the fourth ledger-copy
rewrite of the os migrate audit- family. ADR-0154 D3 as amended (seat
ruling 6885005594, E + B) holds the lock for every rewrite of that family,
so this one now runs its hot and archive rewrites inside one
underAuditSealLock hold on the copy tables it rewrites (--object narrows
them), declares --sealer-stopped, and exits non-zero when the lock's
session ended mid-run. The contract test lists its objects; the seal-lock
lines name all four commands; the changeset says the command is new in this
release and ships with the hold.

Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
Co-authored-by: Claude <noreply@anthropic.com>
Base automatically changed from claude/area-A2-31908-p4b2 to main November 15, 2026 11:50
#33637 (P4b2) landed on main as ac0b9a5 and this PR's base is now main.
Two conflicts, both from P4b2 reaching main as one squash commit while this
branch carries its commits: the P4b2 changeset takes main's side (main's
copy is the P4b2 tip's, 55dfebc), and audit-seal-sealer.test.ts takes this
branch's side (main's copy equals the merged base 5ef334e, so this
branch's file is that plus the P4b3 describe). sealer.ts and
seal-store.testkit.ts auto-merged to this branch's side.

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

Copy link
Copy Markdown
Contributor Author

review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH

Contract-review-claim: session_016WV4cy7hQ5MvQ83ByNZ8ZH · head fbdc0b8 · 2026-11-15T12:54:24Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-elon-musk · session_016WV4cy7hQ5MvQ83ByNZ8ZH

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: fbdc0b8e7e5cc8c7ee61c2609d9ea696c098931b
Local-runs: none
Scope: packages/cli/src/commands/migrate/audit-key-material.ts, packages/cli/src/commands/migrate/audit-mail-bodies.ts, packages/cli/src/commands/migrate/audit-metadata-bodies.ts, packages/cli/src/commands/migrate/audit-side-copies.ts, packages/cli/src/commands/migrate/audit-redaction-seal.contract.test.ts, packages/cli/src/utils/audit-seal-lock.ts, packages/objectql/src/database-session-lock.ts, packages/objectql/src/database-session-lock.test.ts, packages/objectql/src/index.ts, packages/objectql/src/schema-migration-lock.ts, packages/plugins/plugin-audit/src/audit-seal/seal-lock.ts, packages/plugins/plugin-audit/src/audit-seal/audit-seal-lock.test.ts, packages/plugins/plugin-audit/src/audit-seal/sealer.ts, packages/plugins/plugin-audit/src/audit-seal/audit-seal-sealer.test.ts, packages/plugins/plugin-audit/src/audit-seal/seal-store.testkit.ts, packages/plugins/plugin-audit/src/audit-seal/index.ts, packages/plugins/plugin-audit/src/index.ts, packages/plugins/plugin-audit/src/stored-metadata-body-migration.ts + docs/adr/0154 (D3 as amended, read only), packages/objectql/src/engine.ts (getDriverForObject, read only), packages/plugins/plugin-audit/src/mail-log-body-migration.ts and key-material-copy-migration.ts (the rewritten object lists, read only)

First contract review of PR #33675 (slice P4b3 of card #31908), a full review on the narrowing face, over every path of the diff outside the prose faces. Read: the diff per file against merge base 4b5024de, the PR body and its comments (dev report 6890613381), the card's seat ruling 6885005594 (E + B), and ADR-0154 D3 as amended on main by #33489. The PR is a draft; both PRs it names as blocking (#33489, #33637) are merged and the diff against main is this slice alone. The changeset was read for agreement with the code and is the lane seat's to accept.

① Derived judgments

  • The extraction is faithful. acquireSchemaMigrationLock now calls acquireDatabaseSessionLock with its own name, wait, wait line and refusal; the statements, their order, the bindings, the 55P03 reading, the MySQL seconds rounding, the dialect read before getKnex() and the close on every failure are the ones removed from schema-migration-lock.ts, and SCHEMA_MIGRATION_PG_LOCK_KEY derives through the same expression. Nothing an existing caller sees moves.
  • E as ruled, for one database per deployment. The sealer takes audit.sealer, then try-locks objectstack:audit-seal on each sealed object's hot store, lets go of both and writes nothing when another session holds it, and checks both locks before each checkpoint write. An --apply run of each of the four rewrites takes the lock before its first write, hot and archive runs inside the hold, and lets it go after its last; a dry run takes none.
  • Both sides agree on where and on what. Each reads lifecycle.seal off the engine registry and locks on engine.getDriverForObject(object), so the two always meet on the same database for the same object; archive rows are covered because both sides lock on the hot store. The hold reads a superset of the sealer's plans (an object that declares the seal but cannot be sealed is still locked for), which errs on the safe side.
  • The object lists handed to the hold are the lists the rewrites walk: KEY_MATERIAL_COPY_TABLES, MAIL_LOG_BODY_COPY_OBJECTS, the --object selection of the side-copies run, and STORED_METADATA_BODY_REWRITTEN_OBJECTS, which the metadata-bodies run now builds its table list from.
  • B as ruled. A dialect other than Postgres or MySQL, a driver with no Knex and an object with no driver all answer no lock; the run is then refused before rewrite starts unless --sealer-stopped, and with the flag it says on whose word it runs. A failure to take the lock on a database that offers one is handed on, never read as no lock (pinned). The red line holds on every path read.
  • The ruling's two pins are present: the lock on the hot store and not the primary, for the hold and for the sealer; the wait at ten minutes with a staged sealer pass waited out under the default.
  • A lost session is reported: finish() probes each lock before releasing it, and each command prints the line and exits non-zero, in JSON mode as sealLockLost.
  • Not as the PR claims: "one lock per database" is one lock per driver object. See M1.

② Semver level

  • Declared pair: Clause-②: yes (narrowing) and Metadata-protocol: none, on the PR body and the changeset. Both hold: no schema key, accepted value or metadata type moves; a command run that 18.4.0 performed is now refused in two stated cases, and a flag and exports are added.
  • Level: with Metadata-protocol: none, patch on @objectstack/plugin-audit, @objectstack/objectql and @objectstack/cli is the level the kind takes. The title carries the !, and the changeset carries the BREAKING paragraph with the one-line fix for each refused case.
  • ADR-0087: one marker, not-required (no-migration-prescription), and its reason matches the diff: nothing stored changes shape.
  • New published names match the barrels: objectql acquireDatabaseSessionLock, tryDatabaseSessionLock, databaseSessionLockPgKey and two types; plugin-audit holdAuditSealLock, AUDIT_SEAL_LOCK_NAME, AUDIT_SEAL_LOCK_WAIT_MS, STORED_METADATA_BODY_REWRITTEN_OBJECTS and three types. The changeset names all of them; the PR body does not (N1).

③ Boundary flags

  • PR user.login is objectstack-fleet[bot]: written through the relay.
  • Independence: exception — same account (os-elon-musk) implemented this PR; the maintainer ruled 2026-11-15T12:51Z (project thread) that review#1 reviews this account's own drain PRs.
  • No new id materialisation or in-app join. The lock adds one dedicated connection per database for the length of each sealer pass and each --apply run, outside the pool; a database at its connection limit now fails the pass (closed, and reported) where it sealed before.
  • No security boundary is moved.
  • CI: every check-run on this head has completed, none red (success or skipped). Readings the dev report lists as not run (the ablation, the full dogfood battery owed by the !) are the lane seat's to clear; this record does not stand in for them.
  • Prose face, for the lane seat: content/docs/deployment/cli.mdx documents the four commands and does not mention --sealer-stopped.
  • Tier evidence. verify-review-tier.mjs on this reviewer's own transcript passes: every turn served at the tier named above.

④ Design judgment

The narrowing itself holds against ADR-0154 D3 as amended: it takes away only the run the ADR now refuses, at the commands the ADR names, and makes the red line real where no lock exists. It fails in one supported topology:

  • M1 (must-fix) — the lock excludes this process from itself when two sealed objects route to two datasources on one lock namespace. byDriver in seal-lock.ts groups by driver object and opens one session per driver. A MySQL GET_LOCK name is server-wide and a Postgres advisory lock is database-wide, so two datasources on one MySQL server (two schemas, the usual way to split an audit store), or two datasources on one Postgres database, share the lock while holding two sessions. Then trySealPassLocks takes the lock on the first driver and reads held on the second: every pass is skipped, for good, at info once an hour, with a line that blames a migration run or another server. And holdAuditSealLock takes the first and waits ten minutes on its own session for the second, then refuses; on these dialects --sealer-stopped does not let the run through. sys_audit_log and sys_activity, the two objects three of the rewrites walk, are exactly the pair an app can seal and route apart. Before this PR that deployment sealed; after it, sealing stops without an error. The PR body notes the server-wide name only across deployments. A fix has to tell "held by a session of this run" from "held by another": for example ask the holder (pg_locks against the pids of the sessions this call opened; IS_USED_LOCK against their connection ids) before reading a second answer as contention, with a pin on two drivers over one sessionLockDatabase.
  • N1 (nit) — the PR body's Clause-② line names three commands and omits STORED_METADATA_BODY_REWRITTEN_OBJECTS and the type names; the changeset is complete. The body is the seat's to amend.
  • N2 (nit) — in a run over two databases, the B refusal for the lockless one is thrown only after the wait on the other has ended, up to ten minutes later. Checking for the lockless objects first costs nothing.
  • N3 (nit) — isHeld() runs select 1 with no timeout; on a half-open connection the probe, and with it the pass or finish(), waits on the transport.

Implemented-by: session_016WV4cyNkH7W7e89m6j4aQq
Reviewed-by: session_016WV4cy7hQ5MvQ83ByNZ8ZH

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cyNkH7W7e89m6j4aQq
os-dev-report

Area A2, slice P4b3 of #31908: review requested from the review-lane seat (mailbox #33813) at head fbdc0b8e7e5cc8c7ee61c2609d9ea696c098931b (base main, CI green: 51 check runs, 35 success, 16 skipped, 0 failure). The pilot review#3 seat is closed, so this request goes to the review lane.

Prior review record. review#3 recorded no verdict on P4b3: #33675 has no review and no review comment, and #31908 carries none for this slice; the slice was a draft on the P4b2 branch with red CI until this round. For context, P4b2 (#33637), whose landing this branch now carries from main (ac0b9a5): review#3 FAIL 6888713592 at 0dd58a8, FAIL 6891899947 at b234eee (M1, the Skills-docs: line), then PASS 6892892992 at 55dfebc. None of the three names a P4b3 item.

Ruling items covered (seat ruling 6885005594, options E + B; ADR-0154 D3 as amended in #33489):

  • E, the lock: objectstack:audit-seal, a Postgres advisory lock or a MySQL GET_LOCK on a connection outside the pool. It is taken on each sealed object's hot store, not the primary. Code: packages/objectql/src/database-session-lock.ts, packages/plugins/plugin-audit/src/audit-seal/seal-lock.ts.
  • E, the sealer: every pass try-locks it beside audit.sealer. While another session holds it, the pass skips and says so at info once an hour. Both locks are checked before each checkpoint write. Ablated this round: reading 'held' as no lock turns exactly the two skip pins red.
  • E, the migrations: os migrate audit-key-material, audit-mail-bodies, audit-metadata-bodies and now audit-side-copies hold it with --apply for the whole run, hot and archive. A run waits up to ten minutes, then refuses having changed nothing. A lost session is reported and the run exits non-zero.
  • B: where the database offers no session lock (SQLite, Turso, the rest), an --apply run on a sealed object is refused unless the operator passes --sealer-stopped. With the flag it goes ahead and prints one line saying so.
  • Item 6: the wait is ten minutes and pinned, and the staged test waits out a real sealer pass with the default wait.
  • Red line: no path takes a lock that excludes nothing and proceeds silently. It refuses, or it goes ahead on the flag and says so.

This round (since d741b9e): 748f0d9 (the lines name the four commands, check:cli-command-ids), 6acfe29 (check:logger-receiver-detach), ebcb2de (base merge at 5ef334e), 06589fe (os migrate audit-side-copies gets the hold, the flag and the lost-lock exit; the contract test lists its objects; the changeset says it is new in this release), fbdc0b8 (origin/main merged through os-regen-merge.sh after #33637 landed). The diff against main is P4b3 alone, 19 files. The commit list still shows P4b1 and P4b2 commits, because those landed as squash commits; per the order there is no rebase.

For the seat: the PR body is not PATCHed here. The agent file allows a dev to write the body only at pr_create, and the conflict with the order is in open_questions. The proposed body is in the area's report folder. It brings the widened list (with STORED_METADATA_BODY_REWRITTEN_OBJECTS), the side-copies paragraph, the Skills-docs: line the (narrowing) arm owes, and the readings under Verification. Blocked-by: is unchanged.

Readings

Local runs are at head fbdc0b8 (origin/main merged in at 4b5024d, after #33637 landed), after a full turbo run build (119 tasks, exit 0), unless a line names 06589fe, the head before that merge. The merge changed none of this PR's 19 files and nothing in plugin-audit (P4b2's squash equals the P4b2 tip this branch already held); among the three touched packages it brought main's changes to four objectql files and two cli tests. Heavy runs went through scripts/pm/os-verify-lock.sh.

  • pnpm --filter @objectstack/plugin-audit test and typecheck: 95 files / 1560 tests passed; typecheck exit 0, tests included through check:test-typecheck.
  • pnpm --filter @objectstack/cli exec vitest run --project unit and typecheck: 421 files / 6008 tests passed; typecheck exit 0. The integration layer is CI's (Test Core).
  • pnpm --filter @objectstack/objectql exec vitest run and typecheck: 598 files / 13155 tests passed; typecheck exit 0.
  • dispatch-gates --commands at fbdc0b8: 78 derived (19 paths against merge base 4b5024d), all run; 77 exit 0, including check:cli-command-ids (the four os migrate audit-* ids in the seal-lock lines resolve) and check:logger-receiver-detach. 1 exits 3, PREREQUISITE NOT MET, so NOT MEASURED: check-plugin-teardown-shape --self-test (needs an unshallow clone). dispatch-gates --ran: "78 derived famil(ies) accounted for — 77 run, 1 NOT-MEASURED", exit 0. Outside the derived list: check-nul-bytes exit 0; eslint --no-inline-config on the 18 changed .ts files exit 0.
  • check:type-check-debt: exit 0.
  • Full dogfood battery (owed by the (narrowing) arm), pnpm --filter @objectstack/dogfood test under os-verify-lock: at fbdc0b8, Test Files 467 passed | 3 skipped (470), Tests 3959 passed | 42 skipped (4001), VERDICT command-exit 0 (29m16s), no failure. At 06589fe, before the merge: Test Files 467 passed | 3 skipped (470), Tests 3958 passed | 42 skipped (4000), VERDICT command-exit 0.
  • At 06589fe: direct dependents of @objectstack/objectql (it is touched), tests through turbo after a full build, all exit 0: client, cloud-connection, connector-mcp, driver-mongodb, driver-odata, organizations, plugin-approvals, plugin-auth, plugin-dev, plugin-email, plugin-pinyin-search, plugin-security, plugin-sharing, plugin-webhooks, http-conformance, scenarios, rest, runtime, the ten service-* packages that import it, trigger-record-change, verify and the four examples. Not re-run after the merge, which changed none of this PR's files; CI's Test Core runs them at the head.
  • At 06589fe, once, inside one lock hold (node scripts/ablation-replace.mjs): in trySealPassLocks, 'held' read as no lock. The anchor hit once and landed (blob f29b5b44 to e07c4727). audit-seal-lock.test.ts and audit-seal-sealer.test.ts went red on exactly the two skip pins, "a sealer pass skips while a run holds it" and "skips the pass while another session holds it", each expected 1 to be +0 (Tests 2 failed | 69 passed (71)). Restored: blob f29b5b44 equals HEAD, git diff HEAD empty, marker count 0. The tests import seal-lock.ts from source by a relative path, so no dist/ leg applies. The merge left seal-lock.ts and both test files as they were.
  • CI: all 51 check runs at fbdc0b8 completed: 35 success, 16 skipped by their selectors, 0 failure. The successes include TypeScript Type Check, Lint & Repo Gates, Check Changeset, Build Core, Governed Surface Queue Guard, Test Core (1/8 to 8/8 and the roll-up), Test UI, Live E2E UI and the PR-body guards. The Dogfood Regression Gate roll-up is success with its three shards skipped by the selector, so the local battery above is this PR's dogfood reading.
{
  "issue": 31908,
  "status": "done",
  "branch": "claude/area-A2-31908-p4b3",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/33675",
  "session": "session_016WV4cyNkH7W7e89m6j4aQq",
  "premise_still_valid": true,
  "summary": "P4b3 resumed from d741b9e9a and finished at fbdc0b8e7. The three red gate sites are fixed: 748f0d936 makes the seal-lock wait and refusal lines and the sealer's skip line name the four os migrate audit-* commands in full through one constant (AUDIT_SEAL_LOCK_REWRITE_COMMANDS), so check:cli-command-ids holds each one to a real command; 6acfe29cd passes the hold a callback that calls logger.warn(line), for check:logger-receiver-detach. Merging the base at 5ef334ece (ebcb2dec4) brought os migrate audit-side-copies (#33607, unreleased), on which the contract test went red in CI Test Core 1/8. ADR-0154 D3 as amended holds the lock for every os migrate audit-* --apply run, so 06589fe07 gives that command the same hold on the copy tables it rewrites, plus --sealer-stopped and the non-zero exit on a lost lock. After #33637 landed and the base became main, origin/main was merged in through os-regen-merge.sh (fbdc0b8e7). The two conflicts both came from P4b2 landing as one squash commit, and each was resolved to the P4b2 tip's content. No generated path moved, and the PR diff against main is P4b3 alone: 19 files, +1398/-157. The PR body is not PATCHed (see open_questions). The proposed body, with the readings, the widened list and the Skills-docs line, is a file for the seat to write.",
  "tests": "At fbdc0b8e7 (origin/main merged in), after a full turbo build (Tasks 119 successful, 119 total; exit 0), each under os-verify-lock: `pnpm --filter @objectstack/plugin-audit test` 95 files / 1560 tests passed, typecheck exit 0 (test layer through check:test-typecheck OK); `pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2` 421 / 6008 passed, typecheck exit 0 (integration layer declared to CI); `pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2` 598 / 13155 passed, typecheck exit 0. At 06589fe07 (before the merge, the same P4b3 files): the same three (1560 / 6003 / 13129), and the direct dependents of objectql through turbo, all exit 0: client 812, cloud-connection 1217, connector-mcp 119, driver-mongodb 771 + 202 skipped, driver-odata 1441, organizations 252, plugin-approvals 1652, plugin-auth 5465 + 10 skipped, plugin-dev 89, plugin-email 1018, plugin-pinyin-search 39, plugin-security 6681 + 45 skipped, plugin-sharing 1511, plugin-webhooks 307, http-conformance 292, scenarios 782, rest 8442 + 332 skipped, runtime 10849 + 19 skipped, service-package 144, service-settings 1464, service-messaging 966, service-knowledge 49, service-queue 91, service-storage 1651 + 1 skipped, service-datasource 1317, service-analytics 5216 + 335 skipped, service-mailbox 152, service-automation 3976, trigger-record-change 122, verify 437, example-embed-objectql 2, example-todo 249, example-crm 51, example-showcase 545. They were not re-run after the merge, which touched none of the PR's 19 files; CI Test Core is green at fbdc0b8e7. Ablation, once, at 06589fe07, inside one lock hold with scripts/ablation-replace.mjs: in trySealPassLocks, 'held' read as no lock. The anchor hit once and landed (blob f29b5b44 to e07c4727). audit-seal-lock.test.ts and audit-seal-sealer.test.ts gave 'Tests 2 failed | 69 passed (71)': exactly the two skip pins, 'a sealer pass skips while a run holds it, and seals once the run has finished' and 'skips the pass while another session holds it ...', each 'AssertionError: expected 1 to be +0'. Restored: blob f29b5b44 equals HEAD, git diff HEAD empty, marker count 0. The tests import seal-lock.ts from src by a relative path, so there is no dist leg. The merge left seal-lock.ts and both test files unchanged. A first attempt exited 99 (queue-timeout) before running; it was restored (blob equals HEAD) and redone inside one hold.",
  "gates": "Local, at fbdc0b8e7. `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands`: 19 paths against merge base 4b5024de5, no STALE TREE warning, 78 derived, all run. 77 exit 0, including 'pnpm check:cli-command-ids :: exit 0' and 'pnpm check:logger-receiver-detach :: exit 0'. 1 exit 3, NOT MEASURED: 'node scripts/check-plugin-teardown-shape.mjs --self-test' (PREREQUISITE NOT MET: needs an unshallow clone). `--ran`: 'dispatch-gates --ran: 78 derived famil(ies) accounted for — 77 run, 1 NOT-MEASURED', exit 0. Outside the derived list: check-nul-bytes exit 0 ('OK (scanned 25591 text file(s) ...)'); eslint --no-inline-config on the 18 changed .ts files exit 0; control-byte grep on the changed files, no match; pnpm check:type-check-debt exit 0 under the lock. os-regen-merge.sh: two hand-resolved conflicts, then the rerun's step 2 took nothing and step 3 left no change; the branch touches no os-regen path, so there is no regen step. At 06589fe07: 109 derived, 108 exit 0, the same 1 NOT MEASURED, --ran exit 0. test:repo is not run locally (CI's Test Core). CI at fbdc0b8e7, all 51 check runs completed. 35 success: TypeScript Type Check, Lint & Repo Gates, Lint · ESLint, Lint · CI, release & engine gates, Lint · docs & code guards, Lint · repo & tooling gates, Lint · PM dispatch-gates, the three Lint · scoped lanes, Type Check · workspace / source gates / consumer gates / debt ledger, Check Changeset, Check PR Size, Build Core, Plan Test Core shards, Test Core 1/8 to 8/8 and the Test Core roll-up, Test UI, Live E2E UI, Dogfood Regression Gate (roll-up; its shards were skipped), Governed Surface Queue Guard, PR-body guards, Flag docs affected by code changes, Auto Label, filter. 16 skipped by their selectors: the UI lanes, Build Docs, Temporal Conformance, the dogfood shards and Verify CLI, the queue verdicts, the schedule gate and the opt-in harnesses. 0 failure.",
  "dogfood_battery": "fbdc0b8e7 · os-verify-lock: VERDICT command-exit 0 · held the lock 1756s (29m16s) · Test Files 467 passed | 3 skipped (470) · Tests 3959 passed | 42 skipped (4001) · no failure. Before the merge, at 06589fe07: VERDICT command-exit 0 · Test Files 467 passed | 3 skipped (470) · Tests 3958 passed | 42 skipped (4000).",
  "mcp_calls": "13 — GitHub MCP reads only: pull_request_read get x6, get_check_runs x3, get_status x2, get_reviews x1; get_job_logs x1. No write tool.",
  "api_writes": "1 — POST repos/objectstack-ai/objectstack/issues/33675/comments, this report together with the review request, through scripts/pm/post-stamped.mjs. Not REST: 4 fast-forward git pushes to claude/area-A2-31908-p4b3 (748f0d936, 6acfe29cd, 06589fe07 with ebcb2dec4, fbdc0b8e7). Reads: gh api GETs for comments, check runs and one search.",
  "open_questions": [
    {
      "question": "The order lets this dev PATCH the PR body through fleet-write, keeping the first two attribution lines and a signed trailer. os-dev.md says the dev writes the PR body only at pr_create, never with a PATCH, and the seat writes changes through seat-post-protocol.md. It also bans HTML comments in dev-written text, and the signed trailer is one (the live body carries none). Under its own rule that the agent file wins a conflict, this run did not PATCH. Who writes the body?",
      "options": [
        "A: the seat writes the proposed body (31908-p4b3-pr-body-proposed.md beside the report) through seat-post-protocol.md, adding its signed trailer itself.",
        "B: the order is re-issued once the agent file allows a dev PATCH, and a dev then writes it."
      ],
      "recommendation": "A, because the agent file names the seat as the body writer after pr_create, and the proposed body is ready to paste. It changes only the lines listed in the proposed file, so the attribution lines stay byte for byte."
    },
    {
      "question": "The (narrowing) arm owes the PR body a Skills-docs line, and the live body has none, so the review checklist reads it as REWORK. The proposed body adds: Skills-docs: none, because skills/** teaches declaring lifecycle.seal and no line there names an os migrate audit-* command, its flags or the sealer's locks; the stale sealing lines in skills/objectstack-data/rules/lifecycle.md are follow-up #33773's. Should the line also go into the P4b3 changeset, as P4b2 did?",
      "options": [
        "A: PR body only, as the claim template places it.",
        "B: also a changeset line, which takes one more commit and a re-run of the ratchet families on the new head."
      ],
      "recommendation": "A, because the template puts the line in the PR body and Check Changeset is green without it."
    }
  ],
  "security_findings": "none",
  "out_of_scope_findings": [
    "carrier: #33773 · skills/objectstack-data/rules/lifecycle.md § Sealing still says one checkpoint per hour and no verifier; already filed from P4b2 · noted, not filed"
  ],
  "review_request": {
    "addressed_to": "review-lane seat (mailbox #33813); the pilot review#3 seat is closed",
    "head": "fbdc0b8e7e5cc8c7ee61c2609d9ea696c098931b",
    "comment": "this comment",
    "ruling_items": "seat ruling 6885005594 E (lock, sealer skip, --apply hold, wait then refuse, lost-session exit) and B (--sealer-stopped), item 6 (ten-minute wait pinned), the red line; ADR-0154 D3 as amended (#33489); the audit-side-copies extension; the cli-command-ids and logger-receiver-detach fixes",
    "prior_review_record": "review#3 recorded no verdict on P4b3: #33675 has no review and no review comment, and #31908 carries none for this slice; the slice was a draft on the P4b2 branch with red CI until this round. For context, P4b2 (#33637), whose landing this branch now carries from `main` (ac0b9a5f9): review#3 FAIL 6888713592 at 0dd58a80e, FAIL 6891899947 at b234eee59 (M1, the `Skills-docs:` line), then PASS 6892892992 at 55dfebcfc. None of the three names a P4b3 item."
  },
  "deviations": [
    "Scratchpad: my first command wrote base.txt to the shared scratchpad root, which may have overwritten another agent's file of that name; I removed it. Scratch files first went to the shared issue-31908/ dir, where run-gates.sh overwrote an older script of the same name from an earlier agent. Everything then moved to the unique subdir issue-31908/p4b3-resume-ab4ace/.",
    "The PR body was not PATCHed, although the order allowed it. os-dev.md forbids a dev PATCH and dev-written HTML comments (the signed trailer is one), and that file wins a conflict. The proposed body is delivered as a file instead (open_questions 1).",
    "The review request is folded into the one os-dev-report comment, which keeps to the budget of one report comment. Per the coordinator's mid-run change it is addressed to the review-lane seat (mailbox #33813), not review#3. No thread or mailbox was messaged.",
    "The base merge ebcb2dec4 was a plain git merge of claude/area-A2-31908-p4b2 at 5ef334ece: the base had not been retargeted, and os-regen-merge.sh hardcodes origin/main. After #33637 landed and the base became main, origin/main was merged through os-regen-merge.sh (fbdc0b8e7). Conflicts: the P4b2 changeset took main's side and audit-seal-sealer.test.ts took the branch side, each byte-equal to the P4b2 tip's content plus P4b3.",
    "Narrowed: the objectql dependents' tests and the ablation were not repeated after the main merge, because the merge touched none of the PR's 19 files and nothing in plugin-audit. CI Test Core is green at the head.",
    "Read-only gh api GETs were used for comments, check runs and one search. The #33637 merge-state check used the GitHub MCP, as ordered. There was no gh write.",
    "The harness reminder's model-named Co-Authored-By trailer was not used. Commits carry the model-free Claude-Session and Co-authored-by pair (os-dev.md).",
    "The PR body's maintainer quick read stays in English, as the order requires; os-dev.md asks for a Chinese one. This is a pre-existing section, left unchanged.",
    "check-plugin-teardown-shape --self-test is NOT MEASURED here (shallow clone), as at every earlier head of this card.",
    "#33675's commit list still shows the P4b1 and P4b2 commits, because those landed on main as squash commits. There was no rebase or force-push, per the order. The diff against main is P4b3 alone: 19 files, +1398/-157.",
    "The worktree and its node_modules are kept: the worktree is harness-managed and holds the branch for a patch round. No background job of this run is left: both chain scripts exited."
  ]
}

…base once and never waits on itself

Two datasources can reach one lock namespace: one Postgres database, or two
schemas of one MySQL server, whose GET_LOCK names are server-wide. The audit
seal lock opened one session per driver, so the second session found the lock
held by the first: every sealer pass skipped for good, and an --apply run
waited ten minutes on itself and refused.

A lock taken with `ownLocks` now marks its session with a lock under a name no
other session knows, taken before the named lock. A later session of the same
run that finds the named lock held asks the database whether the session
holding it there is the marked one (pg_locks in the current database; on
MySQL, IS_USED_LOCK of the marker against the name), and if so answers that
lock. A holder it cannot prove its own stays contention, as before.

holdAuditSealLock now tries every database once before any wait, so a
database that offers no session lock is refused before a wait on another.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head 972c3ec · 2026-11-15T14:00Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cyNkH7W7e89m6j4aQq
os-dev-report

Area A2, slice P4b3 of #31908: fix round 1 on the review FAIL in comment 6894679963. Stamped 2026-11-15T14:28Z.

Delta review request, to review#2 (os-tesla, mailbox PR 33873). Please run a delta review of this PR.

  • New head: 972c3ec2625d60e2ef17c62ba11e09a813502d2a.
  • Prior verdict: FAIL, record 6894679963 at fbdc0b8e7e5cc8c7ee61c2609d9ea696c098931b.
  • Delta range: fbdc0b8e..972c3ec2, one commit, a fast-forward push with no rebase and no force-push.

M1 (must-fix): fixed. Two datasources on one Postgres database, or on two schemas of one MySQL server, no longer make a run or a sealer pass contend with itself.

  • packages/objectql/src/database-session-lock.ts adds the option ownLocks (type DatabaseSessionLockRunOptions). Before taking the named lock, a session opened with it takes a marker lock under a random name.
  • A later session of the same run may find the named lock held. It then asks the database whether the session holding that lock in this namespace is the one holding the marker. On Postgres it reads pg_locks, joined on pid and scoped to current_database(). On MySQL it compares IS_USED_LOCK(marker) with IS_USED_LOCK(name).
  • If it is, the new session is closed and the run's existing lock is answered, with no wait and no line. Session ids are never compared across servers.
  • A holder the run cannot prove is its own is still contention: it is waited for and refused, as before. On a MySQL older than 5.7.5 the marker is dropped when the named lock is taken, so such a run fails closed.
  • Without ownLocks nothing changes, so the schema-migration lock runs the same statements as before.
  • packages/plugins/plugin-audit/src/audit-seal/seal-lock.ts: holdAuditSealLock and trySealPassLocks take each lock with the run's earlier locks as ownLocks (LockCover). One lock can therefore cover several datasources. It is released once, and a lost lock is reported for every object it covered.

N2: fixed. Before any wait, the hold tries every database once. A sealed object on a database that offers no session lock is now refused before the run waits on another database.

N1: not mine to apply. The PR body is the seat's to amend, and the dev does not PATCH it. The proposed replacement lines are in the area orders folder as 31908-p4b3-r1fix-pr-body-lines.md. They cover the Clause-② line, made word for word the same as the changeset, plus the "Where it is taken" bullet, the Tests bullets and the MySQL acceptance note.

N3: not changed (nit). Bounding isHeld() alone does not bound finish(): release() and destroyRawConnection wait on the same half-open transport. A real fix bounds all three, which is outside M1. It is left to the seat to decide whether it becomes a card.

Changeset amended. The Clause-② export list gains DatabaseSessionLockRunOptions. The audit-seal-lock section gains one bullet: a shared lock namespace is locked once. The objectql paragraph gains one sentence on ownLocks. The kind is unchanged, and no other line moved.

Tests and readings. All runs were on tree 1500c9e67. Head 972c3ec26 has the same tree; only the commit trailer was reworded for check:commit-card-trailers.

  • New pins in audit-seal-lock.test.ts, each with two datasources on one fake database:
    • the hold on Postgres and on MySQL locks once, with no wait and no line, and leaves one open session;
    • a lost shared lock names both objects;
    • the run's own lock on another database is never read as cover, so it is still waited for and refused;
    • a sealer pass seals both objects;
    • for N2, a lockless database is refused with no wait line.
  • database-session-lock.test.ts pins:
    • with no ownLocks, no marker is taken;
    • the marker is taken before the lock;
    • the Postgres check is scoped to the current database and bound to both keys' halves;
    • the MySQL check is bound to the marker and the name;
    • a holder that is not the marked session is contention.
  • @objectstack/plugin-audit test: 95 files, 1566 tests, exit 0. Its typecheck exits 0.
  • @objectstack/objectql test: 597 files, 13154 tests, exit 0. Its typecheck exits 0.
  • The cli contract test audit-redaction-seal.contract.test.ts passes 20 of 20 after a plugin-audit build.
  • Ablation, run once inside one os-verify-lock hold with scripts/ablation-replace.mjs. In seal-lock.ts, LockCover.own was changed to answer no own locks, which is the behaviour before the fix. Anchor 1 to 0, blob 2df37a24c68d to bda5183ca6d1.
    • Red, 5 of 20: the Postgres and MySQL shared-database holds ("Refusing to rewrite 'sys_activity' … after 50 ms"), the lost shared lock, the sealer pass ("expected +0 to be 2"), and the marker statement pin.
    • Green as the control: the other-database case.
    • Restored with blob equal to HEAD and an empty git diff HEAD.
  • Gates. dispatch-gates --commands derived 78. 72 exit 0. 6 exit 3 (PREREQUISITE NOT MET, so NOT MEASURED): the teardown-shape self-test needs an unshallow clone; check:dual-build-cjs-loads, check:i18n, check:i18n-coverage, check:i18n-walk-parity and check:published-readme-exports need builds outside this closure. --ran with the exit codes recorded reports 78 accounted for and exits 0.
  • Dogfood battery at 972c3ec26 under os-verify-lock: VERDICT command-exit 0, 467 test files passed and 3 skipped (470), 3959 tests passed and 42 skipped (4001).
  • CI at 972c3ec26 when written: 50 check-runs, 33 success, 16 skipped, 1 in progress (Test Core (1/8)), none failed.

security_findings: none

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 972c3ec2625d60e2ef17c62ba11e09a813502d2a
Local-runs: none
Scope: packages/cli/src/commands/migrate/audit-key-material.ts, packages/cli/src/commands/migrate/audit-mail-bodies.ts, packages/cli/src/commands/migrate/audit-metadata-bodies.ts, packages/cli/src/commands/migrate/audit-side-copies.ts, packages/cli/src/commands/migrate/audit-redaction-seal.contract.test.ts, packages/cli/src/utils/audit-seal-lock.ts, packages/objectql/src/database-session-lock.ts, packages/objectql/src/database-session-lock.test.ts, packages/objectql/src/index.ts, packages/objectql/src/schema-migration-lock.ts, packages/plugins/plugin-audit/src/audit-seal/seal-lock.ts, packages/plugins/plugin-audit/src/audit-seal/audit-seal-lock.test.ts, packages/plugins/plugin-audit/src/audit-seal/sealer.ts, packages/plugins/plugin-audit/src/audit-seal/audit-seal-sealer.test.ts, packages/plugins/plugin-audit/src/audit-seal/seal-store.testkit.ts, packages/plugins/plugin-audit/src/audit-seal/index.ts, packages/plugins/plugin-audit/src/index.ts, packages/plugins/plugin-audit/src/stored-metadata-body-migration.ts + docs/adr/0154 (D3 as amended, read only), packages/objectql/src/engine.ts (getDriverForObject, read only), packages/cli/src/utils/schema-migration-lock.integration.test.ts (the live-database axis of the lock, read only)

Read at 2026-11-15T14:37Z. Claim: comment 6895481323; lane request 6896141337 on mailbox #33873. Delta review of PR #33675 (slice P4b3 of card #31908) on the narrowing face. The previous head fbdc0b8e carries record 6894679963 (FAIL, M1). One commit sits on top, 972c3ec2; git diff fbdc0b8e 972c3ec2 touches seven files: the changeset, database-session-lock.ts and its test, the objectql barrel (one type), seal-lock.ts, audit-seal-lock.test.ts and seal-store.testkit.ts. The other twelve scope files are byte-equal to the head record 6894679963 judged, and its judgments on them stand. Read: that diff in full, the changed modules whole at the head, sealer.ts runPass and passLockOf (the consumer of the pass locks), packages/cli/src/utils/audit-seal-lock.ts (the consumer of the hold), seat ruling 6885005594 on the card, and the check-runs on this head.

Findings of record 6894679963:

  • M1: closed
  • N1: open (nit), narrowed. The PR body now names the fourth command and STORED_METADATA_BODY_REWRITTEN_OBJECTS. It still counts "two types" for @objectstack/objectql, where this head publishes three (DatabaseSessionLockRunOptions is new), and its Verification section still reads the previous head. The changeset is complete. The body is the seat's to amend.
  • N2: closed
  • N3: open (nit). isHeld() is unchanged.

New on this head:

  • N4 (nit) — the two statements the fix rests on (the pg_locks self-join and the IS_USED_LOCK comparison) are answered only by fakes that match the statement text; no CI leg runs them on a live Postgres or MySQL, which is the standing state of the whole lock module (the live suite is a named skip). They were read here against each dialect instead, see ①.
  • N5 (nit) — trying every database before any wait lets two concurrent --apply runs over two separate databases each take one and wait on the other until both refuse at ten minutes, where the old in-order wait let the second queue. The window is two round trips, both runs change nothing, and a re-run goes through.

No must-fix, no should-fix.

① Derived judgments

  • How M1 is closed. A lock taken with ownLocks first takes a second session lock under a name made from a fresh UUID, then the named lock. A later session of the same run or pass that finds the named lock held asks the database whether the session holding it also holds one of the run's markers, and only on a yes closes itself and answers the earlier lock. LockCover in seal-lock.ts keys the covered objects by lock, so a database reached by two datasources is one session, probed once and released once.
  • The Postgres statement is right as read. A bigint advisory key appears in pg_locks with objsubid = 1, its high 32 bits as classid and its low 32 as objid, both unsigned; pgLockHalves derives exactly that from the signed key. The marker row is restricted to the current database, and the named-lock row must have the same pid and database. So a marker held in another database of the same cluster, or on another cluster, never matches.
  • The MySQL statement is right as read. IS_USED_LOCK answers the holding connection id or NULL; a marker held on another server is NULL there, NULL compared to anything is NULL, and Number(null) is not 1. Connection ids are never compared across servers. The marker name is 61 characters, under the 64 cap, and pinned.
  • No false cover. The marker name never leaves the process and is unique per session, so a foreign holder cannot hold it. If the run's first session dies, its marker goes with it and the answer falls back to contention. If the marker could not be taken (a MySQL older than 5.7.5 drops it when the named lock is taken), the run contends with itself as before the fix; it never proceeds unlocked. Every fallback is the closed side.
  • Cases tried against the code, all holding: two objects on one datasource (one group, one marker, one lock, pinned); two datasources on one namespace (second answered the first's lock, no wait line, one open session, pinned on both dialects); two datasources on two databases with the second held by another session (contention, waited and refused, the first released, pinned); the lock on the first datasource held by a sealer in phase one and freed before the second is tried (the second takes it, and the wait loop then finds the first covered by it); a statement failing in mark, tryLock or heldAmong (session closed, error handed on, every lock of the cover released); a lost shared session (reported for every object it covers at finish(), and lapsed fails each covered object's checkpoint in the sealer, since passLockOf matches by object); release (each lock once, then the lease, as before).
  • ownLocks is scoped to one call of holdAuditSealLock or trySealPassLocks, not to the process. A sealer pass and a hold in one process still exclude each other, and so do a sealer and a run in separate processes on a shared namespace: neither holds the other's marker.
  • The schema-migration lock is untouched in behaviour: it passes no ownLocks, so it takes no marker and runs the same statements (pinned: "without it, no marker").
  • N2 is closed by the same commit: one try on every database first, then refuseUnlocked() before any wait (pinned: no wait line, no lock_timeout statement, the other holder's session left alone).
  • The tests match what M1 asked for: two drivers over one sessionLockDatabase for the hold on both dialects, for a full sealer pass sealing both objects, and the negative on two databases.

② Semver level

  • Declared pair unchanged and still true: Clause-②: yes (narrowing) and Metadata-protocol: none, on the PR body and the changeset. The delta adds no refusal and removes none; it makes one topology work that the previous head broke.
  • Level: patch on @objectstack/plugin-audit, @objectstack/objectql and @objectstack/cli with Metadata-protocol: none. The changeset title carries the ! and the BREAKING paragraph with the fix for each refused case is present. ADR-0087 marker unchanged: not-required (no-migration-prescription).
  • What the delta publishes: one new type, DatabaseSessionLockRunOptions, exported from the objectql barrel, and an optional third parameter on tryDatabaseSessionLock plus an optional ownLocks on DatabaseSessionLockWait. All additive; an existing caller compiles and behaves as before. The changeset names the type and describes ownLocks; the PR body does not (N1).
  • Check-runs on this head when read (about 14:10Z): 49 runs, 25 success, 16 skipped, 0 failed, 8 still in progress: Test Core 1/8, 2/8, 3/8, 4/8, 5/8, 8/8, Type Check · workspace and Type Check · consumer gates. Green so far include Check Changeset, Build Core, Lint & Repo Gates, Lint · ESLint, Governed Surface Queue Guard, the PR-body guards, Test Core (6/8), Test UI, Live E2E UI and Type Check · source gates. This PASS is on the reading of the tree; the checks still running read this diff, so the record is not to be acted on until each of them is green. A red one reopens the round. Re-read by the seat after the last run completed: 55 runs, 37 success, 18 skipped, none failed, none running.

③ Boundary flags

  • Independence: the diff is by session_016WV4cyNkH7W7e89m6j4aQq on branch claude/area-A2-31908-p4b3; this record is rendered by a different account and session.
  • No os-dev-report names this head; the newest is 6894693150, at the previous head. Its two open questions, answered: (1) who writes the PR body: the seat, option A, and the body has since gained the Skills-docs: line and its signed trailer; what is left of it is N1. (2) Skills-docs: in the changeset as well: option A, the PR body only; Check Changeset and the PR-body guards are green on this head without it.
  • SQL push-down rule: not engaged. The delta adds no query over application rows, no id materialisation and no in-app join. Its two new statements read lock state on the lock's own session, and only when a lock is found held while the run already holds another.
  • Connections: one dedicated connection per database per pass or run, as before; a covered datasource opens a second for three statements and closes it. Each pass now takes one more advisory lock (the marker), released with its session.
  • No security boundary is moved and no security finding was met.
  • The stale Verification section of the PR body and the readings owed on the new head (the dev's local runs name the previous head) are the lane seat's to clear; this record does not stand in for them.

④ Design judgment

  • packages/objectql/src/database-session-lock.ts: holds against ruling 6885005594 item 1 (one module says how a session lock is taken on each dialect; the marker and the check live there, not in the caller) and against its red line: no path reads an unproven holder as its own. The choice to ask the database for the holder, as record 6894679963 suggested, is the one that stays exact across clusters and servers. The jsdoc states the degraded case honestly.
  • packages/plugins/plugin-audit/src/audit-seal/seal-lock.ts: LockCover gives the sealer and the hold the same answer for the same topology, so the two still meet on one lock per namespace. The hold's two phases keep every refusal before the first write and release everything on each failure path. N5 is the one cost of the reordering.
  • packages/objectql/src/index.ts: the barrel adds exactly the one type the changeset names.
  • database-session-lock.test.ts, audit-seal-lock.test.ts, seal-store.testkit.ts: the pins assert the statements, their bindings (marker halves then lock halves), the current-database clause, the closed second session and the absence of a wait; the fake answers NULL for a free name as MySQL does. They would go red on a cover read from a marker in another database. What they cannot show is N4.
  • The remaining scope files are unchanged since record 6894679963; read against this head's seal-lock.ts signatures, sealer.ts and packages/cli/src/utils/audit-seal-lock.ts consume the same shapes (locks as objects with a lock; finish() with lost and line), so that record's judgments on E, B, the hot-store pin, the ten-minute wait and the lost-session exit hold here.
  • The narrowing itself holds against ADR-0154 D3 as amended: it takes away only the run the ADR refuses, and with M1 closed it no longer stops sealing in a topology the ADR supports.

Implemented-by: claude/area-A2-31908-p4b3
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ons at the change (objectstack-ai#34106)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi93PPcd7BvYcYsgHCZCgqxzx)_

Fixes objectstack-ai#33612
Clause-②: no
Metadata-protocol: none

## 维护者速读

- 改了什么:CLI 文档里 `os migrate stored-expressions`
那一行,不再说「回滚/还原不会回填」,改为列出会当场回填的全部变更(发布式保存、发布、回滚、还原、删除重声明字段的对象扩展)。
- 为什么改:回滚与还原从 objectstack-ai#32700 起、删除对象扩展从 objectstack-ai#32958 起都会当场回填存储计算字段,旧句会让人以为回滚后还要手动跑这条命令。
- 风险与回滚:纯文档一行,无代码、无发布内容;回滚即 revert 本提交。
- 先看:`content/docs/deployment/cli.mdx` 第 1479 行(唯一改动)。
- 两分钟验证:`git show --word-diff HEAD --
content/docs/deployment/cli.mdx`,预期只见该行的门列表扩充与末句替换。
- 需要你做的:无,席位落地。

## What changes

One row of `content/docs/deployment/cli.mdx`, the `os migrate
stored-expressions` row. It said the command is for "a rollback or
revert, which does not fill". Since objectstack-ai#32700 the history doors fill a
changed stored computed field at the change, and since objectstack-ai#32958 so does
the delete of an `object_extension` that re-declared one. The row now:

- names those doors beside the save and publish doors as changes that
fill at the change, with their routes;
- keeps the command for a definition changed in a repository and booted
(unchanged), and for rows a door's fill could not write, which the
`stored-expression-fill-incomplete` warning names the command for.

Nothing else in the file is touched (open PRs objectstack-ai#33675 and objectstack-ai#34047 may edit
other rows).

### The code this teaches (origin/main `27c2f1ea`)

`packages/metadata-protocol/src/protocol-stored-expression-fill.ts`, the
docblock of the door list:

```text
 * [objectstack-ai#32700] …and the history doors that make a restored definition live
 * (`protocol-package-commits.ts`) fill it the same way, after the storage
 * sync they now run as the save door does:
 *
 * - `rollbackMetaItem` (`POST /api/v1/meta/:type/:name/rollback`);
 * - `revertCommit` (`POST /api/v1/packages/:id/commits/:commitId/revert`),
 *   which captures each object before its first restore and fills it once
 *   after the loop; and `rollbackToPackageCommit`
 *   (`POST /api/v1/packages/:id/rollback`), a loop of `revertCommit`, whose
 *   answer carries every step's notices.
 *
 * [objectstack-ai#32958] …and the delete door that hands an object back the definition
 * beneath it (`protocol-diff-delete-load.ts`): `deleteMetaItem`
 * (`DELETE /api/v1/meta/:type/:name`) removing an `object_extension` that
 * re-declared a stored computed field captures before its registry heal and
 * fills after it.
```

The call sites behind it: `protocol-package-commits.ts` lines 2273 /
2348 (`rollbackMetaItemUnaudited`: capture, then
`fillStoredExpressionChange`), 1568 / 1754 / 1903 (`revertCommit`:
capture per object, fill once after the loop); `rollbackToPackageCommit`
(line 1920) loops `revertCommit`; `protocol-diff-delete-load.ts` lines
828 / 887 (`deleteMetaItem`, active target only).

The remedy text of the incomplete-fill warning (same file, `fillRemedy`,
lines 133–137):

```text
'Each such row is computed when it is next written. To fill them all at once, run '
    + `\`os migrate stored-expressions --object ${object} --field ${field} --changed --apply\` against the `
    + 'database (its dry run, without --apply, lists them first).'
```

### Other copies of the claim

Grepped `content/docs/**` for `does not fill`, `stored-expressions`, and
rollback/revert within 200 characters of fill/stored
computed/expression:

- `ui/translations.mdx:149` ("`label` does not fill it") and
`kernel/services-checklist.mdx:103` ("the package named does not fill
the …"): different claims, untouched.
- `releases/v18/18-4.mdx:799` already says a rollback or revert fills
(release-owned, correct).
- `releases/v18/18-4.mdx` lines 79, 956, 1112, 1221: describe the
command, make no rollback claim.

No other copy; this PR edits one row.

## Tests

Docs-only; no test edits, forced or otherwise.

## Acceptance notes

None.

## Verification

Head `5336b254`. Build closure under `os-verify-lock`
(`@objectstack/lint...`, `@objectstack/spec...`,
`@objectstack/client-react...`): `VERDICT command-exit 0`, 4m55s.

`dispatch-gates --commands`: 44 derived. `--ran`: "44 derived famil(ies)
accounted for — 44 run, 0 NOT-MEASURED (a DERIVED zero)".

<details><summary>44 commands, exit codes</summary>

```text
node scripts/check-adr-links.mjs :: exit 0
node scripts/check-adr-links.mjs --self-test :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-doc-route-spelling.mjs --advisory :: exit 0
node scripts/check-doc-route-spelling.mjs --self-test :: exit 0
node scripts/check-docs-section-name.mjs :: exit 0
node scripts/check-docs-section-name.mjs --self-test :: exit 0
node scripts/check-section-landing-index.mjs :: exit 0
node scripts/check-section-landing-index.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm --filter @objectstack/lint run check:doc-security-posture :: exit 0
pnpm --filter @objectstack/spec run check:docs :: exit 0
pnpm --filter @objectstack/spec run check:empty-state :: exit 0
pnpm --filter @objectstack/spec run check:liveness :: exit 0
pnpm --filter @objectstack/spec run check:skill-examples :: exit 0
pnpm --filter @objectstack/spec run check:strictness-ledger :: exit 0
pnpm --filter @objectstack/spec run check:variant-docs :: exit 0
pnpm --filter @objectstack/spec run check:yaml-examples :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:cli-examples-parity :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:corpus-claim-drift :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-anchors :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:doc-frontmatter :: exit 0
pnpm check:docs-audit-scope :: exit 0
pnpm check:docs-redirects :: exit 0
pnpm check:docs-single-h1 :: exit 0
pnpm check:docs-spec-enumerations :: exit 0
pnpm check:docs-transcript-drift :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-readme-links :: exit 0
pnpm check:react-page-adapter-contract :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:role-word :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:vendor-version-stamps :: exit 0
pnpm check:watch-hint-literal :: exit 0
```

</details>

Type-check lanes and `Plan Test Core shards` are CI's own; no TypeScript
is touched.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmRrQB4tkFVtnqiS8an)_

Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#6 · os-elon-musk · session_016WV4cztR1A2CZoxSZyuoGP

ACCEPT · seat 6 for area A2 · 2026-11-16T07:41Z (area thread closed; seat lands it)

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 07:42
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 35c9a30 Nov 16, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-A2-31908-p4b3 branch November 16, 2026 08:30
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.

2 participants