chore(ratchets): make god-class decomposition detectors comment-aware - #1370
Open
mauricecarrier7 wants to merge 1 commit into
Open
chore(ratchets): make god-class decomposition detectors comment-aware#1370mauricecarrier7 wants to merge 1 commit into
mauricecarrier7 wants to merge 1 commit into
Conversation
The three Wave-0 decomposition ratchets counted COMMENTS as code, so editing documentation tripped them — a detector that penalizes accurate comments. This recurred repeatedly during the 3a AccountsManager campaign (a `.shared` or an `AppContainer.production()` named in a doc comment reddened the gate), and the shared-read baseline note even held the count at 213 to absorb one prose mention. - check-godclass-loc-freeze.sh: count CODE lines (non-blank, non-comment-only) instead of raw `wc -l`. Retires the "Wave 0 debt" flagged in the baseline: a doc-comment or blank-line edit no longer moves the number. Baselines recomputed to code lines (e.g. AccountsManager 915 physical -> 374 code). - check-appcontainer-locator-count.sh + check-shared-read-count.sh: strip Swift comments (`//`/`///` line comments — only when `//` is at BOL or after whitespace so `://` in URLs survives — plus block-comment lines) before matching. Baselines recomputed by that measurement correction alone: locator 302 -> 256, shared-read 213 -> 164 (NOT removed call sites; the same tree, counted correctly). Proof it bites: on a 5-line fixture (1 real read + 4 `.shared` comment mentions) the old grep counted 5, the new logic counts 1. New pytests pin the comment-mention exclusion + URL-`://` preservation for all three; the god-class fixture now emits code lines and a new test proves 50 code lines interleaved with 100 comment/blank lines still counts 50. 26/26 detector tests pass; CI runs them via tooling-checks.yml. **Scope:** the 3 detector scripts + their 3 baselines + their 3 pytests. Behaviour change is measurement-only (what counts as a "line"/"read"); the monotone-down gate semantics are unchanged. **Not done:** the harness-side gaps (DRM-worktree auto-provisioning, review-marker ledger gap) are tracked separately and live in ~/harness, not this repo.
🧪 Unit Test Results📊 View Full Interactive Report ❌ TESTS FAILED📊 Testing Coverage Breakdown
🔗 Interactive HTML Report | CI Run Details Counts above were produced by this CI run's xcresult parse — reproduce via the run link. 📦 Downloadable Artifacts
|
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.
What & why
The three Wave-0 god-class decomposition ratchets counted comments as code, so editing documentation tripped them. This recurred repeatedly during the 3a
AccountsManagercampaign — a.sharedorAppContainer.production()named in a doc comment reddened the gate — and the shared-read baseline note even held the count at 213 to absorb one prose mention. A detector that penalizes accurate comments trains you to write worse ones.Changes
wc -l. Retires the "Wave 0 debt" the baseline itself flagged. A doc-comment/blank-line edit no longer moves the number. Baselines recomputed to code lines (e.g. AccountsManager 915 physical → 374 code).//////, only when//is at line-start or after whitespace so://in URLs survives; plus block-comment lines). Baselines recomputed by that measurement correction alone: locator 302 → 256, shared-read 213 → 164 — not removed call sites, the same tree counted correctly.Proof it bites
On a 5-line fixture (1 real read + 4
.sharedcomment mentions) the old grep counted 5, the new logic counts 1. New pytests pin the comment-mention exclusion + URL-://preservation for all three detectors; the god-class fixture now emits code lines, and a new test proves 50 code lines interleaved with 100 comment/blank lines still counts 50.Verification
pytest scripts/tests/test_check_*→ 26/26 pass (includes the live-repo-baseline tests, so the recomputed baselines PASS against develop)..github/workflows/tooling-checks.yml(pytest scripts/tests/).🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com