Skip to content

fix(metadata): two Studio Saves over one published item are no longer last-writer-wins - #36720

Merged
objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/project-thread-ywg3fm
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 11 commits into
mainfrom
claude/project-thread-ywg3fm

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Alice · project thread

Fixes #36601

Clause-②: yes (widening) — two new optional members join what the API accepts and answers: PublishMetaItemRequestSchema.parentVersion (the If-Match / If-None-Match: * pin on POST /meta/:type/:name/publish) and GetMetaItemLayeredResponseSchema.overlayVersion (served on GET /meta/:type/:name/layers); nothing is removed or narrowed, and a publish that names no version behaves as before
Metadata-protocol: added
Skills-docs: none — the two members are REST wire members (a publish precondition and a layered-read answer member) that Studio sends and reads; no metadata author writes them and no published skill teaches the publish route's headers

维护者速读

  • 在 Studio 对象页,两位管理员同时改同一个已发布对象时,后保存的人不再悄悄覆盖先保存的人,而是看到“你打开之后这里已被修改”,可选重新加载、确认覆盖或继续编辑。
  • 属于元数据并发保护:草稿已有版本锁,这次补上“直接发布”这一步,替同时编辑的管理员解决改动丢失。
  • 出错的话,最坏是保存时多弹一次冲突对话框或保存被拒;不带版本的旧客户端行为不变,撤回本次合并即可恢复原状。
  • 要你做的事:无。

What changes

Server (@objectstack/spec, metadata-protocol, rest, runtime)

  • GET /meta/:type/:name/layers answers overlayVersion: the keyed version token of the stored active row at the read's address (?package=). It is the same token the plain uncached read serves as version and a publish receipt serves as version; null when no active row is stored there. Opt-in on the protocol (withVersion), turned on by the REST route and the runtime meta domain, so in-process layered readers pay no extra read.
  • POST /meta/:type/:name/publish takes that token as If-Match, or If-None-Match: * for "no active row here". The headers are parsed by the save door's own parser (metaSaveRequestOptions), so the two doors refuse the same malformed preconditions with 400 VALIDATION_ERROR.
  • A stale pin is refused 409 METADATA_CONFLICT with currentVersion, through the existing metadataConflictRefusal. Nothing is promoted and the draft stays pending.
  • The pin is checked by the store's put lock on the promoting write (promoteDraft's new expectedActiveHash becomes the put's parentVersion), not by an earlier separate read. The token is converted with the existing storedParentForToken.
  • A publish with neither header is unpinned, exactly as before.

