Skip to content

Codemod split: generate the rest of the metadata-protocol protocol.ts split with a deterministic script, verified byte-identical #29985

Open

Description

@objectstack-fleet

domain:devx#1 · os-support-ai · session_01WGufzgBDcBNVmSmo7VFHpj

Filing gate: ruling 6583399215 on #29465 (letter A, maintainer 「同意」 2026-11-02T17:11Z), whose exit stroke 6583664223 names one card per remaining file, filed into its lane by the domain:devx seat once the pilot #29520 merged. It merged as PR #29598 (d46b1ff23f, 2026-11-03T16:26Z). The maintainer asked for this programme first while the fleet is quiet: 「现在车队不忙,大文件分拆的问题是否可以优先」 (2026-11-03T22:37Z). ⛔ Not a claim. No grade: triage sets it and routes it.

Ruling-ref: 6583399215
Governs: the pilot rulings 6591753301 (A: value imports from the host file allowed, out-of-class top-level helpers move whole into leaf modules, a gate that scans the file by path widens in the same PR) and 6597555122 (A: a test or gate that reads the file by path gains the new modules in its reading list in the same PR; a .d.ts order-only difference is judged by ruling 6441032442 B's second normalisation), which the pilot carried to this card; the declaration-file bar of ruling 6348891160 on #25222; #24586 ruling A (6270097840); the landing plan 6582376616 on #29465.

Reader who acts: a domain:server seat (the file is packages/metadata-protocol), dispatching one dev.

What to build

  1. A deterministic codemod for packages/metadata-protocol/src/protocol.ts (23,135 lines on main c92b8872; class ObjectStackProtocolImplementation from line 777), modelled on the pilot's scripts/codemod-split-sql-driver.mjs. It applies the cut pattern the hand series [maintainer] refactor(metadata-protocol): split src/protocol.ts (33,065 lines, +10,169 in 30 days) along its ObjectStackProtocolImplementation seams, one move-only slice per PR #25467 already uses (87 protocol-*.ts section modules exist): whole sections' method bodies move to section modules, the class keeps one-line stubs, shared members are reached through the protocol host pattern, and the out-of-class top-level helpers move whole into leaf modules that never import back from protocol.ts.
  2. The script's own proofs, as the pilot ran them: byte-identity (undoing the split rebuilds the base file byte for byte), the declaration bar of ruling 6348891160 judged by 6441032442's second normalisation, determinism (two runs, same output), and every gate or test that reads protocol.ts by path widened to the new modules in the same PR (the pilot found check-tenant-chokepoint and a seam test this way).
  3. Type-check and the metadata-protocol suite plus its direct consumers at the base counts.

Order with #25467

#25467 (the hand series) stops cutting once this card is claimed (ruling 6583399215). The claiming seat writes that on #25467 in the same stroke.

How it lands (landing plan 6582376616)

  • Phase 0, no pause: build and prove the codemod and its generated split in a draft PR. Nothing else on the file stops.
  • Phase 1, a window the maintainer orders (「车队什么时候空闲是有我安排的」): seats land or park their open PRs on the file, the dev re-runs the script on the latest main (regenerated, ⛔ never rebased), CI runs once, the maintainer approves, and the PR enters the merge queue. The diff is over 3,000 lines, so it takes contract review, the final four-piece set and the maintainer's approval.
  • ⛔ The generated split is never hand-edited to pass. A proof that fails is reported as a fork on [Decision] Large source files: replace the hand-cut split with a script-generated split per file, so the remaining monoliths split in days, not months #29465 for a design ruling.

Done when

The draft PR holds the script and the generated split with every proof passing, and it has landed in the maintainer's window; or the fork is reported on #29465.

Re-measure: git show origin/main:packages/metadata-protocol/src/protocol.ts | wc -l; git log --since='7 days ago' --oneline origin/main -- packages/metadata-protocol/src/protocol.ts | wc -l.

Dedupe (open and closed): codemod, split in:title, 拆分, large file, 29465. Hits: #29465, #29520, #24586, #25467, #25522, #25521. None is a per-file codemod card for this file. New.

Activity

  1. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: first-touch audit · p2 · domain:server · pm:queue · 2026-11-03T22:53Z

    ⛔ Not a claim.


    Generated by Claude Code

  2. objectstack-fleet commented on Nov 3, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#6 · os-support-ai · session_01WGufzibcN9oHa8kDbTTnL5

    Claim: PM loop round 4
    Session: session_01WGufzgddMBbTQd9yVo4Yuz (dev: os-dev card thread; seat session_01WGufzibcN9oHa8kDbTTnL5)
    Account: os-support-ai
    Branch: claude/project-thread-w94e86 (harness-pinned thread branch; platform exception to claude/issue-<n>-<slug>)
    Worktree: the dev thread's own container checkout
    Domain: domain:server
    Seat: domain:server#6
    File surface: scripts/codemod-split-protocol.mjs (new, modelled on the pilot's scripts/codemod-split-sql-driver.mjs), the generated split of packages/metadata-protocol/src/protocol.ts into section and leaf modules, every by-path reader of protocol.ts widened (stop on breach; explain in the report)
    Container & model: L, mode:thread, model: TIER_DEFAULT (dispatch-gates --tier: no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the platform's own largest source file (protocol.ts, 23k lines) | the #25467 hand series, which stops cutting with this claim (ruling 6583399215) | every contributor and agent editing metadata-protocol``
    Thread-read: 6617555975
    Premise: holds (programme #29465 ruling A; pilot PR #29598 merged d46b1ff23f; triage 6617555975)
    Serial constraints cleared: none for Phase 0 (ruling: nothing else on the file stops; Phase 1 waits for the maintainer's window, when seats land or park their open PRs on the file)
    Stamp: 2026-11-03T23:46Z

  3. objectstack-fleet commented on Nov 4, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#6 · os-support-ai · session_01WGufzgddMBbTQd9yVo4Yuz
    os-dev-report

    Stamp: 2026-11-04T01:43Z

    Phase 0 of #29985 is up as draft PR #29998. Its head is 32c7bc04 and its base is 9049be26. The PR stays a draft.

    {
      "issue": 29985,
      "status": "done",
      "pr": 29998,
      "head_sha": "32c7bc04a",
      "base_sha": "9049be26ad6cbfbf9a87ee8fa0fd2666ead200fc",
      "readings": {
        "protocol_ts_lines": "23135 -> 15318",
        "methods_moved": "61/284 into 9 section modules",
        "byte_identity": "61/61 bodies; undo rebuilds base protocol.ts and protocol-host.ts (80 unread imports pruned, re-derived from head)",
        "determinism": "output tree sha256 af32bb253715742dca426de0417e7d3ccf91ba461c4b69637e2289756cdd6916 on two runs; regeneration equals the committed tree",
        "dts": "6441032442 B second normalisation EQUAL, surface EQUAL; raw differs by one union order; positive control caught",
        "typecheck": "base 0, head 0",
        "tests_metadata_protocol": "base 312 files 22339 passed 26 skipped; head 312 files 22340 passed 26 skipped",
        "test_repo": "core 94, objectql 5, spec 1524 passed",
        "durability_census": "base = head: 51 seams (9 propagating), 102 read seams (13 discriminated)",
        "lint": "exit 0",
        "dispatch_gates": "73 derived, 73 run, all exit 0; --ran 0 NOT-MEASURED 0 UNRUN"
      },
      "ablations": [
        "8 widened censuses: each fails at head on one renamed moved call / dropped await / changed argument / changed assert code",
        "codemod --verify exits 1 on a one-character hand edit in protocol-save.ts",
        "durability gate: removing each new host-call rule turns exactly its self-test row red"
      ],
      "open_questions": [
        "Line bar: protocol.ts ends at 15318, above the 13000 of 6591753301 item 3. What stays is E1's class-side docblocks and signatures plus 190 hand-series stubs; reaching 13000 needs a docblock or decomposition decision, not a codemod rule."
      ],
      "findings": [
        "protocol-packageless-overlay-migration.ts (hand series) has a repository.delete( on sys_metadata outside the #23198 stored-row census; the widened census reads only codemod modules so its population is unchanged"
      ]
    }
  4. objectstack-fleet commented on Nov 4, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#6 · os-support-ai · session_01WGufzgddMBbTQd9yVo4Yuz
    os-dev-report

    Stamp: 2026-11-04T08:25Z

    Ruling-ref: 6624345766

    The facade form of #29985 is on draft PR #29998, head bba9d24d. It was regenerated on main eee41490; main at 63b86b38 has not touched metadata-protocol since. The PR stays a draft. The new PR body, for the seat to apply with its trailer, is in the project files at issue-29985/pr-body-facade.md.

    {
      "issue": 29985,
      "status": "done",
      "pr": 29998,
      "head_sha": "bba9d24d79853f4ae24a0991d6faba94aa06a02c",
      "base_sha": "eee41490bc0613e36734599723c0a4bcb015ffb0",
      "ruling_ref": "6624345766",
      "readings": {
        "facade_lines": "protocol.ts 23135 -> 13647",
        "facets": "10 stateless classes, static methods taking the host: ProtocolClassHeadFacet 17, ProtocolDiscoveryAndBasesFacet 12, ProtocolDataCrudFacet 1, ProtocolSearchAndCacheFacet 1, ProtocolWriteGatesFacet 18, ProtocolRegistryHydrationFacet 14, ProtocolSaveFacet 4, ProtocolHistoryAndPublishFacet 5, ProtocolPackageCommitsFacet 9, ProtocolDiffDeleteLoadFacet 4 (85 members, 7 of them private statics)",
        "docblocks": "54 private docblocks moved with their bodies; every public docblock stays on the facade",
        "delegations": "85 to facets; 190 hand-series delegations unchanged (.call 162, plain 12, protocolHost 16)",
        "exceptions": "26 methods with a body plus the constructor and the static block (host factory): inferred-return-type getDiscovery 460, findData 751, getData 75, cloneData 105, saveMetaItem/publishMetaItem/rollbackMetaItem/deleteMetaItem 7 each; closed-set publishPackageDrafts 993, reconcileViewExpansions 53, packagelessOverlayWriteRefusal 14, namedBaseOverlayWriteRefusal 12; static-reads-class mergesOverlayAtRead, registryAllowsOverlay, isOverlayAllowed, isRuntimeCreateAllowed, codeOnlySourceHint, codeOnlyCreateError, codeOnlyOverrideError, refuseOrganizationScopedWrite, overlayPackageMismatchError; no-host-read rethrowUnlessMetadataStoreUnprovisioned, triggerAutomation; name-taken objectExtensionItemRefusal; host-entry-predicate packagedBaseRefusal; static-shape resetEnvWritableCache",
        "byte_identity": "85/85 bodies; checkMove 78/78 instance; verify unlifts the head to module form, then rebuilds base protocol.ts and protocol-host.ts byte for byte",
        "determinism": "output tree sha256 85bbdf726e8fbb750229627f744bb152aa79fcfa02d95b939885bbdf3430fe92 on two runs; regeneration reproduces the committed tree",
        "dts": "6624345766 item 1 via issue-29985/dts-public.mjs (sha256 211b3206…f5020): private members cut, then 6441032442 B: index.d.ts and index.d.cts normalised EQUAL, surface EQUAL; public-docblock control caught, private-drop control passes; facet classes absent from the .d.ts",
        "typecheck": "base 0, head 0",
        "tests_metadata_protocol": "base 312 files 22346 passed 26 skipped; head 312 files 22347 passed 26 skipped (+1 non-vacuity row, as before)",
        "test_repo": "core 94, objectql 5, spec 1539 passed",
        "durability_census": "base = head, byte-identical output: 51 seams (9 propagating), 102 read seams (13 discriminated)",
        "lint_build": "pnpm lint exit 0; pnpm build exit 0",
        "dispatch_gates": "73 derived, 73 run, all exit 0; --ran 0 NOT-MEASURED 0 UNRUN"
      },
      "ablations": [
        "unlift without its public-docblock check: the self-test case for a public docblock moved off the facade goes red",
        "durability gate without the facet-stub branch: its two new facet rows go red, and the real census drops 102 -> 99",
        "the facade battery fails on a one-character edit in a moved docblock, a stub calling another facet, an extra facet member and an unindented body line"
      ],
      "open_questions": [],
      "findings": [
        "The 190 hand-series stubs keep their docblocks on the class, because their modules are hand-written function modules, not facets. Measured: 157 of them are private and carry 4,017 docblock lines. Moving those into the hand modules is the same mechanism and would take the facade to about 9.8k lines (arithmetic on the measured count, not a generated run). It is left for the #30019 gate card or the state-owning-facets card."
      ],
      "mcp_calls": "0 GitHub writes through MCP (reads only)",
      "api_writes": "1: this os-dev-report via post-stamped; the PR body is the seat's issue_patch"
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions