Skip to content

test(docs): split docs-drift.test.ts along its describe seams (#1196) - #1285

Merged
huangyiirene merged 1 commit into
mainfrom
claude/issue-1196-docs-drift-split
Aug 25, 2026
Merged

huangyiirene merged 1 commit into
mainfrom
claude/issue-1196-docs-drift-split

Conversation

@huangyiirene

Copy link
Copy Markdown
Collaborator

Fixes #1196

test/docs-drift.test.ts was 99,746 bytes against the 102,400-byte
MAX_FILE_BYTES in scripts/check-source-hygiene.mjs — 2,654 bytes of
headroom, 97.4% full. #1135 is queued to add assertions to that very file
(it reuses the capCel machinery there) and would have hit the ceiling
mid-implementation, which is the detour #814 and #635 each paid for once
already.

This splits the file along the describe seams it already had. It is a move,
not a rewrite
— each describe travels whole with its header comment, and
no assertion, name or test was added, removed or edited.

⛔ MAX_FILE_BYTES is untouched. ⛔ #1135's assertions are not implemented here.

Same suite, either side

Same command, same tree, local both times.

before (origin/main @ 6ed7b8dd) after (43daabcf)
pnpm test (whole suite) Test Files 124 passed (124)
Tests 2900 passed | 1 skipped (2901)
Test Files 131 passed (131)
Tests 2900 passed | 1 skipped (2901)
just this family Test Files 1 passed (1)
Tests 76 passed (76)
Test Files 8 passed (8)
Tests 76 passed (76)

Test files +7 (the seven new siblings); test count identical. The name sets were
diffed too, not just counted — vitest run --reporter=verbose over the family
before and after, describe > it paths sorted and compared: 76 names, sets
identical
.

The move itself is mechanically provable rather than eyeballed: the eleven line
ranges lifted out of the original tile [11, 2018] exactly once each, and their
concatenation is byte-for-byte identical to the original file's body (lines
11–2018, i.e. everything below the copyright header and the import block, which
is the only thing rewritten per file).

Resulting sizes — the durability half

file bytes headroom % of cap
test/docs-drift.test.ts 10,778 91,622 10.5%
test/docs-src-tree-paths.test.ts 10,035 92,365 9.8%
test/docs-runnable-samples.test.ts 10,641 91,759 10.4%
test/docs-dashboard-tiles.test.ts 11,760 90,640 11.5%
test/docs-locale-callouts.test.ts 6,366 96,034 6.2%
test/docs-retired-personas.test.ts 10,764 91,636 10.5%
test/docs-metadata-counts.test.ts 14,724 87,676 14.4%
test/docs-declared-versions.test.ts 31,963 70,437 31.2%

Before: one file at 99,746 B / 2,654 B headroom / 97.4% full. After: the fullest
file is at 31.2%, and docs-drift.test.ts — where #1135 lands, because that is
where capCel stayed — is at 10.5% with 91,622 bytes of room. Sum is 107,031 B
against 99,746 B before; the 7.3KB is eight copyright/import blocks, the pointer
table below, and the per-file family notes.

How the thirteen families were grouped, and why

