Skip to content

test(rest): drop the registrar-file list's length pins from six rest tests - #26518

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-wlrxgo
Oct 27, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-wlrxgo

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread
Fixes #26433

Part of #26431

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:packages/rest 里六个测试文件删掉了「注册器文件清单长度 = 18」这条手抄断言(meta-draft-read-door-census.test.ts 顺带删掉 SITES = 8),只改测试,不发布任何东西。
  • 为什么改:清单本身就是权威;这条数字每次把一个路由模块拆出 rest-server.ts 都会让六个文件同时变红,钉的是树的转录,不是不变量(维护者在退役检查清扫里「同意」)。
  • 风险与回滚:只删断言,每个文件原本要抓的缺陷都做了一次消融,仍然变红;回滚就是 revert 这一个 commit。
  • 先看:meta-draft-read-door-census.test.ts(唯一加了防空守卫的文件)、rest-server-docblock-position.test.ts(还留着一个手算的楼层和 70,见 Acceptance notes)、rest-server-canonical-query-ast.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/rest exec vitest run src/meta-draft-read-door-census.test.ts src/rest-server-docblock-position.test.ts,预期 2 个文件全绿。
  • 需要你做的:无,席位落地。

What changes

  • Six readers of REST_SERVER_REGISTRAR_FILES lose expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(18): ui-view-route-identity.measurement.test.ts, ui-view-route-tenancy.measurement.test.ts, rest-server-canonical-query-ast.test.ts, rest-server-query-number-census.test.ts, meta-draft-read-door-census.test.ts, rest-server-docblock-position.test.ts. Each keeps iterating the list it imports.
  • meta-draft-read-door-census.test.ts also loses expect(SITES).toHaveLength(8): its first case ("the sites found are exactly the ledgered ones") already holds the sum as an exact set equality against the ledger. The case that held both pins is left with only a list-mirroring assertion, which passes on an empty list, so it gains the ruled anti-vacuity guard expect(REST_SERVER_REGISTRAR_FILES.length).toBeGreaterThan(0). No other file goes vacuous on an empty list (measured below), so no other guard is added.
  • Prose the deletion made false is corrected in place, nothing more: the four case titles that said "its length and … are pinned" now name only what is still pinned, the header sentences that said a case "pins the list's length" drop that clause, and each slice-history comment log gets one closing [#26433] line. The length N → M history entries stay as history.

Why

The list file's own header says it is ⛔ not a gate and that each reader stays the authority on what it counts. The length pin made every reader red on every registrar move, for a number nobody derives anything from (#26431's rule: a pin on something that already has an authority is retired, not loosened).

Tests

All runs on head 83cff86f77 (base 45de8c6cba), rest's dependency closure built first (pnpm --filter '@objectstack/rest^...' build, lock VERDICT exit 0).

  • The six files: Test Files 6 passed (6), Tests 223 passed | 18 skipped.
  • pnpm --filter @objectstack/rest test (project local): Test Files 324 passed (324), Tests 6483 passed | 326 skipped, VERDICT exit 0.
  • pnpm --filter @objectstack/rest test:repo (project repo, which holds rest-server-canonical-query-ast.test.ts): Test Files 5 passed (5), Tests 280 passed | 18 skipped, VERDICT exit 0.
  • pnpm --filter @objectstack/rest typecheck (tsc plus check:test-typecheck over tsconfig.test.json, which includes *.test.ts): VERDICT exit 0.
  • Acceptance grep: git grep -n "REGISTRAR_FILES).toHaveLength" -- packages/rest → no hit, exit 1.
Each file still reds on the defect it was written for (one ablation per file, via scripts/ablation-replace.mjs; every mutation landed and was restored to the HEAD blob)

The six tests read route sources as text from src/ or mount RestServer from src/ by relative import, so no dist/ sits on the path and no rebuild is owed per leg. Each ablation mutates a moved route module (not rest-server.ts), so it also proves the reader still reaches files off the list.

File Ablation (route module) Result
ui-view-route-identity.measurement.test.ts delete if (this.enforceAuth(req, res, context)) return; in ui-routes.ts 1 file failed: "the handler now calls enforceAuth — read off the mounted registrar…"
ui-view-route-tenancy.measurement.test.ts delete the enforceEnvironmentOwnership(...) line in ui-routes.ts 1 file failed, 11 cases, including "⭐ the registrar body itself carries the three steps" and "⭐ THE PIN"
rest-server-canonical-query-ast.test.ts where: { id: jobId } → filter: { id: jobId } in data-action-routes.ts 1 file failed: "no server-built query literal spells a wire alias"
rest-server-query-number-census.test.ts add a bare Number(req.query.zzAbl) in search-routes.ts 1 file failed: "no coercion is unclassified…" and the sum case (sites 8 → 9)
meta-draft-read-door-census.test.ts add req.query?.state === 'draft' in search-routes.ts 1 file failed: "the sites found are exactly the ledgered ones" (so dropping SITES 8 loses nothing)
rest-server-docblock-position.test.ts stack a TSDoc block above another in email-routes.ts 1 file failed: "binds every TSDoc block to a declaration — none is stacked above another"

Every leg: ablation-replace: ok mutation landed: anchor 1 -> 0, then ok restored: blob == HEAD … and git diff HEAD is empty. (In a first pass the tool refused five of the six legs before any test ran, because each anchor was a substring of its own replacement or was not deleted; the canonical leg ran in that pass and red as it does in the table. All six were rerun with non-overlapping anchors or --delete, and the table is that rerun.)

