From b01d54d926e774c3ffa586bd2bc6d423061715e2 Mon Sep 17 00:00:00 2001 From: Mark Ridley <210189+maudlin@users.noreply.github.com> Date: Mon, 22 Jun 2026 23:22:29 +0100 Subject: [PATCH] =?UTF-8?q?feat(scc):=20generated-marker=20exclusion=20?= =?UTF-8?q?=E2=80=94=20banner-shaped,=20opt-in,=20enumerated=20(#114)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 2 of plan 0002 (#107), on the merged Phase 1 routing. With CHECKUP_EXCLUDE_GENERATED=1, drop files whose head carries a banner-shaped generated marker from BOTH the lizard inventory and the scc keep-set — the corvus lever (39,208 -> 3,569 source files; 41,081 -> 5,442 keep-set), which also pre-empts the #105 lizard blow-ups by shrinking the set first. - lib/source-inventory.sh: INV_GENERATED_RE (Go `Code generated … DO NOT EDIT.`, comment-leader `@generated`, C# ``) + _apply_generated_excludes, called from build_source_inventory and build_scc_keepset (mirrors _apply_gitattr_excludes). Markers are case-sensitive + anchored (NOT the spike's loose substrings) so first-party code that quotes a marker, or owns a bare `DO NOT EDIT` (IaC, migrations), is kept (Morlock M1). Whole-file `grep -lIZ` short-circuits at the marker (cheap even on mostly-generated trees) and catches markers below line 1 (corvus's sit on line 2). Every drop is ENUMERATED to `.generated` (loud, not a silent count); sets GENERATED_EXCLUDED_COUNT. - Opt-in (default off) so the regex is field-tested with zero default- behaviour change; flip to default-on is a deliberate follow-up. Surfacing "% generated" as a headline signal is Phase 3. - test/source-inventory.test.sh: opt-in off = unchanged; on = drops the three banner forms, keeps prose/bare-DO-NOT-EDIT first-party, sets the count, and enumerates the drops. Refs #107. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 11 ++++++++++ lib/source-inventory.sh | 40 +++++++++++++++++++++++++++++++++++ test/source-inventory.test.sh | 32 ++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ade7f8..f02fc6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,17 @@ across the whole thing, honestly*. ### Added +- **Generated-marker exclusion (opt-in)** (#114, plan 0002 Phase 2): with + `CHECKUP_EXCLUDE_GENERATED=1`, files whose head carries a **banner-shaped** + generated marker (Go `// Code generated … DO NOT EDIT.`, a comment-leader + `@generated`, or C# ``) are dropped from **both** the lizard + inventory and the scc keep-set — the lever that stops a codegen-heavy repo from + drowning the measurement (corvus: 39,208 → 3,569 source files) and pre-empts the + #105 lizard blow-ups. Markers are case-sensitive and anchored (not the loose + substrings a draft used), so first-party code that merely *quotes* a marker — or + owns a bare `DO NOT EDIT` (IaC, hand-written migrations) — is kept. Every drop is + **enumerated** to `raw/…​.generated` (loud, not a silent count). Default off until + field-tested; surfacing "% generated" as a headline signal is Phase 3. - **First-party source — the scc-based engines honour the inventory** (#109, plan 0002 Phase 1; closes #18): `codebase-stats`, stack-identity, the scc complexity arm and tech-viability now filter + re-aggregate a single diff --git a/lib/source-inventory.sh b/lib/source-inventory.sh index c965acc..53871c3 100644 --- a/lib/source-inventory.sh +++ b/lib/source-inventory.sh @@ -34,6 +34,17 @@ INV_JSTS_RE='\.(ts|tsx|js|jsx|mjs|cjs|svelte|vue)$' INV_NONJS_RE='\.(py|cs|java|kt|kts|go|rb|php|rs|c|cc|cpp|cxx|h|hpp|m|mm|swift|scala|lua)$' # lizard's non-JS slice (#68) INV_LIZARD_RE='\.(ts|tsx|js|jsx|py|cs|java|kt|kts|go|rb|php|rs|c|cc|cpp|cxx|h|hpp|m|mm|swift|scala|lua)$' # everything lizard tokenises +# Generated-file markers (#114, plan 0002 Phase 2). BANNER-SHAPED + case-sensitive, +# NOT loose substrings: the spike's `@generated|DO NOT EDIT|…` (case-insensitive) +# fired on first-party code that merely *mentions* a marker (codegen tooling, +# Flow/Relay, lint configs) or owns it (IaC `# DO NOT EDIT`, hand-written +# migrations) — Morlock M1. Three anchored forms, matched as whole comment lines: +# 1. Go canonical: `// Code generated . DO NOT EDIT.` (full line) +# 2. `@generated`: only inside a comment leader at line start (//, #, *, /*, --,