Studio (@object-ui/data-objectstack, app-shell, i18n)

  • MetadataClient.publish takes ifMatch / ifNoneMatch and sends them as headers.
  • DraftVersionGuard holds a second pin per item, for the published row: recordPublished (from the load's /layers read, via publishedPinOf) and publish (sends the pin, then holds the receipt's version so one editor's Saves chain).
  • On a conflict, the guard asks through the same dialog as a stale draft, with layer: 'published' wording ("This changed since you opened it"):
    • Reload takes back the draft the Save wrote, then re-reads the live object.
    • Overwrite, after a confirmation, re-publishes pinned to the refusal's currentVersion. A publish landing in between is asked about again.
    • Keep editing publishes nothing, takes back the saved draft, and leaves the edits on the page with the draft conflict's own "Not saved" line.
  • publishSavedItem takes the guard's publish as an optional pinned argument. Overloads keep the unpinned callers' outcome type unchanged.
  • Studio's object page (StudioDesignSurface data pillar) is wired: its load records the published pin and its Save publishes through it.
  • New studio locale keys (en, zh): engine.draftConflict.publishedTitle, publishedDescription, publishedOverwriteTitle, publishedOverwriteDescription.

Not in this PR. The object extension, hooks, pair-actions and flow editors still publish unpinned, so their behaviour is unchanged. Each needs its own load to read /layers. This is reported to the seat as follow-up.

Tests

  • packages/rest/src/meta-item-publish-version-pin.test.ts (new, real stack: better-sqlite3, cache off). Cases:
    • the unpinned control (last writer wins, as before)
    • two pinned Saves: the second gets 409, currentVersion equals A's receipt and the next /layers token, B's draft stays pending, and an overwrite pinned to currentVersion is accepted
    • the token agrees across /layers, the plain read and the publish receipt
    • a draft-only item serves null, its first If-None-Match: * publish succeeds and a second is refused
    • a guessed raw token gets 409
    • two malformed header pairs get 400
  • DraftConflictDialog.test.tsx, new describe for the published pin:
    • publishedPinOf
    • pin then receipt chaining
    • reload order (publish, then discard, then reload, with pins cleared)
    • overwrite and keep-editing (the kept-editing error is told apart)
    • a null pin, and unpinned
  • StudioDesignSurface.draftVersionConflict-11773.test.tsx, new describe "two Saves over one published object are not last-writer-wins":
    • keep editing
    • reload
    • overwrite
    • one editor's pins chain
    • a server without overlayVersion gets an unpinned publish
  • Ablation: with the Save's publish unpinned again, 4 of the 5 race cases fail. The control stays green, as it should.

Acceptance notes

  • Ruling ①: the publish answer already served version (the active token). The new piece is the read Studio loads from, so /layers now answers overlayVersion, the same token.
  • Ruling ②: the refusal is the typed 409 METADATA_CONFLICT with currentVersion, the draft door's own. Studio shows the draft conflict's reload-or-overwrite dialog, worded for a live change.
  • Ruling ③: no header means unpinned. The control test pins today's behaviour.
  • Seat ruling on Studio 里人工修改改成「保存」「取消」,保存后这一项立刻生效;不再自动存草稿,不用整包发布 #36511 (no client-only re-read before save): the check is server-side, inside the promoting write's lock.
  • Read first, by risk:
    • packages/metadata-protocol/src/protocol-history-and-publish.ts: the token-to-hash conversion and the first-write pin passed to metadataConflictRefusal.
    • ui/packages/app-shell/src/views/metadata-admin/DraftConflictDialog.tsx: DraftVersionGuard.publish, especially the reload ordering.
    • ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx: publishSavedItem's pinned branch.
  • Two-minute check: pnpm --filter @objectstack/rest exec vitest run src/meta-item-publish-version-pin.test.ts should report 7 passed.

Verification

Head 263b1dc5, base 3cf6a44b; merges cleanly onto current origin/main (overlap-check: VERDICT clean).

  • Premise on main 3cf6a44b: the unpinned control showed B's publish replacing A's, the publish ignored If-Match, and /layers served no version.
  • Server suites: @objectstack/metadata-protocol 23352 passed / 45 skipped; @objectstack/rest 8794 passed / 351 skipped, with 1 failure: an existing assertion on the layered route's options, updated for withVersion and re-run green (13 passed in that file); @objectstack/runtime 11845 passed / 25 skipped.
  • New and neighbouring server files: meta-item-publish-version-pin, meta-item-layered-route, meta-item-version-token-occ: 35 passed.
  • UI: DraftConflictDialog.test.tsx + StudioDesignSurface.draftVersionConflict-11773.test.tsx 41 passed; the 36511 save suites plus data-objectstack and i18n: 237 files, 3413 passed; ui/scripts: 5127 passed.
  • Type checks: spec, metadata-protocol, rest, runtime, app-shell (both tsconfigs), data-objectstack, i18n: clean.
  • Generated: check:generated --fix regenerated content/docs/references/api/protocol.mdx (committed).
  • Derived gate families (dispatch-gates --ran): 126 derived, 125 run with exit 0, 1 NOT-MEASURED: check-plugin-teardown-shape --self-test exit 3, its positive control is pinned to a commit this shallow clone cannot reach. Declared to CI. check:dual-build-cjs-loads needs a whole-repo pnpm build and is likewise declared to CI.
  • Two gates went red on this branch and are fixed in it: check:facade-delegation-only (the protocol facade was 10 lines over its ceiling; its layered-read answer type now reuses the facet's declared type, and the file is 30 lines shorter than base) and check:test-source-alias (the edited layered-route test pays the engine load at collection).

🤖 Generated with Claude Code

https://claude.ai/code/session_011y7As7qXR2zTnbLDZgn218

…nned callers keep their outcome type (#36601)

Claude-Session: https://claude.ai/code/session_011y7As7qXR2zTnbLDZgn218
Co-authored-by: Claude <noreply@anthropic.com>
…cet's own; pay the engine load at collection (#36601)

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

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/metadata-protocol, @objectstack/rest, @objectstack/runtime, @objectstack/spec, touching 72 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/spec/authorable-surface/api.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

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

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

Coarse fallback — 182 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 0d727b70716ccf77fd63d0a0a2f0b17f7ab4d28a → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 0d727b70716ccf77fd63d0a0a2f0b17f7ab4d28a

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV

Contract-review-claim: session_011y7As6YDLR8TJVDpdXzJyV · head 263b1dc · 2026-11-23T14:18Z

L1-a review thread runs the schema-face contract review at CONTRACT_REVIEW_TIER on this head, in parallel with its L1.

…l added, spec minor (#36601)

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 263b1dc51ee8261c823dbc7363ba2a8836ad3955
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts + packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-meta-layered-reads.ts, packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/src/sys-metadata-repository.ts, packages/rest/src/meta-item-history-routes.ts, packages/rest/src/rest-server.ts, packages/runtime/src/domains/meta.ts, ui/packages/data-objectstack/src/metadata-client.ts, ui/packages/app-shell/src/views/metadata-admin/DraftConflictDialog.tsx, ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx, ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx. The rest of the diff (tests, the changeset prose, the generated protocol.mdx and authorable-surface/api.json, the i18n catalogues) is the lane seat's ACCEPT at TIER_DEFAULT.

Inputs read: card #36601 body and its four comments (triage 7089618771, claim 7096852442, progress 7103696854, dev report 7103778017), the PR body and file list, the net diff against origin/main, and the check-runs on this head. Check-runs when read: 1 failure (Check Changeset), 21 success, 9 skipped, 35 still in progress (all Test Core and Test UI shards, Build Core, Build & E2E UI, Live E2E UI, Type Check · workspace, Type Check UI, Type Check · debt ledger, Type Check · consumer gates, Lint UI, Lint · CI, release & engine gates). No in-progress run is cited as green below.

① Derived judgments

  • PublishMetaItemRequestSchema.parentVersion (string | null, optional): RIGHT as a widening of the request. Absent stays unpinned: the REST door spreads the key only when a header was sent (meta-item-history-routes.ts), promoteDraftForPublish reads the active head only when the key is present, and repo.promoteDraft falls back to currentActive?.hash ?? null exactly as on main. The batch publishPackageDrafts path builds its own request and states no pin, as the jsdoc says.
  • GetMetaItemLayeredResponseSchema.overlayVersion (string | null, optional): RIGHT as a widening of the answer. Served only under opts.withVersion, which the two doors (rest-server.ts, runtime/src/domains/meta.ts) turn on; in-process readers get no key, which the description's "absent means not served" covers.
  • The pinned compare is at the address the promotion writes: repo.headAt(ref, { state: 'active', packageId: promoteInto }) in the protocol and put(..., packageId: activePackageId) in the repository resolve the same row in every branch I traced (stated package; unbound draft adopted into the item's package; row-held base). RIGHT.
  • The single-item publish has ONE door. publishMetaItem is called only from packages/rest/src/meta-item-history-routes.ts; the runtime /meta domain serves /layers but no per-item publish, so there is no second door that serves the token and ignores the pin. RIGHT.
  • Stale token → InboundVersionConflictError thrown inside the promotion's try, answered through metadataConflictRefusal as 409 METADATA_CONFLICT with currentVersion (keyed, or null); an empty or raw token is never read as "no pin" (storedParentForToken). Nothing is written before the refusal. RIGHT.
  • Is anything narrowed? One thing, and the PR's sentence does not name it: on main the publish door read neither If-Match nor If-None-Match, so a publish carrying either succeeded; on this head a stale If-Match is 409, and If-None-Match with a value other than *, or beside If-Match, is 400. The 409 is the card's ask 2 verbatim. I found no first-party sender on main: @objectstack/client publishItem and MetadataClient.publish send neither header. I judge the (widening) arm to hold (a caller that sent a precondition asked for the guard; no declared capability is taken away), with the wording nit N1.
  • No Studio Save that succeeded before is refused for a single editor: load pins overlayVersion, each landed publish re-pins from the receipt's version (the same receiptVersion producer), and a server that serves no overlayVersion leaves the publish unpinned.

② Semver level

WRONG on this head, by the gate's own verdict. Check Changeset concluded failure on 263b1dc5: the diff moves packages/spec/authorable-surface/api.json (two keys added: api/GetMetaItemLayeredResponse:overlayVersion, api/PublishMetaItemRequest:parentVersion) while the PR body and the changeset declare Metadata-protocol: none and grade @objectstack/spec patch. The gate reads a changed authorable-surface shard as a metadata-protocol change and requires Metadata-protocol: added with at least minor on the package that carries it.

M1 (must-fix) — declare Metadata-protocol: added in the PR body and in .changeset/36601-published-layer-version-pin.md, and grade @objectstack/spec at least minor. The baseline shard is correct as generated and must not be edited to quiet the gate.

Clause-②: yes (widening): the arm holds (see ①). No removal, no tombstone, no ADR-0087 disposition owed.

③ Boundary flags

  • Dev open question (the object extension, hooks, pair-actions and flow editors still publish unpinned): answered, option A. The server half covers every editor, an unpinned publish is today's behaviour (card ruling 3), and the card's re-check is the object page. Condition: the follow-up card is filed before this PR closes Studio save goes live: two admins saving the same published object, the later save silently overwrites the earlier one (the published layer has no version a save can pin) #36601, because those four editors keep the silent overwrite the card describes.
  • Dev flag, check-plugin-teardown-shape --self-test NOT-MEASURED and check:dual-build-cjs-loads declared to CI: the runs that would answer them (Lint · CI, release & engine gates, Build Core) were still in progress when read. Not answered green by this record.
  • Dev flag, file surface: the diff stays inside the claimed surface (metadata-protocol, rest, runtime meta domain, spec, the Studio conflict wiring under ui/). No breach.
  • SQL push-down: the diff adds one keyed head read per pinned publish (repo.headAt) and one readVersionToken per door /layers read (an address resolution plus a keyed head read). No id materialisation, no in-app join. No finding.

④ Design judgment

packages/spec/src/api/protocol.zod.ts, against card #36601 asks 1 to 3 and its first consumer (Studio's object page): the two members implement the asks. The card's race is closed for the wired editor: B's publish is compared, at the promoting write's address, against the token of the row B loaded; after A's publish that token is stale and B is refused before anything is promoted. I tried the overwrite path (re-pinned to the refusal's currentVersion, a third publish in between is asked about again), the first-publish path (null → If-None-Match: *, refused once a row exists), a guessed raw hash (refused), and a legacy row with no stored checksum (served version accepted by lockAccepts). None broke.

S1 (should-fix) — packages/metadata-protocol/src/protocol-meta-layered-reads.ts: overlay and overlayVersion come from two separate reads with no transaction around them, and the token is read LAST (the findServedOverlayRow read near line 533, the readVersionToken read near line 957, many awaits apart). A publish that lands between them is served as the OLD body with the NEW token; Studio then pins a stale buffer to the current version and its Save replaces the other editor's change without a dialog. That is the card's lost update inside one request's duration, and the seat ruling on #36511 rejected a fix that "narrows the window but cannot close it". Fix: take the token from the same row read that serves the layer when that row is the address's row, or read the token BEFORE the body so a tear can only produce a false 409, never a false accept.

S2 (should-fix) — ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx with DraftConflictDialog.tsx (DraftVersionGuard.publish, reload branch): discardSavedDraft swallows a failed reset, and the guard then clears both pins and reloads anyway. The reload installs the losing draft (the author's stale-based body) as the buffer and pins it to the FRESH published version, so the next Save publishes over the other editor's change with no second prompt. The comment "the re-read installs the live row, never the draft that lost" holds only when the discard succeeds. Fix: when the discard fails, do not re-pin to the fresh row (keep the stale published pin, or surface the failure instead of reloading).

N1 (nit) — the Clause-② sentence says "nothing is removed or narrowed". Precise form: publish requests that carried If-Match or If-None-Match were ignored on main and are now honoured (409) or refused when malformed (400). Prose only; accepted deviation if left.

N2 (nit) — sys-metadata-repository.ts, expectedActiveHash jsdoc: "the check and the write are one call, not a read and a later write" overstates. put reads the head, compares, then updates by row id inside engine.transaction; the update carries no condition on the checksum, and withTxn's own docblock declares the degrade on drivers without rollback or isolation. It is the same lock the save door has always used (the card's named precedent), so two publishes overlapping at transaction scale are as protected as two saves are, no more. The card's race (a stale read, human scale) is closed regardless. Accepted deviation; a conditional write is a follow-up for ADR-0008, not this card.

N3 (nit) — protocol.zod.ts, overlayVersion description: the token is the row at the read's SAVE address, which is not always the row overlay shows (ADR-0048 fallback, an ADR-0146 served override) and, for a read naming no package, not always the row an unnamed publish replaces (a bundle member whose rows a base and a declaring package both hold; an action's environment-own draft; an unbound item whose only draft is package-bound). In those cases the pinned publish answers a false 409, never a false accept, because the pin is judged at the promotion's own address. "The published layer a publish of this item replaces" should say so. Studio's object page names the package on both calls and is not affected. Follow-up or prose fix.

N4 (nit) — DraftConflictDialog.tsx, DraftVersionGuard.publish: every 409 METADATA_CONFLICT on the publish is shown as a published-layer conflict, including the pre-existing "draft changed after this publish judged it" refusal, whose currentVersion is the DRAFT's token. Overwrite then re-pins the publish to a draft token, is refused once more, and lands on the second confirmation. Safe direction, clumsy; follow-up.

N5 (nit) — meta-item-history-routes.ts: the 400 sentences reused from metaSaveRequestOptions say "saves only over that version" on the publish door. Wording only.

protocol.ts, rest-server.ts, runtime/src/domains/meta.ts, metadata-client.ts, StudioDesignSurface.tsx: agree with the contract as written; the facade's return type now reuses the facet's, with no member lost.

Implemented-by: claude/project-thread-ywg3fm
Reviewed-by: session_011y7As6YDLR8TJVDpdXzJyV

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV

维护者速读

  • 结论:退回修改(REWORK)。整体设计成立:Studio 对象页两人同时保存时,后保存的人会看到冲突提示,不再悄悄覆盖。
  • 但有两处小漏洞会让覆盖仍然悄悄发生:读取已发布内容和读取版本号是两次分开的读;以及“重新加载”时撤回草稿失败会被吞掉。两处都需要改代码,改完由本审核线程复核。
  • 其余编辑器(流程、钩子等)仍未加保护,需要另开后续卡。无需你做任何事。

席位核对

Verdict: REWORK · head 612759dfd823e6759a08541ae4b4d19010315b8f · card #36601 · L2 record: comment 7103982658 at 263b1dc51ee8261c823dbc7363ba2a8836ad3955 (FAIL: M1, S1, S2)

Reviewed against GitHub (diff, card body, l1-face.mjs, pr-state.mjs), not against the report. Between 263b1dc5 and 612759df only .changeset/36601-published-layer-version-pin.md moves (spec minor, Metadata-protocol: added, the authorable-surface sentence), so the L2 record's reading of every code path stands at this head.

Checklist

  • Shape: open, draft, base main, first line Fixes #36601. Fixes is acceptable on the card's own Re-check (one object, two sessions): the server side is complete and the object page is wired. The four other Studio editors that still publish unpinned (object extension, hooks, pair actions, flow) are declared in the body's "Not in this PR" and owe a follow-up card filed before this PR closes Studio save goes live: two admins saving the same published object, the later save silently overwrites the earlier one (the published layer has no version a save can pin) #36601 (the L2 answered the dev's open question the same way).
  • Changeset and content/docs/references/api/protocol.mdx sentences read against the diff: both new members, the If-Match / If-None-Match: * reading, 409 METADATA_CONFLICT with currentVersion, 400 VALIDATION_ERROR for both headers or a non-* If-None-Match, unpinned when neither header, the client options and the four locale keys hold. The L2's N1 (requests carrying those headers were ignored on main and can now be refused) is accepted under the (widening) arm: no first-party sender sent them on main.
  • UI read by this seat (TIER_DEFAULT): DraftVersionGuard.publish takes beforeReload before reload and clears both pins; "keep editing" throws a marked error that the page shows as the draft conflict's "not saved"; publishSavedItem keeps its unpinned overload byte-compatible for the six other callers.
  • M1 (L2, Check Changeset red at 263b1dc5): closed by 612759df; re-read on the fixed head.
  • Gates at 612759df: 11 success, 0 failed, 29 pending when read; re-read on the fixed head.

REWORK items

  1. S1, confirmed in the tree: protocol-meta-layered-reads.ts reads the overlay body first and overlayVersion afterwards (readVersionToken(…, 'active')), as two reads with no transaction. A publish that lands between them serves the OLD body with the NEW token, so Studio installs a stale buffer pinned to the current version, and its next Save overwrites the other editor without a prompt. This is the exact lost update the card closes. Fix: take the token from the same row read as the overlay, or read the token BEFORE the body (a stale token then gives a false 409, the safe direction). Add a pin that interleaves a publish between the two reads.
  2. S2, confirmed in the tree: on a published conflict answered "reload", publishSavedItem's discardSavedDraft swallows a failed reset, and the guard reloads anyway. The reload installs the losing draft (draft ?? overlay ?? code), and recordPublished pins it to the fresh published version, so the next Save overwrites with no prompt. Fix: when the discard fails, do not reload into the draft (surface the failure and keep the conflict open, or reload without installing that draft). Add a pin with a reset that rejects.
  3. Nits N2–N5 from the L2 are accepted deviations; N3 and N4 are better addressed in the follow-up card above.

The L2 delta on the fixed head is read by the same reviewer.

…hose draft discard fails does not reload (#36601)

Contract review S1: the layered read took the active row's token after the
overlay body, so a publish landing between the two reads paired the old body
with the new token. The token is now read first: a publish in between pairs an
old token with the new body, and the Save is refused 409, the safe direction.

Contract review S2: on a published conflict answered reload, a failed draft
discard was swallowed and the guard reloaded into the losing draft, pinned to
the fresh version. The reload's discard now throws on failure: nothing is
re-read, the pin the conflict was raised on stays, and the Save reads as
refused.

Claude-Session: https://claude.ai/code/session_011y7As7qXR2zTnbLDZgn218
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl and removed size/l labels Nov 23, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV

Contract-review-claim: session_011y7As6YDLR8TJVDpdXzJyV · head ee46e5e · 2026-11-23T14:38Z

L1-a review thread runs the L2 delta (S1, S2 of record 7103982658) on this head, by the same reviewer.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: ee46e5e2c9c6a1b3e4e71c7288f35fbc85c33b1d
Local-runs: none
Scope: packages/spec/src/api/protocol.zod.ts + packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-meta-layered-reads.ts, packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/src/sys-metadata-repository.ts, packages/rest/src/meta-item-history-routes.ts, packages/rest/src/rest-server.ts, packages/runtime/src/domains/meta.ts, ui/packages/data-objectstack/src/metadata-client.ts, ui/packages/app-shell/src/views/metadata-admin/DraftConflictDialog.tsx, ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx, ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx. The rest of the diff is the lane seat's ACCEPT at TIER_DEFAULT.

Delta review of the record on head 263b1dc5 (comment 7103982658). Read: the changeset-only move 263b1dc5 to 612759df, the five-file delta 612759df to ee46e5e2 (protocol-meta-layered-reads.ts, DraftConflictDialog.tsx, studioSaveBar.tsx, two test files), the PR body, follow-up card #36726, and the check-runs on ee46e5e2. Check-runs when read: 10 success (Check Changeset, Governed Surface Queue Guard, PR-body guards, Spec property liveness, Dogfood Regression Gate, Flag docs affected by code changes, Check Documentation Links, Check PR Size, Auto Label, filter), 9 skipped, 18 in progress (Build Core, Build Docs, Build UI Deps, every Lint job, the four Type Check jobs, the two shard planners, Live E2E UI); the test shards had not been created yet. No in-progress run is cited as green, and the two new tests are not confirmed by CI in this record.

① Derived judgments

No accept-set or public-surface change in the delta. protocol.zod.ts and the two schema members are untouched since 263b1dc5; the judgments of the first record stand. The reorder in getMetaItemLayered changes which read runs first, not what is served: the same producer (readVersionToken, active, the read's address and member), the same null and absent cases.

② Semver level

M1: closed. The changeset on this head grades @objectstack/spec minor and declares Metadata-protocol: added; the PR body carries the same line; Check Changeset concluded success on ee46e5e2. The other six packages stay patch, which the rule allows (the kind is carried by spec). Clause-②: yes (widening) is unchanged and holds as judged before. The new Skills-docs: none line is right: the two members are wire members a client sends and reads, nothing a metadata author writes.

③ Boundary flags

④ Design judgment

S1: closed. protocol-meta-layered-reads.ts now reads overlayVersion before the overlay body (ahead of the findServedOverlayRow read, and so ahead of effective and the draft layer). A publish landing between the two reads can only pair an old token with a newer body, and the Save's pinned publish is then refused 409: the safe direction. member is resolved above the new position, and the failed-read rule (rethrowUnlessMetadataStoreUnprovisioned) moved with the block unchanged.

S2: closed. publishSavedItem hands the guard discardBeforeReload, which does not swallow a failed reset. The throw leaves DraftVersionGuard.publish before the pins are cleared and before deps.reload(), so the stale published pin stays and nothing is re-read. publishSavedItem's catch then answers a refused Save; the metadata pulse it emits cannot install the losing draft, because the object page holds its buffers while dirty or saving is set (objBuffersHeld), and a refused Save leaves the page dirty. The next Save is asked again.

N6 (nit) — the hadDraft residual. When a draft was already pending before the Save, a reload keeps it by design (it may be a copilot's), so the re-read installs that draft, now carrying the page's edits, pinned to the fresh published version. I judge this acceptable as a follow-up and not S2 again, for three reasons. First, the draft pin stops the two-Studio-Saves race before the publish pin is reached: both editors share the pending draft, and the second draft save is refused. Reaching the residual needs a writer that moves the active row without touching the draft (a direct active save, a rollback) while a draft is pending. Second, the author is asked once, and what the page shows after the reload is the pending draft, which is what it showed before the Save. Third, a pending draft built on an older published row is the draft model's standing condition on main (publishing it from Changes has the same effect), and discarding a draft the Save did not create is not this card's to decide. Condition on the follow-up: #36726 as read covers the four unpinned editors only and does not mention this case; add it there, or file it on its own, before #36601 closes.

N1 to N5 of the first record: unchanged, none fixed in this delta, none moved by it. They stay nits: accepted deviations or follow-ups.

No must-fix, no should-fix.

Implemented-by: claude/project-thread-ywg3fm
Reviewed-by: session_011y7As6YDLR8TJVDpdXzJyV

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV

维护者速读

席位核对

Verdict: ACCEPT · head ee46e5e2c9c6a1b3e4e71c7288f35fbc85c33b1d · card #36601 · L2 chain: 7103982658 (FAIL at 263b1dc5: M1, S1, S2) → 7104400710 (delta PASS at this head: M1, S1, S2 closed; N6 accepted as follow-up)

Delta L1 over the REWORK 7104005630, read against GitHub (git diff 612759df..ee46e5e2, l1-face.mjs --pr 36720 exit 0, pr-state.mjs), not against the report.

Checklist

Landing note

  • The diff touches packages/spec/src/api/protocol.zod.ts (published schema): landing follows the schema face's route, with the L2 chain above as the contract-tier record on this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH

维护者速读

席位核对 — ACCEPT · repo:objectstack#7 · head c3c3890761533334ae630ffcb420bfac1af7acb9

Seat landing record, read against GitHub at this head. The L1 is L1-a's ACCEPT 7111334480 at ee46e5e2; this head is a clean merge of origin/main into it (no conflict, the same 21 files against main), so the reviewed diff is unchanged.

  • Shape: Fixes #36601, base main, 21 files (+993/−76). Clause-②: yes (widening), Metadata-protocol: added, changeset present, Skills-docs: line present.
  • Premise: the card's lost-update interleaving is pinned (S1 interleaving pin and S2 reset-rejects pin fail on the old code, pass on the fix, per the card thread's report).
  • Gates at this head: 70 check-runs, 61 success, 9 skipped (path-scheduled), 0 failed.
  • Contract tier: the spec path (packages/spec/src/api/protocol.zod.ts) is covered by the L2 chain ending in the delta PASS 7104400710 (M1, S1, S2 closed).
  • Accepted deviations: none. Out of scope: the hadDraft residual (N6) and the review follow-ups are tracked on Studio Save: the object extension, hook, action and flow editors still publish unpinned, so two admins saving one of them, the later save silently overwrites the earlier (after #36601) #36726.
  • Landing: not governed (check-governed-merges --pr 36720, 0 of 21 paths), no (narrowing) arm, under 3000 lines, landing-k K = 1.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 20:03
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 70f454a Nov 23, 2026
71 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-ywg3fm branch November 23, 2026 20:34
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…and texts from their served rows (objectstack-ai#36774)

Fixes objectstack-ai#36725

Clause-②: no
Metadata-protocol: none

## 维护者速读
- 在 Studio 里编辑对象的"钩子"时,钩子的"拒绝目录"和"文本"两项从原始 JSON
编辑框改成按条目编辑的表单并带说明文字;从应用导航打开的全局操作,右侧设计器现在也画出这两项和"更多字段",以前完全看不到。
- 属于 Studio 操作与钩子设计器的补完:上一轮让操作的整页编辑器和对象"操作"视图用上了服务端表单,这次补齐剩下的两个入口。
- 出错时作者在这两个入口会看到原来的 JSON 编辑框或看不到这两项,已存的钩子和操作内容、服务端校验都不受影响,可以直接撤回。
- 无

## What changes

- `HookDefaultInspector` (the hook designer) reads the optional
`serverForm` prop the action designer already reads, and draws
`refusals` and `texts` from their served rows: a one-section
`SchemaForm` over the served schema, its rows taken from the served
`hook` form by the shared `servedFormRows` helper, placed in the
Function section beside the handler body. Both keys are then hidden from
"More fields"; with no served form, or a form without the row, they stay
in "More fields" exactly as before. The inspector now mounts two
whole-draft forms, so their inline-issue rows go through
`useIssuePrefixRegister` as a union, the same wiring as the action
designer.
- Host 1, the Studio object's Hooks view: `DataPillar` hands
`typeForms.hook` (the served form index that already feeds the Actions
view) to `ObjectHooksPanel` as `hookForm`, and the panel passes it to
the inspector as `serverForm`.
- Host 2, a global action opened from an app nav leaf: the Interfaces
rail's no-selection branch now hands the action designer the served
`action` type row, schema and form (`useMetadataTypes`, the read
`DataPillar` makes). Scoped to `action`: the page, report and dashboard
home inspectors on that rail are handed nothing new.
- No schema or served-form change: `packages/spec` is untouched; the
rows on `hookForm` and `actionForm` are read as served.

Landing point: `inspectors/HookDefaultInspector.tsx` and the two Studio
mounts in `studio-design/` (`ObjectHooksPanel.tsx`, and in
`StudioDesignSurface.tsx` the Hooks hand-off line and the rail's
home-inspector hand-off, away from the save path PR objectstack-ai#36720 edits).

Read first (by risk):
1. `studio-design/StudioDesignSurface.tsx`: the `servedHomeType` block
in `InterfacesPillar` and its two props on the `DefaultInspector` mount.
2. `inspectors/HookDefaultInspector.tsx`: the `servedRowsForm` block,
the hidden-fields change on the fallback form, the two
`useWholeDraftFormIssueRows` setters.
3. `studio-design/ObjectHooksPanel.tsx`: the `hookForm` prop.

## Tests

- `DataPillar.hookServedRows-36725.test.tsx` (host 1: the real Data
pillar, Hooks tab, real hook designer, the `hook` type row served
through `useMetadataTypes` and built from `hookForm` + `HookSchema` the
way the server builds it): no textarea holds either record as JSON; both
served help texts are drawn; the key-only control draws
`CONTRACT_LOCKED` and `follow_up_subject` under their keys.
- `InterfacesPillar.navActionServedRows-36725.test.tsx` (host 2: the
real Interfaces pillar, an app whose nav holds a global action leaf, the
real action designer, the `action` type row built from `actionForm` +
`ActionSchema`): the rail mounts the action designer, which draws "More
fields", no JSON textarea, both served help texts, and both keys under
the key-only control.

<details><summary>Ablation (both pins fail on main)</summary>

Fix committed first. The three source files restored to `origin/main`
(0d727b7) in the tree only (`git restore --source=BASE`, blob hashes
equal to the base blobs, `serverForm` / `servedHomeType` occurrence
count 0), both pin files run, then `git restore --source=HEAD --staged
--worktree`, proven by blob hash equal to `HEAD`'s (HookDefaultInspector
e7944b9, ObjectHooksPanel 1b07b11, StudioDesignSurface 80b2b9e) and
an empty `git status --porcelain`.

- Mutated: 2 of 2 red. Host 1: `expected [ textarea …, …(1) ] to deeply
equal []`, the two raw JSON editors holding `refusals` and `texts`,
which is the card's premise measured. Host 2 (only
`StudioDesignSurface.tsx` restored, after the pin first waits for the
action designer's Behavior section): `Unable to find an element with the
text: More fields`: the rail mounts the action designer with no schema,
so it draws no "More fields" and neither row, which measures the card's
second host as described.
- Restored: 2 of 2 green.

</details>

## Acceptance notes

- Host 2 exists as the card describes: `navSurface.ts` resolves an
`action` nav leaf to `{ type: 'action' }`, `action` registers a preview
and no studio canvas, so the leaf is an editable surface and the rail's
no-selection branch mounts the registered `action` default inspector.
The ablation above is the measurement.
- The hook's served rows declare no `visibleWhen`, so they show on an
expression body too (the schema refuses both keys there). That is the
served form's own face, drawn as served; this PR changes no form.
- `useWholeDraftFormIssueRows` is now a module-private copy in both
designers. Hoisting it beside `useSliceFormIssueRows` in `issuePath.ts`
would touch two files outside this claim's file surface, so it is left
as it is.
- Without a registered hook designer, `ObjectHooksPanel` falls back to a
bare `SchemaForm` with the schema only. No production host reaches that
branch (`registerBuiltinInspectors` registers the hook designer), so it
is left unchanged.
- The Interfaces rail hands the page, report and dashboard home
inspectors no served schema, unlike the full-page editor. Each grafts
server-only fields onto its bundled form when given one. This is an
observation about this rail, not measured as a defect, and outside this
card.

## Verification

Two-minute check (from the repository root, after building the closure):
`pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx
packages/app-shell/src/views/studio-design/InterfacesPillar.navActionServedRows-36725.test.tsx`.
Expect `Tests 2 passed (2)`.

<details><summary>Local readings at 3d8929f</summary>

- Closure build `pnpm turbo run build
--filter='@object-ui/app-shell^...' --concurrency=2` (the dependencies
of app-shell, not app-shell itself, which the tests read from source; no
commit on this branch touches the closure): lock VERDICT command-exit 0,
68/68 tasks.
- New pins: Test Files 2 passed, Tests 2 passed (lock VERDICT
command-exit 0).
- Related suites (the 6 `HookDefaultInspector.*` tests,
`inspectorStrings.hookAction.i18n-10586`, the `ObjectHooksPanel.*`,
`InterfacesPillar.*`, `DataPillar.action*` tests,
`StudioDesignSurface.interfacesAction`, both new pins): Test Files 36
passed, Tests 183 passed (lock VERDICT command-exit 0).
- `pnpm --filter @object-ui/app-shell type-check` (both `tsc --noEmit`
and `tsconfig.test.json`): lock VERDICT command-exit 0.
- eslint over the 5 changed ui files: 0 errors; warnings only on
pre-existing lines.
- `node scripts/pm/dispatch-gates.mjs --commands` derived 38 families,
all exit 0 on this head (the ui scripts suite: Test Files 172 passed, 2
skipped; Tests 5127 passed, 2 skipped). `--ran` reconciliation: 38
derived, 38 run, 0 NOT-MEASURED (a derived zero: every row carries its
exit code), 0 UNRUN.
- `pnpm check:new-line-citations` (ui): 0 new citations, exit 0.
- `node scripts/pm/overlap-check.mjs`: merges cleanly with origin/main
(0d727b7) and with objectstack-ai#36720, the one open PR that shares a file
(`StudioDesignSurface.tsx`); VERDICT clean exit 0.
- Full app-shell `pnpm test` and every other CI family: declared to CI
(Test UI, Type Check UI, Lint UI).

</details>

---

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ublish (objectstack-ai#36726) (objectstack-ai#36958)

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

## 维护者速读

- 管理员在设计器里保存对象扩展、钩子、动作和流程时,若别人刚发布过同一项,现在会弹出与对象页相同的冲突提示,不再静默覆盖对方。
- 这是对象页已修好的"两人同时保存后者静默覆盖"问题(父卡已关闭)在其余四种编辑器上的补全。
- 出错时最坏是多问一次冲突提示,不会丢数据;纯前端改动,可直接撤回。
- 无。

## What changes

Each Studio editor that saves by "write the draft, then publish that one
item" now pins its publish to the published row it was loaded at, the
way the object page does since objectstack-ai#36720. The server half (If-Match /
If-None-Match on publish, `overlayVersion` on `/layers`) is already on
main.

Per-site verdicts (line numbers at the dispatch base 844218f):

| Site | Verdict |
|---|---|
| `StudioDesignSurface.tsx:6884` object extension Save | pinned. The
load reads `/layers` at the pair BEFORE the draft and body reads
(version first, the server's own order), records it with
`recordPublished`, and the Save passes the guard's `publish`. A buffer
read at another package records `If-None-Match: *` at the pair. |
| `:8913` new flow create | `If-None-Match: *` through a new
`publishCreated` helper: a same-named flow another writer published
first is refused, never replaced. No dialog: the refusal is the create's
own. |
| `:9095` flow Save | pinned, same version-first load; the `/layers`
read is shared with the baseline read when they hit the same address.
Customize-into-pair branch records `*` at the pair. |
| `:9240` flow on/off switch | pinned through the same guard; a flip
over a flow another writer published is asked about. |
| `objectHooksBuffer.ts:365` hook Save | pinned. The list load reads
each listed hook's `/layers` at the package; a published hook with no
pending draft is buffered from that same answer when it pins, so pin and
body are one read. A new hook records `*`. |
| `pairObjectActions.ts:404` pair action Save | pinned from the same
`/layers` answer the buffer is already built from. A new row records
`*`. |

Every editor handles the `reloaded` outcome the way the object page does
(ruling 4): the Save is declined, the editor re-reads, its edits are
dropped. Keep editing leaves the edits unsaved with the refusal shown.
Dialog wording and locale keys from objectstack-ai#36601 are reused unchanged; no new
keys.

### The `hadDraft` reload residual (scope addition 7104420437)

Fix shape chosen: **keep the published pin the conflict was raised on
until the author re-confirms**, in the guard (`DraftConflictDialog.tsx`,
header rule 9). Why this one rather than "install the live row and leave
the pending draft under Changes":

- one place: the guard owns both pins, so the object page and all five
editors get it with no per-editor load change; the other shape needs
every load to learn a second install mode;
- the other shape would make the next Save write the live body over the
copilot's pending draft, which objectstack-ai#36511 forbids discarding;
- re-confirmation already exists: the dialog's overwrite (with its
confirm step) is it.

Mechanics: `beforeReload` now answers `kept` when the Save wrote into a
draft that was pending before it (`discarded` otherwise). On `kept`, the
reload's fresh `recordPublished` is parked instead of applied, and the
next publish still carries the version the conflict was raised on, so
the next Save is asked again. The hold ends on an overwrite, a publish
that lands, a load that reads no pending draft (`recordRead` with `*`),
or `forget`.

## Tests

New files, each named for this card (keep editing, reload, overwrite,
one editor's pins chain, create asserts `*`, unpinned control, plus the
residual pin):

- `ObjectHooksPanel.publishPinned-36726.test.tsx` (7)
- `DataPillar.pairActionsPublishPinned-36726.test.tsx` (7)
- `AutomationsPillar.publishPinned-36726.test.tsx` (incl. the switch)
- `DataPillar.extensionPublishPinned-36726.test.tsx`

Appended: the guard's rule 9 unit tests in
`DraftConflictDialog.test.tsx`; the object page's residual pin in
`StudioDesignSurface.draftVersionConflict-11773.test.tsx` (AGENTS.md
puts a new pin in the existing harness that already models that surface;
the dispatch asked for new files; I followed AGENTS.md for those two and
say so here).

Stale fixtures updated (the create/pair publish now asserts `*`):
`DataPillar.pairActions-30088`, `AutomationsPillar.saveCancel-36511`,
`AutomationsPillar.customizeFlow-28570`;
`StudioDesignSurface.expectedMisses-11799` (an unsaved flow now reads
`/layers` once, for its pin).

Ablation (implementation files restored to origin/main d9c799c, tests
kept; restored by `git checkout HEAD`, `git diff HEAD` empty, all five
blob hashes re-matched): 31 of 78 tests red across all 6 files, every
red is a race or residual pin, no control among them; 47 green including
each file's control.

## Acceptance notes

- Hooks and flows with a pending draft: the pin and the draft are read
in parallel/sequence, not in one read. A publish landing in that window
leaves the pin older than the buffer, so the next Save is asked; it can
never overwrite. Safe direction only.
- Hooks without a pending draft now take their body from the `/layers`
answer when it pins (exact pairing), from the list otherwise.
- Out of this card and NOT fixed (still unpinned, reported for the
seat): OWD overview Save (`PackageOwdOverviewPanel.tsx:487`), object
create (`StudioDesignSurface.tsx` ~6697), permission Save (~10962), new
app door (`newAppDoor.ts:72`).
- No contract change; no L2 contract review owed by this diff (ui only,
no spec/server/locale change).

## Verification

Two minutes: `pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/views/studio-design/ObjectHooksPanel.publishPinned-36726.test.tsx`
expect 7 passed.

Read first, by risk: `DraftConflictDialog.tsx` (rule 9 hold and
release), `objectHooksBuffer.ts` (per-hook `/layers` read and the buffer
source), `StudioDesignSurface.tsx` flow load (shared `/layers` read and
baseline).

Local readings at head 0b5e8f2: app-shell `type-check` exit 0 (both
tsconfigs); 6 card files 78/78 (per-file reruns after the last harness
fix); `studio-design/` + guard tests 374 files, 1 stale fixture red
(28570) then fixed and rerun 14/14; derived `dispatch-gates --commands`
families exit 0 (two long scans rerun with a longer timeout, exit 0);
`check:nul-bytes` OK. `test:repo` and the full farm are CI's.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
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

2 participants