Skip to content

chore(ratchets): make god-class decomposition detectors comment-aware - #1370

Open
mauricecarrier7 wants to merge 1 commit into
developfrom
chore/comment-aware-ratchet-detectors
Open

chore(ratchets): make god-class decomposition detectors comment-aware#1370
mauricecarrier7 wants to merge 1 commit into
developfrom
chore/comment-aware-ratchet-detectors

Conversation

@mauricecarrier7

@mauricecarrier7 mauricecarrier7 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

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 AccountsManager campaign — a .shared or 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. A detector that penalizes accurate comments trains you to write worse ones.

Changes

  • check-godclass-loc-freeze.sh — counts code lines (non-blank, non-comment-only) instead of raw 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).
  • check-appcontainer-locator-count.sh + check-shared-read-count.sh — strip Swift comments before matching (//////, 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 → 164not 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 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).
  • CI runs these via .github/workflows/tooling-checks.yml (pytest scripts/tests/).
  • Behaviour change is measurement-only; the monotone-down gate semantics are unchanged.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

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.
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

🧪 Unit Test Results

📊 View Full Interactive Report

❌ TESTS FAILED

📊 Testing Coverage Breakdown

Why two coverage numbers? Testable coverage subtracts files that can't be exercised from xcodebuild — SwiftUI views, UIKit VCs, lifecycle (see scripts/coverage-exclude.json) — so raising it means more testable logic is tested, not that we shipped less UI. Total coverage is kept for continuity. The excluded paths are covered by simdrive E2E journeys (see chaos-replay-on-pr.yml).


🔗 Interactive HTML Report | CI Run Details

Counts above were produced by this CI run's xcresult parse — reproduce via the run link.

📦 Downloadable Artifacts
Artifact Description
test-report 📄 Markdown + HTML reports
test-data 📊 JSON data for tooling
test-results 🔍 Full xcresult (open in Xcode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant