Skip to content

feat: wire GazeCRAP data into gaze report pipeline - #66

Merged
jflowers merged 3 commits into
unbound-force:mainfrom
jflowers:022-report-gazecrap-pipeline
Mar 17, 2026
Merged

jflowers merged 3 commits into
unbound-force:mainfrom
jflowers:022-report-gazecrap-pipeline

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

  • Extracted BuildContractCoverageFunc from cmd/gaze/main.go to internal/crap/contract.go so the report pipeline can import it
  • Wired the contract coverage callback into runProductionPipeline before the CRAP step, producing GazeCRAP scores, quadrant_counts, and gaze_crapload in gaze report JSON output
  • Fixed --max-gaze-crapload threshold to evaluate against actual computed GazeCRAPload (previously always passed with value 0)

Additional Changes

  • adapter-stderr-diagnostics: runSubprocess now returns stderr alongside stdout, surfacing actual error causes (e.g., "Invalid API key") in empty-output error messages
  • reporter-fix-strategy-awareness: Added Scoring Consistency Rules to gaze-reporter agent prompt ensuring AI reports use the same thresholds as CLI output

Testing

  • TestSC002_GazeCRAPloadMatchBetweenCrapAndReport — exact-match test between gaze crap and gaze report GazeCRAPload
  • TestSC004_PayloadContainsQuadrantCounts — FakeAdapter payload assertion for quadrant_counts and gaze_crapload
  • TestRunProductionPipeline_GazeCRAPloadFlowsThroughPipeline — pipeline data flow test
  • Updated all pipeline test mocks for new ContractCoverageFunc parameter
  • 12 tests migrated from cmd/gaze/main_test.go to internal/crap/contract_test.go

Spec

specs/022-report-gazecrap-pipeline/ — full spec pipeline (specify → clarify → plan → tasks → implement → review council)

When an AI adapter subprocess exits with code 0 but produces empty
stdout, the error message now includes truncated stderr content.
This surfaces the actual cause (e.g., 'Error: Invalid API key')
instead of the generic 'returned empty output' message.

Changes:
- runSubprocess returns (stdout, stderr, error) instead of (stdout, error)
- Added formatStderrSuffix helper for consistent stderr truncation
- All three subprocess adapters (OpenCode, Claude, Gemini) include
  stderr in their empty-output error messages
- 5 new tests for runSubprocess stderr and formatStderrSuffix
Ensures the AI-formatted report uses the same thresholds and metrics
as the CLI's deterministic output:
- CRAPload threshold read from summary.crap_threshold (not hardcoded)
- Contract coverage uses module-wide average (not subset)
- Quadrant descriptions use 'contract coverage' terminology
- GazeCRAPload and quadrant counts read from canonical JSON fields
Extracted BuildContractCoverageFunc from cmd/gaze/main.go to
internal/crap/contract.go. Wired it into runProductionPipeline
before the CRAP step so that gaze report produces GazeCRAP scores,
quadrant distribution (quadrant_counts), and gaze_crapload in its
JSON output.

Key changes:
- runCRAPStep and pipelineStepFuncs accept ContractCoverageFunc param
- --max-gaze-crapload threshold now evaluates actual GazeCRAPload
- SSA degradation from pre-CRAP quality pass merges (not overwrites)
  with quality step degradation data
- Added TestSC002 (exact-match gaze crap vs gaze report),
  TestSC004 (FakeAdapter payload assertion), and pipeline data
  flow test

Closes spec 022-report-gazecrap-pipeline.
@jflowers
jflowers force-pushed the 022-report-gazecrap-pipeline branch from d4e2828 to 103608b Compare March 17, 2026 15:42
@jflowers
jflowers merged commit 0233baf into unbound-force:main Mar 17, 2026
5 checks passed
@jflowers
jflowers deleted the 022-report-gazecrap-pipeline branch November 15, 2026 21:34
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