Skip to content

feat(gates): a line ceiling on every file already in facade form - #34103

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/area-E1-33949-ceiling
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/area-E1-33949-ceiling

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Part of #33949. This PR is ruling item 2 (the narrow line ceiling). Item 1 (eight codemod splits, one at a time) stays open on the card, and split 1 (objectql registry.ts) follows as its own PR.

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:给已拆成 facade 形态的 3 个文件(protocol.ts、objectql engine.ts、sql-driver.ts)加了行数上限,上限 = 今天 main 上的行数 + 100;门禁复用现有的 check:facade-delegation-only,没有新脚本、没有新 workflow。
  • 为什么改:落实 [Decision] next codemod splits for the large hot files, in order, and whether to name a shrink-only line ceiling (hot-file card F) #33949 裁决第 2 条「窄形式上限」。拆过的文件近 5 天又长了 150 到 180 行,没有上限就会重新长回热点文件。
  • 风险与回滚:只改了门禁脚本和它的登记表,不发布任何包。超限时是 CI 报错,不改运行时行为。回滚就是 revert 本 PR。
  • 先看:scripts/facade-delegation-registry.json 的 ceilings 三行(数字);再看 scripts/check-facade-delegation-only.mjs 里的 CEILING_MARGIN(为什么是 100)和 checkCeilings。
  • 两分钟验证:node scripts/check-facade-delegation-only.mjs,预期最后几行显示每个文件「11605 lines, ceiling 11705 (100 left)」这样的余量,退出码 0。
  • 需要你做的:无,席位落地。

What changes

scripts/check-facade-delegation-only.mjs reads a third list in scripts/facade-delegation-registry.json, ceilings, one row per registered facade FILE:

file baseLines @ 63db724 maxLines
packages/metadata-protocol/src/protocol.ts 11,605 11,705
packages/objectql/src/engine.ts 6,754 6,854
packages/drivers/driver-sql/src/sql-driver.ts 9,971 10,071

Each row is { file, baseLines, baseCommit, maxLines, ruling }. The gate refuses:

  • a facade file over its maxLines. The message tells the author to put the new code in a new module, and says raising a ceiling is maintainer-only: it needs a maintainer ruling, cited as the row's ruling, with baseLines and baseCommit re-measured;
  • a registered facade file with no ceiling row, so the PR that registers the next facade sets its ceiling in the same edit;
  • a ceiling on a file that is not a registered facade. The ruling: a file not yet split takes no ceiling;
  • maxLines outside baseLines to baseLines + CEILING_MARGIN. A ceiling is the measured count plus the margin, never a number picked to fit;
  • a malformed field, an unknown key, or two rows for one file.

The margin is 100 lines, flat (CEILING_MARGIN). Two readings on 63db724 set it:

One number fits every file because the growth comes per member (a stub plus its docblock), not in proportion to the file's size.

There is no new script, workflow or package.json chain. CI already runs pnpm check:facade-delegation-only (--self-test, then the gate) in Lint & Repo Gates, step facade-delegation-only.

Tests

The self-test grows from 38 to 44 batteries (SELF_TEST_BATTERY_FLOOR 38 to 44):

  • C1: over the ceiling is RED. The test checks the count and the overage, the new-module fix line and the ⛔ MAINTAINER-ONLY raise wording.
  • C2: at the ceiling is GREEN, with or without a last newline, and the count is reported.
  • C3: no ceiling row is RED.
  • C4: a ceiling on an unsplit file is RED.
  • C5: above base plus margin, or below base, is RED.
  • C6: a bad count, commit or ruling, an unknown key, a duplicate row, or a registry with no ceilings array is RED.

Existing fixtures get a roomy ceiling by default, so the H/A/E/N rows still judge delegation alone.

