Skip to content

feat(code-review): deterministic prefix golden harness (PLN-1229 Phase 0) - #172

Merged
wongk merged 2 commits into
mainfrom
feat/code-review-prefix-golden-harness
Jul 2, 2026
Merged

wongk merged 2 commits into
mainfrom
feat/code-review-prefix-golden-harness

Conversation

@wongk

@wongk wongk commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What & why

Phase 0 of PLN-1229 (FEA-2385) — the artifact-parity oracle that must exist before the run-prefix refactor (which collapses the orchestrator's stage-by-stage walk of the deterministic prefix into one in-process batch runner). Builds the front-half golden harness that golden_fixture_harness.py deferred to "Phase 4b" and never shipped.

The harness walks the whole deterministic prefix (stages 0119b, stopping at the reviewer fleet) in-process, reusing production machinery rather than forking it, and snapshots every intermediate artifact for byte-level drift detection.

How it stays faithful & deterministic

  • Real pinned git fixtures — fixed identity + commit dates → deterministic blobs/trees/SHAs across runs and hosts.
  • Hermetic envHOME redirected to tmp (so finalize-cache never touches the real ~/.claude) + GIT_CONFIG_GLOBAL/SYSTEM=/dev/null isolation + _detect_open_pr neutralized (no gh).
  • Real CLI parser (_register_subparsers) builds each stage's Namespace exactly as main() does.
  • start.md angle-bracket token resolution replicated, incl. the stage_07 <DIFF_SCOPE> override.
  • Walker prose the refactor must own: PLN-725 singletons (stubbed with canned pln725_*.json), Gate A (hygiene-only exit), Gate B (route → fast-path → skip/augment partition).
  • Per-artifact normalization scrubs abs paths (cr_dir/repo/home/plugin), review_id, timestamps, prompt/cache hashes.

What's included

  • prefix_golden_harness.py + test_prefix_golden.py (determinism oracle + golden diff + branch guards).
  • 7 P0-B fixtures with committed goldens: standard/partitioned, fast-path, hygiene-only, empty-diff, cache-hit (pre-seeded V1 cache), since-last-review (pre-seeded review state), coverage-critic (roster + stubbed second singleton).
  • P0-D targeted branch tests: cmd_cache_check / cmd_resolve_scope / cmd_auto_incremental / cmd_finalize_cache now at 0 missing lines.

Scope / risk

Additive, test-only — no runtime/orchestration behavior changes. code-review bumped 3.1.03.1.1 (PATCH). The subprocess A/B parity oracle and the run-prefix runner are Phase 1 (next PR).

Verification

  • Full code-review suite: 1254 passed, 3 skipped.
  • uv run ruff check . + uv run pyright: clean.

🤖 Generated with Claude Code

wongk and others added 2 commits July 1, 2026 14:56
…Phase 0)

Build the deferred end-to-end prefix parity oracle for the run-prefix
refactor: a harness that walks the whole deterministic prefix (stages
01→19b) in-process against real pinned-date git fixtures, with the two
PLN-725 singletons stubbed and Gate A/B reproduced, snapshotting every
intermediate artifact for byte-level drift detection.

- prefix_golden_harness.py: fixture repo builder, hermetic env
  (HOME + gitconfig isolation), in-process stage executor via the real
  CLI parser, start.md angle-bracket token resolution, per-artifact
  normalization, PLN-725 singleton stubs, Gate A/B.
- 7 P0-B fixtures + committed goldens: standard, fast-path, hygiene-only,
  empty-diff, cache-hit, since-last-review, coverage-critic.
- test_prefix_golden.py: determinism oracle + golden compare + structural
  branch guards.
- P0-D: targeted branch tests close prefix cmd coverage gaps
  (cmd_cache_check / cmd_resolve_scope / cmd_auto_incremental /
  cmd_finalize_cache now 0 missing lines).

Full code-review suite: 1254 passed / 3 skipped. ruff + pyright clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the v3.1.1 CHANGELOG entry and list the new prefix harness / test /
fixtures in the README repository-layout section.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wongk
wongk merged commit 341c9be into main Jul 2, 2026
5 checks passed
@wongk
wongk deleted the feat/code-review-prefix-golden-harness branch July 2, 2026 13:45
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