Dry move: a new registrar module appended to the list (the point of the change)

Probe: a new zz-dry-move-routes.ts (module header and export {};, no route body) appended to REST_SERVER_REGISTRAR_FILES, list length 19. All legs restored; final git diff HEAD empty, git status clean.

Leg Result
base test files (pins in) Test Files 6 failed (6): each of the six reds on its toHaveLength(18) line
this head Test Files 2 failed / 4 passed: identity, tenancy, query-number and meta-draft stay green. rest-server-canonical-query-ast and rest-server-docblock-position red because their per-file floor tables (REGISTRAR_QUERY_SLOT_FLOORS, MOVED_FILE_FLOORS) have no row for the new module
this head plus the two floor rows the module would owe (0 and 1) Test Files 1 failed / 5 passed: only rest-server-docblock-position's expect(…minBlocks sum).toBe(70) reds

So on this head a new module costs the list file plus its own floor row in two tables, plus the docblock file's 70. The floor rows are per-file measurements the two censuses ask for by design ("a file the split adds to the list needs a floor here before this census reads it"), not length transcriptions, and the ruling keeps them. The 70 is a hand sum of the table beside it: see Acceptance notes.

Empty list: no reader goes vacuous

REST_SERVER_REGISTRAR_FILES emptied in place (].filter(() => false);), restored after: Test Files 6 failed (6), 11 cases. Each file reds on an assertion it already had (identity and tenancy on the over-40 call counts, canonical on the floors' keys and the slot sum, query-number on its sum and positive control, docblock on the floors' keys), and meta-draft's list case reds on the new guard (meta-draft-read-door-census.test.ts:291).

Verification

Local gate subset: 49 derived, 48 run exit 0, 1 NOT MEASURED

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack on this diff named 49 commands; each was run with its exit code captured before any pipe, then reconciled with --ran: ✓ dispatch-gates --ran: 49 derived famil(ies) accounted for — 48 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).

  • NOT MEASURED: pnpm check:dual-build-cjs-loads, exit 3 PREREQUISITE NOT MET (needs every package's dist/; only rest's closure is built here). CI runs it.
  • Lint scoped to the touched package: eslint packages/rest --no-inline-config exit 0.
  • Not run locally, CI's: the repo-wide pnpm lint, Test Core shards, the type-check lanes, dogfood (no ! in the title, no (narrowing) arm).

skip-changeset: tests only. Nothing under packages/rest that ships in files[] changes.

Acceptance notes


Generated by Claude Code

…tests

Each reader keeps iterating REST_SERVER_REGISTRAR_FILES; the list is the
authority on its own length. meta-draft-read-door-census also drops its
SITES 8 pin (its first case's ledger equality holds the sum) and gains
an anti-vacuity guard on the list in the case left with only a
list-mirroring assertion.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSKhKswuL33xRZZ3g
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs.

What this run could not see

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · domain:server seat 2 · os-project-manager · session_0186vfjHHMsRXC9EUT9hTFMo · 2026-10-27T06:42Z · head 83cff86f77 · #26433

The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.

  1. Shape: a draft against main, opened by the relay with assignee os-project-manager and skip-changeset (tests only). The body carries Fixes #26433, Part of #26431, Clause-②: no and Metadata-protocol: none, all line-initial. check-governed-merges --pr 26518 reads NOT governed, 42 changed lines. No contract face is touched, so no at-tier review is owed. The card's newest claim (6434734809) names this PR's branch.
  2. Diff against the order: the seat read the whole diff (6 files, +22 / −20).
    • Each of the six files loses exactly one expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(18).
    • meta-draft-read-door-census.test.ts also loses expect(SITES).toHaveLength(8) and gains the ruled guard expect(REST_SERVER_REGISTRAR_FILES.length).toBeGreaterThan(0). Its first case's exact set equality against the ledger still holds the sum, and the body's ablation shows that case red.
    • The rest is prose the deletion made false: four case titles, four header sentences and one [#26433] line per slice log. No assertion is changed beyond the ruled ones.
    • The acceptance grep git grep -n "REGISTRAR_FILES).toHaveLength" -- packages/rest returns 0 on the head.
  3. Not weakened: the body holds one ablation per file, each red on the defect the file was written for and restored to the HEAD blob. The dry move (a 19th module appended) shows that identity, tenancy, query-number and meta-draft stay green. Canonical-query-ast and docblock-position still ask for their per-file floor rows, which is by design and kept by the ruling. With the list emptied, every file reds, so none goes vacuous.
  4. Overlap: none. No other open PR touches these six files (seat's read of every open PR's file list at this stamp). test(rest): execctx-consumer-census derives its structural reading from the tree instead of hand counts #26520 (test(rest): execctx-consumer-census.test.ts hand-counts 62 sites / 145 mentions / 16-46-12 catch shapes and is re-typed on every split slice — derive the census or retire the measurement file #26436) edits only execctx-consumer-census.test.ts.
  5. Gates: at this stamp every check-run on the head reads success or skipped; none reads failed or in progress. Locally the dev reports:
    • 49 derived gates: 48 exit 0, with check:dual-build-cjs-loads not measured (prerequisite; CI's full build covers it);
    • rest 324 / 324 files, test:repo 5 / 5, typecheck and scoped lint green.
  6. Out of scope, filed:

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 27, 2026 06:42
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 27, 2026 06:42
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 347adbd Oct 27, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-wlrxgo branch October 27, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(rest): the registrar-file list's length is pinned as toHaveLength(18) in seven test files — drop the seven length pins, the list is the authority

2 participants