Repository navigation
test(rest): drop the registrar-file list's length pins from six rest tests - #26518
Merged
Merged
Conversation
…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
Contributor
📓 Docs Drift CheckNothing 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): |
This was referenced Oct 27, 2026
Contributor
Author
席位核对ACCEPT · The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.
Generated by Claude Code |
9 tasks done
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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都会让六个文件同时变红,钉的是树的转录,不是不变量(维护者在退役检查清扫里「同意」)。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
REST_SERVER_REGISTRAR_FILESloseexpect(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.tsalso losesexpect(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 guardexpect(REST_SERVER_REGISTRAR_FILES.length).toBeGreaterThan(0). No other file goes vacuous on an empty list (measured below), so no other guard is added.[#26433]line. Thelength N → Mhistory 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(base45de8c6cba), rest's dependency closure built first (pnpm --filter '@objectstack/rest^...' build, lock VERDICT exit 0).Test Files 6 passed (6),Tests 223 passed | 18 skipped.pnpm --filter @objectstack/rest test(projectlocal):Test Files 324 passed (324),Tests 6483 passed | 326 skipped, VERDICT exit 0.pnpm --filter @objectstack/rest test:repo(projectrepo, which holdsrest-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 pluscheck:test-typecheckovertsconfig.test.json, which includes*.test.ts): VERDICT exit 0.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 mountRestServerfromsrc/by relative import, so nodist/sits on the path and no rebuild is owed per leg. Each ablation mutates a moved route module (notrest-server.ts), so it also proves the reader still reaches files off the list.ui-view-route-identity.measurement.test.tsif (this.enforceAuth(req, res, context)) return;inui-routes.tsenforceAuth— read off the mounted registrar…"ui-view-route-tenancy.measurement.test.tsenforceEnvironmentOwnership(...)line inui-routes.tsrest-server-canonical-query-ast.test.tswhere: { id: jobId }→filter: { id: jobId }indata-action-routes.tsqueryliteral spells a wire alias"rest-server-query-number-census.test.tsNumber(req.query.zzAbl)insearch-routes.tssites8 → 9)meta-draft-read-door-census.test.tsreq.query?.state === 'draft'insearch-routes.tsSITES8 loses nothing)rest-server-docblock-position.test.tsemail-routes.tsEvery leg:
ablation-replace: ok mutation landed: anchor 1 -> 0, thenok 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 andexport {};, no route body) appended toREST_SERVER_REGISTRAR_FILES, list length 19. All legs restored; finalgit diff HEADempty,git statusclean.Test Files 6 failed (6): each of the six reds on itstoHaveLength(18)lineTest Files 2 failed / 4 passed: identity, tenancy, query-number and meta-draft stay green.rest-server-canonical-query-astandrest-server-docblock-positionred because their per-file floor tables (REGISTRAR_QUERY_SLOT_FLOORS,MOVED_FILE_FLOORS) have no row for the new module0and1)Test Files 1 failed / 5 passed: onlyrest-server-docblock-position'sexpect(…minBlocks sum).toBe(70)redsSo 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. The70is a hand sum of the table beside it: see Acceptance notes.Empty list: no reader goes vacuous
REST_SERVER_REGISTRAR_FILESemptied 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/objectstackon 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).pnpm check:dual-build-cjs-loads, exit 3 PREREQUISITE NOT MET (needs every package'sdist/; only rest's closure is built here). CI runs it.eslint packages/rest --no-inline-configexit 0.pnpm lint, Test Core shards, the type-check lanes, dogfood (no!in the title, no(narrowing)arm).skip-changeset: tests only. Nothing underpackages/restthat ships infiles[]changes.Acceptance notes
packages/qa/dogfood/test/authz-conformance.test.ts:1646onorigin/mainb7f2b0c290(expect(REST_SERVER_REGISTRAR_FILES).toHaveLength(18); it sat at 1642 before PR test(dogfood): derive the authz probe reach from the route ledgers; retire the hand-written census #26491 landed in that file) isdomain:devx's; the seat files its child card.packages/rest/src/execctx-consumer-census.test.ts:848pinsexpect(SITE_FILES).toHaveLength(18), whereSITE_FILES = REST_SERVER_REGISTRAR_FILES(line 149). The card's acceptance grep does not see it. That file is 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's; it belongs on that card.rest-server-docblock-position.test.ts:301,expect(MOVED_FILES.reduce(…)).toBe(70)is the sum ofMOVED_FILE_FLOORSin the same file, and it is the one red left in the dry move once the new module has its floor row. Same family as ci(gates): retire the transcription pins — tests and gates that hold a hand-typed count or table equal to the tree and red on every unrelated move (parent of eight) #26431; left alone here because the ruling says nothing else changes.rest-server-registrar-files.ts:23-26still says each reader "pins the list'slength". After this PR that is true only of the dogfood copy and theexecctxalias above. The file is outside this card's file surface; whichever of those two cards removes the last pin should reword it.Generated by Claude Code