Repository navigation
refactor(metadata-protocol): move the publish backfill pair and the draft pair out of protocol.ts into protocol-publish-backfill.ts and protocol-drafts.ts (#25467 cut 12) - #25939
Conversation
…raft pair out of protocol.ts (#25467 cut 12) Move-only. The bodies of planPublishBackfill and applyPublishBackfill move into the new protocol-publish-backfill.ts, and the bodies of listDrafts and discardDraftInItsScope into the new protocol-drafts.ts (host shape B: an `engine` getter and protocol-bound closures for getOverlayRepo, updateManyData, ensureOverlayIndex and deleteMetaItem). Every member keeps its name, docblock and signature in the class as a stub that delegates. The module-level declarations the bodies read gain `export` in place; discriminateDefaultValueShape leaves protocol.ts' import with its last reader. index.ts names its exports one by one, so the published surface does not move. Claude-Session: https://claude.ai/code/session_016SP1spj613tyGCgxoD1An6 Co-authored-by: Claude <noreply@anthropic.com>
…h backfill pair's throw sites (#25467 cut 12) applyPublishBackfill's three `new Error(` moved with its body into protocol-publish-backfill.ts, so the scan gains that module's row with its own count as the floor, as cuts 1, 3, 5, 6, 7 and 10 added theirs. Claude-Session: https://claude.ai/code/session_016SP1spj613tyGCgxoD1An6 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 11 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 4e7f3f8bfa19f7ce4ae17f734eecc857b0a5b419 && git checkout 4e7f3f8bfa19f7ce4ae17f734eecc857b0a5b419
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2a728ba2acf52c13d1918c2afca7b79bf391e1f5 d6e35b431af981bfba988365f69cfbfdd34d8893 && git checkout -B drift-repro 2a728ba2acf52c13d1918c2afca7b79bf391e1f5 && git merge --no-ff d6e35b431af981bfba988365f69cfbfdd34d8893
node scripts/docs-audit/affected-docs.mjs --json 2a728ba2acf52c13d1918c2afca7b79bf391e1f5
|
席位核对 · ACCEPT ·
|
| item | reading |
|---|---|
| Shape | draft, base main, Part of #25467 (no closing keyword), skip-changeset label, Clause-②: no line-initial. |
| Files (4, +401/−183) | protocol.ts, the new protocol-publish-backfill.ts and protocol-drafts.ts (two families that share nothing), and the PRODUCERS row in protocol.bracketed-refusal-opener-absence.test.ts ('protocol-publish-backfill.ts': 3): exactly the claim's surface. No packages/spec/**, no docs/adr/**. Not governed (check-governed-merges --pr 25939), 584 changed lines, inside the order's 900-line split threshold. |
| Move-only | report's AST proof: 1,824 leaf tokens, 0 differ; one-token negative control reads DIFFERENT. Seat's own read on the diff: the four class members keep name, docblock and signature; each is a host literal plus .call — engine as a live getter, protocol-bound closures for getOverlayRepo, ensureOverlayIndex, updateManyData, deleteMetaItem. The stay list (runPublishSideEffects, promoteDraftForPublish, publishPackageDrafts, discardPackageDrafts) is untouched. |
| Exports | module-level helpers the bodies read (isItemOfDisabledPackage, PublishBackfillEntry, PublishBackfillReceipt, PUBLISH_BACKFILL_PAGE_SIZE, publishBackfillRefusal, bundleMemberDiscriminator, clientFacingFailureCode) gain export in place (cut 8/11 precedent); the published export table is unchanged (78 names both ends). |
.d.ts |
raw byte-identical at base and head (325970c1…), before and after the dev's one main merge. Ruling 6348891160 holds. |
| Gates | 59/59 derived exit 0 on the merged tree, --ran 0 NOT-MEASURED; package suite 0 lost / 0 changed / +1 (the new PRODUCERS row; its TypeError control reds). Decision-letter citations 1,847 → 1,846 (listDrafts' [ADR-0131 D6] comment left the anchored file; no anchor entry owed, as cut 8). CI at this act: in progress. |
| Landing | ready + auto-merge through the relay once every check on this head is green or an expected skip. Cut 13 (packaged-base door refusals, ~250–320 lines, per the report) is the next claim. |
Generated by Claude Code
Requested by Leehom · project thread
Part of #25467
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6270097840
Cut 12 of the
protocol.tssplit (#24586 ruling A, recorded in6270097840). Cuts 1–11 landed as #25494, #25518, #25538, #25589, #25601, #25623, #25642, #25719, #25731, #25740 and #25797. The claim is6407710285; the scope is the cut 12 proposal of the cut 11 report (6397905786), as the server seat approved it in its dispatch order.Four
ObjectStackProtocolImplementationmembers move unedited into two new modules (#23050 shape B, oneenginegetter each), one per family, because the two families share no helper and no member:packages/metadata-protocol/src/protocol-publish-backfill.ts: the publish backfill pair,planPublishBackfillandapplyPublishBackfill.packages/metadata-protocol/src/protocol-drafts.ts: the draft pair,listDrafts(public) anddiscardDraftInItsScope.protocol.tsloses 146 net lines (29,769 to 29,623). The cut is move-only, and the card stays open for later cuts.Branch
claude/project-thread-ybjm3his the harness-pinned branch for this thread. It names no issue, so the claim comment is the identity record. It holds the move commit31ecbf1a, the pin commit6d1256e1, both onmaincb0a2fcf4f(cut 11's merge4893a2fb2cis in its history), and the merge ofmainf00e8d5c3c(d6e35b43). That merge brought one commit (#25830) that touches no file ofpackages/metadata-protocol/(the package'ssrc/tree is980b4345at bothcb0a2fcf4fandf00e8d5c3c).Serial with the file's in-flight PRs. Measured just before this PR was opened: of the 9 open PRs, two touch
packages/metadata-protocol/src/. #25813 editsseed-loader.tsand its test, disjoint. #25826 has oneprotocol.tshunk, at lines 9021–9060, textually disjoint from this cut's hunks (the imports near the top, seven module-level declarations above line 4000, and the class between lines 23440 and 24900); whichever lands second mergesmain.What moves
listDrafts:23440protocol-drafts.tsplanPublishBackfill:23651protocol-publish-backfill.tsapplyPublishBackfill:23743protocol-publish-backfill.tsdiscardDraftInItsScope:24875protocol-drafts.tsThe shape (#23050 shape B, as cuts 1–11 apply it)
listDraftskeeps its declared public return type. Each body is now one host literal plus a.call, marked[#25467 cut 12].PublishBackfillHostandDraftsHosttype every member as the class member itself (an indexed access onObjectStackProtocolImplementation). Each moved function types itsthisas thePickof its module's host over exactly the members its body reads. Each stub annotates its literal asThisParameterTypeoftypeof fn. No cast, no generic member (so the plain.callspelling of cuts 1–10), and no member changes visibility.planPublishBackfillreadsengineandgetOverlayRepo;applyPublishBackfillreadsengineandupdateManyData;listDraftsreadsengine,ensureOverlayIndexandgetOverlayRepo;discardDraftInItsScopereadsdeleteMetaItem.enginegoes as a GETTER, so the read happens when the body makes it (tests replace it on a constructed protocol); each method goes as a closure on the protocol. No private-static member is read, and nothing on the Release's stay list moves:runPublishSideEffects,promoteDraftForPublish,publishPackageDraftsanddiscardPackageDraftsstay in the class. The order's hypotheses hold.publishPackageDraftscalls the backfill pair; the_draftsdoors calllistDrafts;discardPackageDraftsandrevertStoredPackagecalldiscardDraftInItsScope.Module-level declarations, by reader
export, none moves. The bodies readcanonicalMetaType,clientFacingFailureTextand the interfaceMetadataIssueEntry(already exported), plus seven declarations that gainexportin place, as cuts 8 and 11 did:isItemOfDisabledPackage,bundleMemberDiscriminator,clientFacingFailureCode,publishBackfillRefusal,PUBLISH_BACKFILL_PAGE_SIZE, and the typesPublishBackfillEntryandPublishBackfillReceipt. Six of the seven keep readers inprotocol.ts(the two types are named by the stubs' own signatures;publishBackfillRefusalis thrown byreadPublishBackfillRequesttoo).PUBLISH_BACKFILL_PAGE_SIZEhas no reader left inprotocol.ts; it stays with its family's declarations (see Acceptance notes). The new modules import them fromprotocol.js; the cycle is evaluation-safe because each is read only inside a function body.index.tsnames what it publishes fromprotocol.tsone by one, so the published surface does not move (measured below).protocol.ts. One import loses its last reader and is dropped:discriminateDefaultValueShapefrom@objectstack/spec/data(2 occurrences at base, the import andplanPublishBackfill's call). The new modules import it,DroppedFieldsEvent,UpdateManyDataRequest,PLURAL_TO_SINGULARandI18nLabelfrom the same spec subpaths. The two new statements are the imports of the new modules.The published
.d.tsThe series bar is ruling
6348891160, sorted-union identity, measured first. Base and head were built withpnpm --filter @objectstack/metadata-protocol buildagainst one dependency tree (the closure built at head, then the package'ssrc/swapped tree-only to base for the base build and restored fromHEADunder a trap;git diff HEADempty,git statusclean and all four touched blobs equal toHEAD's after). Measured twice: before the merge (basecb0a2fcf4f, head6d1256e1) and after it (merged base, headd6e35b43, closure rebuilt with a fullpnpm build, 119/119).325970c1661efaa6a3762ce7de9e6bb205ea16099784f2b6c5950d62d175b331at base and at head, on bothdist/index.d.tsanddist/index.d.cts, 772,838 bytes each, in both measurements (the hash cuts 8–11 reported). Raw identity holds, so sorted-union identity holds too. The three private members stayprivate NAME;lines;listDraftsprints its declared signature unchanged.aa05995b9d9a32f69b3416eac92ef86b46d79593001a37bf1bb529ed7a9f8952at both ends (80 string-literal union runs sorted; this run's own normaliser, so the hash is not comparable with cut 11's).index.jshashesbbe1a227b80604e0…at base (cut 11's head hash) and066b577863ed02f0…at head; each of the four functions'.call(hostsites occurs 0 times in the base bundles and once in the head bundles (ESM and CJS alike).HEADunder a trap, hash equal toHEAD's after):privatedropped fromdiscardDraftInItsScopeand the package rebuilt. Both.d.tsfiles move tod0a5c1ec3071d8c8…and print the member's full signature, its parameter docblock included, so the bar can see a change on these members.9f18a0177ac736ed…on all of them. None of the moved functions, the two host types or the seven newly exported declarations appears.No changeset:
skip-changeset, per ruling6348891160.Proof of move-only
this, return type and body): 1,824 tokens compared, 0 differ. The parameter, return-type and body text, comments included, is also equal with whitespace collapsed, for all four. Negative control: one changed token inapplyPublishBackfill's body (ids.length === 0toids.length !== 0, on an in-memory copy) makes the check reportdiffer=1on that member and 0 on the other three.protocol.ts. 231 of the 239 base statements other than the class are byte-identical, leading comments included. Of the other eight, seven gain theexportkeyword and nothing else, and one is the@objectstack/spec/dataimport, which loses thediscriminateDefaultValueShapeline. Head adds two statements, the new modules' imports.protocol-publish-backfill.tshas 239 lines,protocol-drafts.ts122.Readers of the moved lines
Every test and script that reads
protocol.tsby path (20 files), and every test file inpackages/andscripts/, was grepped for the four member names and for the seven declarations that gainedexport.protocol.tsthe namesplanPublishBackfill,applyPublishBackfill,discardDraftInItsScope,publishBackfillRefusal,PUBLISH_BACKFILL_PAGE_SIZEandPublishBackfillEntryoccur nowhere butCHANGELOG.mdentries;PublishBackfillReceiptalso names an unrelated local type inui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx.listDraftsis a public verb the tests call through the protocol, not by path.protocol.read-verb-canonical-fold.test.tsscansprotocol.tsfor request-taking verbs whose requiredtypeis folded;listDraftstakes an optionaltype?filter and is out of that population by the pin's own rule, and its signature line stays in place. Green, list unchanged.PRODUCERS):applyPublishBackfill's threenew Error(move with its body, so the new module gets a row,'protocol-publish-backfill.ts': 3, the module's own count, beside the rows cuts 1, 3, 5, 6, 7 and 10 added.protocol.tsgoes from 74 to 71 such sites, still above its floor of 5;protocol-drafts.tshas none and gets no row. Control: with the first of the module's throws changed tonew TypeError((on disk, restored fromHEADunder a trap, hash equal toHEAD's after), the new row fails with "protocol-publish-backfill.ts no longer constructs errors here — this pin is scanning the wrong file: expected 2 to be greater than or equal to 3" (1 failed, 13 passed); restored, 14/14 pass. (The control's first attempt matched no anchor and changed nothing, so it is not counted; the run above is the second, with its on-disk counts read before the test: 2new Error(, 1new TypeError(.)check-adr-anchorsexits 0 at both ends: 85 anchored files, 58,830 citations, 1,847 → 1,846 decision-letter citations, files 8,247 → 8,248. The one letter citation that leaves the anchored surface islistDrafts' body comment[ADR-0131 D6] The environment's pending drafts., now inprotocol-drafts.ts(protocol.tscites ADR-0131 D6 118 times at base, 117 at head). Theprotocol.tsanchor entry does not cover ADR-0131, and no moved body is the mechanism of any entry paragraph, so the new modules get no entry (disclosure only, as cut 8 disclosed its ADR-0090 D11 citation).check-durability-degradation-log-levelexits 0 at both ends with identical output. In its--list(lines stripped of[@:][0-9]+), the one difference is the file of the read seamguards find() in applyPublishBackfill() → no invented answer, listed underprotocol.tsat base and underprotocol-publish-backfill.tsat head; its verdict is unchanged.check-engine-double-contract): exits 0 at both ends. TheupdateData/deleteDataseams keep their entries at new line numbers (14022 → 14025, 14047 → 14050).productionFilesis 3,701 at base and 3,704 at head: +2 are the new files, +1 is the gitignoredpackages/spec/src/migrations/registry.ts, which the spec build writes in the head tree and the clean base tree had not built.check-adr-symbol-anchors,check-system-context-census,check-tenant-audit-census,check-query-options-erasure-ratchet,check-filter-alias-parity.check-nul-bytesdiffers only in the scanned file count, +2. The base-end readings were taken in a clean detached worktree atcb0a2fcf4f.check-platform-checklist --changed-from origin/main: OK, 1 anchored file in the change set, 29 anchors judged, 0 lost.check-governed-merges --branch claude/project-thread-ybjm3h: 0 of 4 paths hit the register, NOT governed; 584 changed lines, under the 3,000-line human-merge bar.Verification
All at head
d6e35b43unless stated.tsc --noEmitinpackages/metadata-protocolexits 0, before and after the merge.pnpm exec eslint --no-inline-config packages/metadata-protocol(the whole touched package) exits 0, no output.packages/metadata-protocolsuite, base and head, compared per test name and status (vitest--maxWorkers=2, JSON reporter, each run under the shared verify lock,VERDICT command-exit 0both legs), on the pre-merge tree (the merge changed no file of the package):cb0a2fcf4f: 21,509 tests (21,490 passed, 0 failed, 19 skipped), 266 files.6d1256e1: 21,510 tests (21,491 passed, 0 failed, 19 skipped), 266 files.PRODUCERSrow's case. The base leg is the packagesrc/swapped tree-only fromcb0a2fcf4f(the new modules removed from the tree) and restored fromHEADunder a trap.dispatch-gates --commands --repo objectstack-ai/objectstackderives 59 gates on 4 changed paths, the same list before and after the merge; all 59 exit 0 on the merged tree, after a fullpnpm build(119/119,VERDICT command-exit 0) and with the plugin-teardown fixture commit fetched first.dispatch-gates --ran: 59 derived, 59 run, 0 NOT-MEASURED, 0 UNRUN, exit 0.Acceptance notes
PUBLISH_BACKFILL_PAGE_SIZEnow has its only reader inprotocol-publish-backfill.ts(it had no other reader at base either). It stays inprotocol.tsbeside the other[#24253]backfill declarations, whose remaining readers (readPublishBackfillRequest,publishPackageDrafts) did not move; a later cut that moves the request judgement and the receipt types could take the family whole.listDrafts'[ADR-0131 D6]comment now sits in an unanchored module (see Readers above); the anchor file never named ADR-0131, so nothing that guarded it before stops guarding it.Carry-forward
Unchanged from cut 11: public members whose return type is inferred, the bodies kept by a reader (
probeRecord,getMetaItemCached,findReferencesToMeta,packagelessAddress,refuseUnmintableMetaType,metaTypeNamespaceExists,viewContainerNameCollisionRefusalwithoverlaidShippedContainerViewNames,reportPageRequiresAbsentAtLoad, the 7applyRegistryWriteThroughcallers,readCodeLayerForCarryForward), and the private-static readers stay inprotocol.ts; this cut addsrunPublishSideEffects,promoteDraftForPublish,publishPackageDraftsanddiscardPackageDraftsto that list, for the reasons the cut 11 report gave.Generated by Claude Code