chore(ci): ratcheting file-size guard + RC cut checklist#1040
chore(ci): ratcheting file-size guard + RC cut checklist#1040branarakic wants to merge 1 commit into
Conversation
Cap hand-written source file size with a one-way ratchet: any NEW packages/*/src file may not exceed 800 lines, and the 72 existing oversized files may shrink but never grow. Generated typechain bindings, dist output, .d.ts, and test files are excluded. Motivated by the v10 rc.8 -> rc.15 history, where the top churn hotspots were also the largest files: dkg-agent.ts (2,069 lines) was edited in 1 of every 6 commits, and the rc.15 "mixin split" relocated its bulk into new 3,000-line files instead of shrinking the surface. A filename-agnostic, ratcheting guard catches that whole class. Runs as a zero-dependency audit in the existing build job, next to audit-create-random / audit-dial-protocol, with a companion `node --test` suite. Per-file budgets are regenerated with `pnpm check:file-size --write`. - scripts/audit-file-size.mjs the guard (+ --write to re-baseline) - scripts/audit-file-size.test.mjs 19 unit tests over the pure helpers - scripts/file-size-baseline.json budgets for the 72 current large files - package.json pnpm check:file-size - .github/workflows/ci.yml two new build-job steps - RELEASE_PROCESS.md §11 RC cut checklist (manual gate) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| function writeBaseline(measured) { | ||
| const files = {}; | ||
| for (const { path: relPath, lines } of measured) { | ||
| if (lines > DEFAULT_MAX_LINES) files[relPath] = budgetForSize(lines); |
There was a problem hiding this comment.
🔴 Bug: --write rebuilds the baseline from the current file sizes, so an already-baselined file that grew will get a larger budget the next time someone regenerates the JSON. That breaks the core "ratchet only down" guarantee and makes budget increases a one-command change. Preserve existing entries and only lower them when a file shrinks; if upward rebases are ever allowed, gate them behind an explicit opt-in path.
| if (!p.includes('/src/')) return false; | ||
| if (!SOURCE_EXTENSIONS.has(path.posix.extname(p))) return false; | ||
| if (p.endsWith('.d.ts')) return false; | ||
| if (/\.(test|spec)\.tsx?$/.test(p)) return false; |
There was a problem hiding this comment.
🟡 Issue: this only excludes tests by filename suffix, so common layouts like packages/foo/src/__tests__/x.ts or src/tests/x.ts will still be treated as production source and can fail the cap unexpectedly. The script header says test files are excluded, so the matcher should also skip test directories and the test suite should cover those cases.
|
|
||
| - [ ] Package versions aligned for the channel (§3): `package.json`, | ||
| `packages/cli/package.json`, `packages/evm-module/package.json`, | ||
| `packages/mcp-server/package.json`. |
There was a problem hiding this comment.
🟡 Issue: this checklist references packages/mcp-server/package.json, but this repo's MCP package is packages/mcp-dkg/package.json. As written, release verification will skip the actual package that needs version alignment. Update this path here to the real package.
What
Adds an automated file-size guard to CI plus a manual RC cut checklist to the release process — two low-cost delivery guardrails aimed at the regression/churn pattern seen across v10
rc.8 → rc.15.File-size guard (automated)
scripts/audit-file-size.mjsfails the build if any newpackages/*/src.ts/.tsxfile exceeds 800 lines, or if one of the 72 existing oversized files grows past its budget. One-way ratchet: files may shrink, never grow.typechain/bindings,dist/,.d.ts, and tests are excluded. Budgets live inscripts/file-size-baseline.json(regenerate withpnpm check:file-size --write).buildjob next toaudit-create-random/audit-dial-protocol, with anode --testsuite (19 tests). Zero new dependencies, ~300 ms.RC cut checklist (manual)
RELEASE_PROCESS.md§11: a copy-pasteable stabilization gate (soak window, regression-test-per-fix, review hygiene, version/ABI alignment) to run before tagging each RC.Why
Across
rc.8 → rc.15the top churn hotspots were the largest files —dkg-agent.ts(2,069 lines) was edited in 1 of every 6 commits — and the rc.15 "mixin split" relocated bulk into new 3,000-line files rather than shrinking it.fix:outnumberedfeat:~4:1. This guard makes "no new god-files, and existing ones only shrink" a build-enforced invariant.Verification
pnpm check:file-sizegreen on this branch (618 source files scanned, 72 budgeted).node --test scripts/audit-file-size.test.mjs→ 19/19 pass.main(the rc-branch baseline didn't match —mainsplits PanelRight differently), so it reflects this PR's base.Notes
release-preflightjob.🤖 Generated with Claude Code