The card names four families and the dispatch listed twelve describes; the
file actually carried thirteen (the listing omitted
docs/STATUS.md states the current repository (#1011) at line 1810). All
thirteen are accounted for below.

Grouped by subject first, and by shared derivation where the two agree:

Pointer sweep — the #931 half

#814 split test/metadata-references.test.ts and left four comments pointing at
families that had moved; one of those is stale to this day. Every in-repo
reference was re-derived (grep -rn docs-drift, plus a grep for each moved
describe title and each moved identifier) and triaged one at a time.

Repointed (21 edits, each asserted to match exactly once before rewriting):

now names was in
docs-dashboard-tiles.test.ts tile-guard / locale-convention pointers heading-label.test.ts ×3, docs-service-index-analytics.test.ts ×2, docs-quick-tour-navigation.test.ts, content/docs/analytics/dashboards{,.zh-Hans,.zh-Hant}.mdx
docs-locale-callouts.test.ts "compares callout counts" sharing-coverage.test.ts ×2
docs-retired-personas.test.ts the prose-side persona guard persona-copy.test.ts ×2, test/helpers/persona-vocabulary.ts
docs-metadata-counts.test.ts the #729 count rule docs-readme-token-figures.test.ts, docs-view-rosters.test.ts, docs-role-hierarchy.test.ts, docs/STATUS.md
docs-declared-versions.test.ts the protocol pairing / STATUS pins objectstack.config.ts, docs/STATUS.md ×2, docs-view-rosters.test.ts

Plus the seven cross-references that were internal to the old file and became
cross-file the moment it was split ("the check above", "its own rule below",
"the flow rules at the top of this file", …) — each now names the file it means.
And two comments quoting the old size as the reason a rule shipped elsewhere
(docs-readme-token-figures.test.ts: "is 100,190 bytes"; docs-view-rosters.test.ts:
"that file is 97KB") were rewritten: the subject argument stands on its own and
the arithmetic one no longer holds.

Deliberately not edited, with the reason:

  • src/objects/_thresholds.ts, src/docs/crm_{sales,admin,service,overview}.md,
    test/helpers/repo-root.ts, test/sharing-coverage.test.ts:622,
    test/automation-docs-coverage.test.ts ×2, test/deal-threshold-parity.test.ts,
    test/docs-revenue-approvals-navigation.test.ts — every one names something
    that stayed in docs-drift.test.ts (the thresholds, CRON_LABEL, the
    REPO_ROOT example) or makes no file-level claim at all.
  • CHANGELOG.md and the three existing .changeset/*.md — dated records of what
    a past change did, true when written; none names a path that has moved.
  • content/docs/whats-new{,.zh-Hans,.zh-Hant}.mdx — says "the repository's
    docs-drift guard" with no path. Left as prose; a reader who follows the name
    lands on the SPLIT BY FAMILY table.
  • The four fenced trees — src/pages/, src/actions/, src/flows/,
    src/translations/ — belong to A lead flagged duplicate_status: suspected looks clean on its record page, and Convert Lead never mentions it — the duplicate converts into a second account, contact and opportunity #1207 in this batch and were not touched.
    Measured: they contain zero docs-drift references, so the fence cost this
    sweep nothing and nothing is left behind there.

Gates

pnpm verify — validate → typecheck → lint → lint:i18n-gate → hygiene
→ hygiene:tokens → build → test — green on 43daabcf, run under the
container's shared verify lock, exit code read from the wrapper's verdict line
rather than through a pipe:

os-verify-lock: VERDICT command-exit 0 · held the lock 118s (1m58s) · waited 0s

The gate that was red at 107KB, printing its own verdict:

  ✓ no source file over 100KB
  ✓ copyright header at the top of every .ts file
✓ source hygiene clean

typecheck covers the new files rather than merely passing beside them —
tsc --noEmit --listFiles puts all eight in the program (tsconfig.json
includes test/**/* with no *.test.ts exclusion), so its silence is a
measurement.

Changeset: .changeset/docs-drift-split-by-family.md, empty frontmatter — the
sanctioned "this PR releases nothing" declaration changeset-check.yml
documents. No skip-changeset label was applied.

Reported, not ridden along


Generated by Claude Code

`test/docs-drift.test.ts` had grown to 99,746 bytes against the 102,400-byte
ceiling in `scripts/check-source-hygiene.mjs` — 97.4% full, with room for no
rule at all. That was not hypothetical: #1187 appended one, took the file to
107KB and turned `pnpm hygiene` red, then shipped its rule as a sibling. #1135
is queued to add assertions to this same file and would have hit the ceiling
mid-implementation.

The thirteen `describe` families move out along the seams they already had —
each `describe` whole, header comment included. This is a move, not a rewrite:
same tests, same names, same assertions, none added and none removed.

The families are grouped by subject, and by the derivations they share:

  docs-drift.test.ts             the flow-threshold rules (kept; the family the
                                 file is named for, and the home of `capCel`)
  docs-src-tree-paths.test.ts    `src/<dir>/` paths a doc names or draws
  docs-runnable-samples.test.ts  documented agent names (#606), action example (#813)
  docs-dashboard-tiles.test.ts   the dashboards page lists tiles that exist
  docs-locale-callouts.test.ts   translated pages keep the English callouts (#736)
  docs-retired-personas.test.ts  product prose does not name a retired copilot (#612)
  docs-metadata-counts.test.ts   docs state the counts the stack registers (#729)
  docs-declared-versions.test.ts app version (#612), protocol (#728), STATUS (#1011)

`MAX_FILE_BYTES` is untouched: raising a gate threshold is a maintainer
decision, not a way to make a split easier.

#814 split `test/metadata-references.test.ts` the same way and left four
comments pointing at families that had moved, which became #931. So the
pointers into this file were swept and updated in the same commit — the
comments that named a moved rule now name the file it moved to, and the ones
that named a rule which stayed (`CRON_LABEL`, the threshold prose, the
`REPO_ROOT` example) are unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STpYzSP2LiZwZinh6m6Qgf
@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hotcrm Ignored Ignored Aug 25, 2026 2:09pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci/cd CI plumbing and the verification pipeline configuration Build and app configuration files labels Aug 25, 2026
@huangyiirene
huangyiirene marked this pull request as ready for review August 25, 2026 14:17
@huangyiirene
huangyiirene added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 3aedf05 Aug 25, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd CI plumbing and the verification pipeline configuration Build and app configuration files documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test/docs-drift.test.ts is at 97.8% of the 100KB hygiene cap — the next rule added to it turns the gate red

1 participant