Skip to content

docs(spec-004): retroactive bookkeeping and review council fixes - #2

Merged
jflowers merged 6 commits into
mainfrom
004-bookkeeping
Feb 22, 2026
Merged

jflowers merged 6 commits into
mainfrom
004-bookkeeping

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

  • Add retroactive plan.md and tasks.md for Spec 004 (CRAP composite metrics), documenting the already-implemented feature with full traceability to spec requirements
  • Address review council findings across 3 iterations (zero-waste, accuracy, testability improvements)
  • Update reviewer agent model references

Review Council

The /review-council command ran 3 iterations before all three reviewers (Adversary, Architect, Guard) returned APPROVE:

Iteration 1 — 12 findings across all reviewers:

  • Removed dead Options.MaxCRAPload/MaxGazeCRAPload fields (zero-waste)
  • Promoted regexp.MustCompile to package-level var (efficiency)
  • Added ParseCoverProfile stderr warning on unparseable files
  • Added Summary stub-wire fields (AvgGazeCRAP, AvgContractCoverage, WorstGazeCRAP)
  • Implemented FR-015 stderr warning when GazeCRAP unavailable
  • Added 21-case TestFormula_BenchmarkSuite (SC-001: 28 total hand-computed pairs)
  • Fixed import grouping, documented funcCoverage sorted-blocks assumption

Iteration 2 — 6 findings:

  • Fixed AvgContractCoverage denominator mismatch (latent accuracy bug)
  • Fixed WorstGazeCRAP nil-entry contamination
  • Added Options.Stderr io.Writer for testable warning path (replaced hard-wired os.Stderr)
  • Added TestBuildSummary_WithGazeCRAP covering the GazeCRAP summary code path

Iteration 3 — All three reviewers APPROVE. 5 LOW-priority carry-forward items documented.

Changes

  • .specify/specs/004-composite-metrics/plan.md — new (retroactive implementation plan)
  • .specify/specs/004-composite-metrics/tasks.md — new (retroactive task list)
  • internal/crap/analyze.go — Options cleanup, Stderr field, buildSummary fixes
  • internal/crap/crap.go — Summary stub-wire fields
  • internal/crap/coverage.go — ParseCoverProfile stderr param
  • internal/crap/crap_test.go — 21-case formula suite + GazeCRAP summary test
  • cmd/gaze/main.go — FR-015 warning, dead field removal
  • .opencode/agents/reviewer-*.md — model reference update

All tests pass: go test -race -count=1 ./...

Documents the implementation that landed on main via commits 4b37981,
5ea4085, 58b2da5, and 2d67f76 before the Speckit pipeline was established.

- plan.md: architecture, design decisions, dependency graph, scope matrix,
  success criteria mapping, and test coverage summary
- tasks.md: 55 tasks across 7 phases; Phases 1–6 complete ([x]),
  Phase 7 tracks deferred work (GazeCRAP activation, FR-015 warning,
  self-check command)
- Remove dead Options.MaxCRAPload/MaxGazeCRAPload fields (zero-waste)
- Promote testFileRegexp to package-level var (efficiency)
- Add ParseCoverProfile stderr param for warning on unparseable files
- Add Options.Stderr io.Writer for testable warning path
- Add Summary stub-wire fields: AvgGazeCRAP, AvgContractCoverage, WorstGazeCRAP
- Fix AvgContractCoverage denominator and WorstGazeCRAP nil filtering
- Implement FR-015 stderr warning when GazeCRAP unavailable
- Add 21-case TestFormula_BenchmarkSuite (SC-001: 28 total pairs)
- Add TestBuildSummary_WithGazeCRAP covering GazeCRAP summary path
- Fix import grouping in crap_test.go
- Document funcCoverage sorted-blocks assumption
- Update plan.md and tasks.md to reflect all changes
@github-actions

github-actions Bot commented Feb 22, 2026 •

Copy link
Copy Markdown

✅MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ GO golangci-lint yes yes no no 22.3s
✅ GO revive 8 0 0 0.4s
✅ REPOSITORY gitleaks yes no no 0.32s
✅ REPOSITORY git_diff yes no no 0.24s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

…is packages

Handle return values from fmt.Fprintf/Fprintln (display output),
os.Remove (best-effort cleanup), file Close (deferred), and
types.Signature type assertion to satisfy golangci-lint errcheck.
@jflowers
jflowers merged commit c9148d1 into main Feb 22, 2026
2 checks passed
@jflowers
jflowers deleted the 004-bookkeeping branch February 22, 2026 21:40
jflowers added a commit that referenced this pull request Aug 13, 2026
- Fix skipped test data missing from report pipeline quality JSON:
  BuildPackageSummary only aggregates report-level data, so
  SkippedTests/SkippedTestNames are now set post-hoc in
  runQualityStep and propagated through ReportSummary (#2, #5)
- Add combined threshold test for --min-contract-coverage +
  --max-over-specification both set on empty results (#1)
- Add divergence edge case test: SkippedTests > len(SkippedTestNames)
  verifies defensive guard prevents out-of-bounds (#3)
- Extract shared MaxSkippedTestDisplay constant from quality package,
  replacing duplicate magic 20 in main.go and report.go (#6)
- Move totalTestFuncs computation inside text format branch where
  it is actually used (#8)
- Wrap WriteJSON/WriteText errors with context per CS-006 (#9)
- Filed follow-up issue #219 for multi-package mixed BDD+normal
  scenario test (#4)
em-redhat pushed a commit to em-redhat/gaze that referenced this pull request Sep 1, 2026
- Fix skipped test data missing from report pipeline quality JSON:
  BuildPackageSummary only aggregates report-level data, so
  SkippedTests/SkippedTestNames are now set post-hoc in
  runQualityStep and propagated through ReportSummary (unbound-force#2, unbound-force#5)
- Add combined threshold test for --min-contract-coverage +
  --max-over-specification both set on empty results (unbound-force#1)
- Add divergence edge case test: SkippedTests > len(SkippedTestNames)
  verifies defensive guard prevents out-of-bounds (unbound-force#3)
- Extract shared MaxSkippedTestDisplay constant from quality package,
  replacing duplicate magic 20 in main.go and report.go (unbound-force#6)
- Move totalTestFuncs computation inside text format branch where
  it is actually used (unbound-force#8)
- Wrap WriteJSON/WriteText errors with context per CS-006 (unbound-force#9)
- Filed follow-up issue unbound-force#219 for multi-package mixed BDD+normal
  scenario test (unbound-force#4)
jflowers added a commit that referenced this pull request Oct 2, 2026
Declare cognitive_complexity and gaze_crap_cc on Score and
cognitive_complexity_total/cognitive_complexity_exceeded on Summary so
JSON output validates against the schema.

Addresses PR #294 review feedback from @jflowers (finding #2).

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: deepseek-v4-pro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant