Skip to content

fix(pr-review): accept phase blocked by wrong layer names; finalize now publishes artifacts#81

Merged
robertotru merged 1 commit into
mainfrom
076-pr-review-accept-finalize-fixes
Jun 23, 2026
Merged

fix(pr-review): accept phase blocked by wrong layer names; finalize now publishes artifacts#81
robertotru merged 1 commit into
mainfrom
076-pr-review-accept-finalize-fixes

Conversation

@robertotru

Copy link
Copy Markdown
Contributor

Summary

Fixes two bugs that made canon pr-review unusable: the accept phase was
permanently blocked by a layer-name mismatch, and finalize never published
artifacts to the expected .canon/artifacts/ directory.

Root Causes

1. accept blocked — wrong layer names in validation

validate_reviewer_output() in validate.rs called check_layer_coverage()
which validated layer_states against CANONICAL_LAYERS — the old 5-layer
model (diff, whole_file, related_context, logical_stress, tests).

The pr-review mode uses 7 layers (early-signal, application-source,
high-risk-surfaces, related-context, logical-stress, tests,
coverage-accounting). Since diff and whole_file don't exist in the new
system, accept always produced canonical-review-output.json with
valid: false and the errors:

Layer 'diff' is missing from layer coverage
Layer 'whole_file' is missing from layer coverage

The filesystem-based check in mode_pr_review_accept.rs already validates all
7 layers correctly — the JSON-level check was redundant and actively harmful.

Fix: Removed check_layer_coverage() from validate_reviewer_output().
The existing filesystem check in mode_pr_review_accept.rs::check_layer_coverage()
remains the authoritative layer coverage validator.

2. finalize didn't publish to .canon/artifacts/

run_pr_review_finalize() wrote all review artifacts (summary, report,
findings, manifest, etc.) to .canon/runs/<RUN_ID>/pr-review/ only.
The skill contract states artifacts should be in
.canon/artifacts/<RUN_ID>/pr-review/, but nothing copied them there.

Fix: Added publish_artifacts() called at the end of finalize, which
copies the 8 packet artifacts (01-review-summary.md, 06-review-report.md,
review-findings.json, missing-tests.md, manifest.toml,
canonical-review-output.json, packet-metadata.json,
coverage-accounting.md) from the run directory to the artifacts directory.

Changes

File Change
crates/canon-engine/src/review/validate.rs Removed broken check_layer_coverage(); renamed test; added schema version test
crates/canon-engine/src/orchestrator/service/mode_pr_review_finalize.rs Added publish_artifacts(); added 2 new tests; extended integration test
Cargo.toml + 38 other files Version bump 0.72.5 → 0.72.6

Coverage

File Before After
validate.rs 168/170 (98.8%) 183/183 (100.0%)
mode_pr_review_finalize.rs 611/696 (87.8%) 675/759 (88.9%)

Verification

  • cargo clippy --workspace --all-targets --all-features -- -D warnings — clean
  • cargo fmt — clean
  • cargo test --lib -p canon-engine — 935 passed, 0 failed

…ow publishes artifacts

Two bugs in `canon pr-review`:

1. **accept always failed**: `validate_reviewer_output()` checked layer coverage
   against `CANONICAL_LAYERS` from `onion.rs` (the old 5-layer model: diff,
   whole_file, related_context, logical_stress, tests). The pr-review mode uses
   7 layers (early-signal, application-source, high-risk-surfaces,
   related-context, logical-stress, tests, coverage-accounting), so `diff` and
   `whole_file` were always reported as missing. The filesystem-based check in
   `mode_pr_review_accept.rs` already validates all 7 layers correctly, so the
   redundant JSON-level check was removed.

2. **finalize did not publish artifacts**: `run_pr_review_finalize()` wrote
   outputs only to `.canon/runs/<RUN_ID>/pr-review/`. Added `publish_artifacts()`
   that copies the 8 packet artifacts to `.canon/artifacts/<RUN_ID>/pr-review/`
   on finalize, fulfilling the skill contract.

Also bumps workspace version 0.72.5 → 0.72.6.

Coverage: validate.rs 100%, mode_pr_review_finalize.rs 88.9% (+64 covered lines).
Tests: 935 passed, 0 failed (+3 new).
@robertotru robertotru self-assigned this Jun 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@robertotru
robertotru merged commit d13f494 into main Jun 23, 2026
27 checks passed
@robertotru
robertotru deleted the 076-pr-review-accept-finalize-fixes branch June 23, 2026 20:12
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