Repository navigation
test(docs): split docs-drift.test.ts along its describe seams (#1196) - #1285
Merged
Merged
Conversation
`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
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
huangyiirene
marked this pull request as ready for review
August 25, 2026 14:17
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.
Fixes #1196
test/docs-drift.test.tswas 99,746 bytes against the 102,400-byteMAX_FILE_BYTESinscripts/check-source-hygiene.mjs— 2,654 bytes ofheadroom, 97.4% full. #1135 is queued to add assertions to that very file
(it reuses the
capCelmachinery there) and would have hit the ceilingmid-implementation, which is the detour #814 and #635 each paid for once
already.
This splits the file along the
describeseams it already had. It is a move,not a rewrite — each
describetravels whole with its header comment, andno assertion, name or test was added, removed or edited.
⛔
MAX_FILE_BYTESis untouched. ⛔ #1135's assertions are not implemented here.Same suite, either side
Same command, same tree, local both times.
origin/main@6ed7b8dd)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)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=verboseover the familybefore and after,
describe > itpaths sorted and compared: 76 names, setsidentical.
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 theirconcatenation 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
test/docs-drift.test.tstest/docs-src-tree-paths.test.tstest/docs-runnable-samples.test.tstest/docs-dashboard-tiles.test.tstest/docs-locale-callouts.test.tstest/docs-retired-personas.test.tstest/docs-metadata-counts.test.tstest/docs-declared-versions.test.tsBefore: 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 iswhere
capCelstayed — is at 10.5% with 91,622 bytes of room. Sum is 107,031 Bagainst 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; thefile actually carried thirteen (the listing omitted
docs/STATUS.md states the current repository (#1011)at line 1810). Allthirteen are accounted for below.
Grouped by subject first, and by shared derivation where the two agree:
docs-drift.test.ts(kept) —package docs do not drift from the flows they document. The family the file is named for and was written for, and thehome of
cap/capCel/CRON_LABEL/RULES, so the pointers insrc/objects/_thresholds.ts,src/docs/crm_*.md,deal-threshold-parityandautomation-docs-coveragestill resolve without being touched. It carries theSPLIT BY FAMILYtable.docs-src-tree-paths.test.ts— the three tree rules (maintainer inline,product inline, drawn diagrams). One subject on two axes, and they share
inlineSrcDirs,treeSrcDirsand the three doc lists.docs-runnable-samples.test.ts— documented agent names (Wow #1 demo docs + script still POST the retiredsales_copilotagent #606) and theaction example (两处仍读/仍教
input.selectedIds(无下划线)—— 平台永远不会投递这个键,docs 示例会把下一个作者带进 #508 同一个坑 #813). Both guard a snippet a reader is invited to run, andboth exist because a fenced block is prose to every other gate in the repo.
docs-dashboard-tiles.test.ts— the dashboards page rules. Sole consumerof
headingLabel()among these families.docs-locale-callouts.test.ts— translation callout parity (forecasting.zh-Hans/zh-Hant 相对英文页存在早于 #627 的整页漂移 —— 桶语义、承诺定义、缺失的汇总提示框需要整页重译 #736).docs-retired-personas.test.ts— the prose half of the retired-personavocabulary (Docs drift (round 2 leftovers): ~39 product pages still name "Sales/Service Copilot" as a persona; config comment and RELEASE_STRATEGY.md still stale #612); the
src/half istest/persona-copy.test.tsand bothread
test/helpers/persona-vocabulary.ts.docs-metadata-counts.test.ts— the [17.0-rc2验收] README 与 marketplace 文档的对象/flow 数量仍是旧值(15 objects / 23 flows),rc.2 实际为 17 / 24 #729 count rule.docs-declared-versions.test.ts— app version (Docs drift (round 2 leftovers): ~39 product pages still name "Sales/Service Copilot" as a persona; config comment and RELEASE_STRATEGY.md still stale #612), protocol ([17.0-rc2验收] objectstack.config.ts 的 engines.protocol 仍是 ^17.0.0-rc.1,与 objectstack.manifest.json(rc.2)及 build 产物不一致 #728) andthe
docs/STATUS.mdtranscript (docs/STATUS.md 的「当前状态」全表过期:对象/流程/仪表盘/动作计数、平台版本、测试规模无一与 main 相符 #1011). These three are the one grouping wherethe mechanical seam decided it as much as the subject:
PACKAGE_JSON,PLATFORM_VERSIONSandh2Sectionsare read by the Docs drift (round 2 leftovers): ~39 product pages still name "Sales/Service Copilot" as a persona; config comment and RELEASE_STRATEGY.md still stale #612 rules and thedocs/STATUS.md 的「当前状态」全表过期:对象/流程/仪表盘/动作计数、平台版本、测试规模无一与 main 相符 #1011 rules, so separating them would mean either a duplicated derivation (the
drift risk this whole file exists to prevent) or a new helper module — more
moved surface than the split needs. It is the largest resulting file at 31.2%
of cap, which is the price and it is a cheap one.
Pointer sweep — the #931 half
#814 split
test/metadata-references.test.tsand left four comments pointing atfamilies 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 moveddescribetitle and each moved identifier) and triaged one at a time.Repointed (21 edits, each asserted to match exactly once before rewriting):
docs-dashboard-tiles.test.tsheading-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}.mdxdocs-locale-callouts.test.tssharing-coverage.test.ts×2docs-retired-personas.test.tspersona-copy.test.ts×2,test/helpers/persona-vocabulary.tsdocs-metadata-counts.test.tsdocs-readme-token-figures.test.ts,docs-view-rosters.test.ts,docs-role-hierarchy.test.ts,docs/STATUS.mddocs-declared-versions.test.tsobjectstack.config.ts,docs/STATUS.md×2,docs-view-rosters.test.tsPlus 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 somethingthat stayed in
docs-drift.test.ts(the thresholds,CRON_LABEL, theREPO_ROOTexample) or makes no file-level claim at all.CHANGELOG.mdand the three existing.changeset/*.md— dated records of whata 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'sdocs-drift guard" with no path. Left as prose; a reader who follows the name
lands on the
SPLIT BY FAMILYtable.src/pages/,src/actions/,src/flows/,src/translations/— belong to A lead flaggedduplicate_status: suspectedlooks clean on its record page, andConvert Leadnever 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-driftreferences, so the fence cost thissweep nothing and nothing is left behind there.
Gates
pnpm verify—validate→typecheck→lint→lint:i18n-gate→hygiene→
hygiene:tokens→build→test— green on43daabcf, run under thecontainer's shared verify lock, exit code read from the wrapper's verdict line
rather than through a pipe:
The gate that was red at 107KB, printing its own verdict:
typecheckcovers the new files rather than merely passing beside them —tsc --noEmit --listFilesputs all eight in the program (tsconfig.jsonincludes
test/**/*with no*.test.tsexclusion), so its silence is ameasurement.
Changeset:
.changeset/docs-drift-split-by-family.md, empty frontmatter — thesanctioned "this PR releases nothing" declaration
changeset-check.ymldocuments. No
skip-changesetlabel was applied.Reported, not ridden along
is still worth its own card: this split fixes the instance, not the class —
the cap is silent at 99% and red at 101%, and this is the third time
(
test/metadata-references.test.ts距 100KB hygiene 上限只剩 817 字节 —— 下一个往里加测试的 PR 会被 gate 拦住 #814 ·src/data/index.tssits ~1.5KB under the 100KB hygiene cap, so the next seed edit failspnpm hygiene#635 · this one) the condition was found at the moment it bit.docs-drift.test.tsdown to 10,778 B, the repo's largest source file isnow
test/flow-scheduled.test.tsat 71,456 B — 69.8% of the cap. Not urgent,but it is the next one an advisory would name.
Generated by Claude Code