Ablation (each leg through scripts/ablation-replace.mjs, restore proven blob == HEAD, `git diff HEAD` empty)
anchor  if (wellFormed && lines > row.maxLines) {
  ->    if (wellFormed && lines > row.maxLines && false) {
  ok mutation landed: anchor 1 -> 0, blob 5ea49241332d -> 957d6dcf8e4e
  ✗ C1 a facade file over its line ceiling → RED telling the author to use a new module, raising MAINTAINER-ONLY
  ok restored: blob == HEAD (5ea49241332d)

anchor  if (byFile.has(file)) continue;
  ->    if (byFile.has(file) || true) continue;
  ok mutation landed: anchor 1 -> 0, blob 5ea49241332d -> 456d3858653f
  ✗ C3 a registered facade file with no ceiling row → RED
      expected a problem matching /^pkg\/src\/facade\.ts registered as a facade but carries no line ceiling/, got []
  ok restored: blob == HEAD (5ea49241332d)

anchor  if (!classesOfFile.has(row.file)) {
  ->    if (false) {
  ok mutation landed: anchor 1 -> 0, blob 5ea49241332d -> e075b61ce296
  ✗ C4 a ceiling on a file that is not a registered facade → RED (a file not yet split takes none)
  ok restored: blob == HEAD (5ea49241332d)

anchor  (row.maxLines < row.baseLines || row.maxLines > row.baseLines + CEILING_MARGIN)) {
  ->    (row.maxLines < row.baseLines)) {
  ok mutation landed: anchor 1 -> 0, blob 5ea49241332d -> 56eae464ba7a
  ✗ C5 a ceiling above its base plus the margin, or below its base → RED
  ok restored: blob == HEAD (5ea49241332d)

The first C3 attempt used the replacement continue;, which is a substring of the anchor. The tool refused it as a no-op ("the replacement count moved 15 -> 15, a rise of 0, not the declared 1"). It was re-run with a replacement unique in the file.

The real files against a lowered ceiling (scratch registry, protocol.ts maxLines 11604)
✗ check-facade-delegation-only: 1 problem(s). A registered facade keeps delegations only (ruling 6624258595 item 3) and stays within its line ceiling (ruling 6897467376 item 2).

  ✗ packages/metadata-protocol/src/protocol.ts is 11605 lines, over its line ceiling of 11604 by 1 (measured 11600 at 63db7240aa, plus the margin; ruling 6897467376).
    fix: a file in facade form does not grow: put the new code in a new module (a facet file beside the facade, or a module of its own) and import it from there, instead of adding lines here. Raising a ceiling is ⛔ MAINTAINER-ONLY: it needs a maintainer ruling (ruling 6897467376 item 2), recorded in the row as its `ruling`, with `baseLines` and `baseCommit` re-measured.
exit 1

Acceptance notes

  • Days to the ceiling. At the measured regrowth (about 35 lines a day on protocol.ts and about 31 on engine.ts), the first ceiling is reached in about three days. That is the ruling working as written: new code goes to a new module, or the maintainer raises the ceiling. Seats adding facade members should expect to see it soon.
  • Workflow comment. The lint.yml comment above the facade-delegation-only step describes the delegation rule only. It is left untouched because workflows are a governed surface outside this PR's file surface. The script header is the authority, and it now documents the ceiling.
  • Split 1. Split 1 (packages/objectql/src/registry.ts) registers its facade with its post-split ceiling in its own PR, as the header now requires.

Verification

Head cfb690a278 (the branch merged with origin/main 27c2f1ea32); every reading below is from that tree.

Local gates (dispatch-gates derivation, 31 families, each exit code captured before any pipe)
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran ran.txt
✓ dispatch-gates --ran: 31 derived famil(ies) accounted for — 31 run, 0 NOT-MEASURED (a DERIVED zero — all 31 recorded an exit code and none of them is 3).

exit 0 for every derived command, among them:
  pnpm check:facade-delegation-only            (self-test 44 cases pass; 3 files within their line ceiling)
  pnpm check:ratchet-remedy-authority          (286 scripts swept; 14 mark the expanding remedy ⛔ MAINTAINER-ONLY)
  pnpm check:watch-hint-literal, check:nul-bytes, check:parse-guard, check:entry-guard, check:scripts-symbol-anchors
  pnpm check:pm-dispatch-gates                 (fast tier: 2205 cases pass, 352.7s)
pnpm lint                                      exit 0

No changeset: the diff is scripts/** only, which ships in no package's files[], so it is labelled skip-changeset.


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ

check-facade-delegation-only now reads a third registry list, `ceilings`:
one row per registered facade file with its measured line count, the
commit it was measured on, the ceiling (count + CEILING_MARGIN = 100) and
the ruling record that set it. Over the ceiling is an error telling the
author to put new code in a new module; raising a ceiling is
maintainer-only. A file not in facade form takes no ceiling.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review claim · head cfb690a · 2026-11-16T04:05Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review — PASS

Head-sha: cfb690a278522940537ff3dc695dec3691ab1c8f
Area: S4 / E1 · Part of #33949 (ruling 6897467376 item 2) · L1, the ordinary ACCEPT read per review-checklist.md. There is no contract face: the diff is scripts/** only, with Clause-②: no, Metadata-protocol: none and the skip-changeset label.

  1. The ruling's narrow form, as written. The ceiling lives in the existing check:facade-delegation-only gate as a third registry list. There is no new script, workflow or package.json chain, and CI already runs --self-test, then the gate, in Lint & Repo Gates. It applies only to files already in facade form: a row on an unregistered file is RED, so a file not yet split takes no ceiling. A registered facade with no row is also RED, so the next facade's PR (split 1, registry.ts) must set its ceiling in the same edit.
  2. The logic, read on the tree (checkCeilings).
    • Each row is checked for unknown keys, a duplicate file, positive-integer baseLines / maxLines, the baseCommit hex form and the ruling id.
    • maxLines must lie in [baseLines, baseLines + CEILING_MARGIN], so a ceiling cannot be picked to fit.
    • The line test runs only on a well-formed row, so a malformed row reports its own fault and not a second, misleading overage.
    • countLines matches wc -l with or without a final newline, and C2 pins that.
    • The registry shape check now requires the ceilings array.
  3. The remedy wording. The over-ceiling refusal says to put new code in a new module and marks raising a ceiling as ⛔ MAINTAINER-ONLY (a ruling cited in the row, with base re-measured). That matches the ruling, and check:ratchet-remedy-authority passes on it.
  4. The numbers hold on current main. The three rows are protocol.ts 11,605 → 11,705, engine.ts 6,754 → 6,854 and sql-driver.ts 9,971 → 10,071, each measured at 63db7240aa. I re-counted on origin/main 01598d936f: protocol.ts is 11,614 (91 left), engine.ts 6,783 (71 left) and sql-driver.ts 9,971 (100 left). The queued tree passes, and the in-flight PRs the body measured (+25 on engine.ts at most) still fit. baseLines now trails main by 9 and 29 lines. That is fine: the base records when the ceiling was set and is re-measured only when a ruling raises it.
  5. Tests. The self-test floor rises from 38 to 44, with C1–C6 covering over, at, missing, unsplit, out-of-band and malformed. Ablations C1, C3, C4 and C5 each turn their own battery red and were restored to blob == HEAD. The first C3 attempt was a no-op refused by the tool and re-run, as the body records. The lowered-ceiling run on the real files shows the full refusal text with exit 1.
  6. Acceptance notes, agreed. The lint.yml step comment is left as it is, because it is governed and off the file surface, and the script header is the authority. The "about three days to the first ceiling" note is the ruling working as intended. Seats adding facade members will meet it soon, and that is worth a line in the seat brief.
  7. Check-runs on the head: 26 success, 23 skipped, none failed or pending. Lint & Repo Gates and Lint · repo & tooling gates are success. mergeable_state is clean, and git merge-tree against origin/main 01598d936f is clean. I did not run the gate locally, because this checkout has no node_modules (it exits 3, PREREQUISITE NOT MET). CI's run on this head is the reading.

The patch-id is 1a39a8e42633b98d54f8364bb18ed81fdcde9b27. A clean main merge that keeps it keeps this PASS.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

席位核对

ACCEPT · area S4 (E1) · Head-sha: cfb690a278522940537ff3dc695dec3691ab1c8f

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

Landing (landing-operations B) · head cfb690a2

Reading Value
check-runs on head 49: 26 success, 23 expected skip, 0 pending/failed
check-governed-merges --pr 34103 NOT governed, 233 lines

State change: ready + auto-merge (area authorising line).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 04:09
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 8898b4e Nov 16, 2026
50 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-E1-33949-ceiling branch November 16, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant