Skip to content

feat: enforce reproduce_cmd invariant for every Finding via add_layer#52

Merged
thefourcraft merged 1 commit intoproductionfrom
feature/finding-reproduce-cmd-invariant
May 4, 2026
Merged

feat: enforce reproduce_cmd invariant for every Finding via add_layer#52
thefourcraft merged 1 commit intoproductionfrom
feature/finding-reproduce-cmd-invariant

Conversation

@thefourcraft
Copy link
Copy Markdown
Member

Summary

  • BarzelReport::add_layer now normalises each incoming Finding before storing it: if reproduce_cmd is None or blank it is filled with a deterministic fallback (barzel run --layer <name> --json for the four known layers; barzel run --json otherwise)
  • Existing runner-specific reproduce_cmd values are left unchanged
  • RUNNER_UNAVAILABLE, CACHED, and RUNNER_FAILED findings — which all used ..Default::default() — are covered automatically because every path flows through add_layer
  • No schema change: reproduce_cmd remains Option<String> in this PR

Test plan

src/report.rs

  • add_layer_fills_missing_reproduce_cmdNone reproduce_cmd is filled with layer-specific fallback
  • add_layer_fills_blank_reproduce_cmd — whitespace-only reproduce_cmd is overwritten
  • add_layer_preserves_existing_reproduce_cmd — non-empty reproduce_cmd is unchanged
  • add_layer_unknown_layer_name_uses_generic_fallback — unknown layer name falls back to barzel run --json

src/orchestrator.rs

  • runner_failed_finding_has_reproduce_cmdRUNNER_FAILED finding has non-empty reproduce_cmd

  • runner_unavailable_finding_has_reproduce_cmdRUNNER_UNAVAILABLE finding has non-empty reproduce_cmd

  • cached_finding_has_reproduce_cmdCACHED finding has non-empty reproduce_cmd

  • All 736 tests pass

  • cargo clippy --bin barzel -- -D warnings clean

  • git diff --check production..HEAD clean

Every Finding in a final report must carry a reproduce_cmd so agents
can always re-run a finding without guessing.

- add_layer now normalises incoming findings before storing them:
  if reproduce_cmd is None or blank, it is filled with
  'barzel run --layer <name> --json' for the four known layers, or
  'barzel run --json' for any other layer name.
- Existing runner-specific reproduce_cmd values are left unchanged.
- RUNNER_UNAVAILABLE, CACHED, and RUNNER_FAILED findings (which used
  ..Default::default()) are covered automatically because all paths
  flow through add_layer.
@thefourcraft thefourcraft merged commit d3b38c3 into production May 4, 2026
11 checks passed
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