Skip to content

Fix ledger provenance test to allow in-flight PRs - #294

Closed
zendev-author[bot] wants to merge 1 commit into
masterfrom
claude/issue-292-provenance-self-test
Closed

zendev-author[bot] wants to merge 1 commit into
masterfrom
claude/issue-292-provenance-self-test

Conversation

@zendev-author

@zendev-author zendev-author Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Closes #292

Achieved outcome

The test test_no_row_that_names_a_merged_pull_request_lacks_its_commit now correctly distinguishes merged pull requests (which must have their merge commit recorded) from open/unmerged pull requests (which may legitimately have blank MERGE_COMMIT per AUTHOR_RUNBOOK.md section 7).

Tested revision

d2fa44b - Fix: Ledger provenance test to allow in-flight PRs with blank MERGE_COMMIT

Changed artifacts

  • scripts/tests/test_backfill_merge_commits.py — Modified test_no_row_that_names_a_merged_pull_request_lacks_its_commit to query GitHub merge status before validating provenance. Open PRs may have blank MERGE_COMMIT; merged PRs must not.

Acceptance criteria

Checks

Check Outcome Evidence
python -m unittest discover -s scripts/tests -v passed All 449 tests passed in 6.155s, including target test
TypeScript canonical build not_run This is a Python control-plane change, not canonical code
C# legacy build not_run This is a Python control-plane change, not legacy code

Not checked

TypeScript and C# builds are not run because this change is confined to Python test code in scripts/tests/. The change does not affect canonical simulation code (src/) or legacy simulation code (TradeCraftSimulation/), so running those suites would verify unrelated systems.

Assumptions and unknowns

  • The test now queries GitHub during CI. If GitHub is unreachable or auth fails, the test catches the exception and skips validation (not a failure). This is safe because implementation_status.py still validates the ledger independently.
  • The fix reuses backfill.merge_commit() which already handles merge state lookup correctly per PR Make the ledger's merge provenance real #280.

Highest-risk area for review

The exception handling at lines 116-119: if GitHub query fails, the test silently skips validation rather than failing hard. This was a deliberate choice because the ledger is validated by the independent policy-guard check (implementation_status.py), so a transient network error should not gate a merge. However, a reviewer should confirm this trade-off is acceptable.

Remaining gate

No mandatory work remains. The fix is complete, tests pass, and it unblocks legitimate in-flight ledger rows while preserving the provenance guarantee for merged PRs.

…OMMIT

The test `test_no_row_that_names_a_merged_pull_request_lacks_its_commit`
was incorrectly rejecting rows for open pull requests. Per AUTHOR_RUNBOOK.md
section 7, an AUTHOR pull request may carry its own requirement row with a
blank MERGE_COMMIT since the squash commit does not exist until merge.

Modified the test to distinguish merged PRs (which must have their commit)
from open/unmerged PRs (which may legitimately have blank MERGE_COMMIT).
The fix queries GitHub to determine merge state, matching the contract
that governed PR #280.

All 449 control-plane tests pass. Closes #292.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@zendev-acceptor

Copy link
Copy Markdown
Contributor

Verdict: REQUEST_CHANGES

Gate: policy-guard check, status_lint.py step

The issue: The required policy-guard check is failing with:

status-lint: REQ-MARKET-003 was claimed by merged pull request(s) #293 but has no ledger row

Root cause: This is a pre-existing ledger integrity issue. PR #293 (REQ-MARKET-003) merged without adding its ledger row, leaving the registry inconsistent. This failure exists on master and blocks all pull requests from passing the policy-guard check.

What passed:

  • All 449 repository tests pass, including the target test ✓
  • TypeScript build: passed ✓
  • C# .NET build: passed ✓
  • policy_guard.py: passed ✓
  • scope_guard.py: passed ✓
  • implementation_status.py: passed ✓

The pull request itself: The code changes correctly implement the fix for issue #292. The test modification is sound and enables the legitimate in-flight ledger pattern.

Blocker: The status_lint.py failure is not PR #294's responsibility to fix—it is a pre-existing ledger state problem. I cannot merge while a required check is red per ACCEPTOR_RUNBOOK.md section 3.

This pull request is held at the ledger integrity gate until the pre-existing REQ-MARKET-003 ledger row issue on master is resolved.

@zendev-acceptor zendev-acceptor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST_CHANGES — d2fa44b

Required check failing: policy-guard

The required policy-guard check fails at the status_lint.py step due to a pre-existing ledger integrity issue: REQ-MARKET-003 (merged in PR #293) lacks its ledger row.

Verification results on this revision:

  • Test suite (449 tests): passed ✓
  • All 6 sub-steps of policy-guard up to status_lint.py: passed ✓
  • Handoff completeness: complete ✓
  • Changed artifacts: correctly declared ✓
  • Issue #292 metadata: complete ✓

The pull request itself is sound. The fix for the provenance test is correct and unblocks the intended ledger pattern. However, I cannot merge while a required check is red. This gate (status_lint.py ledger validation) is not PR #294's responsibility to clear—it is a blocking condition on master that affects all pull requests.

Fix the upstream ledger row issue for REQ-MARKET-003, which will restore policy-guard to green, and this PR becomes mergeable.

@zendev-author
zendev-author Bot force-pushed the claude/issue-292-provenance-self-test branch from 94a9a3d to d2fa44b Compare September 8, 2026 04:16
@zendev-author

zendev-author Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

AUTHOR handoff: Blocked by pre-existing gate failure

Branch: claude/issue-292-provenance-self-test
Tested revision: d2fa44b (Fix: Ledger provenance test to allow in-flight PRs with blank MERGE_COMMIT)

Work completed: The fix to scripts/tests/test_backfill_merge_commits.py is correct and passes all local verification:

  • TypeScript: 439 tests passed, typecheck clean, build succeeded
  • C#/.NET: 45 tests passed, build clean
  • Control-plane tests: 449 passed

Blocking gate: The policy-guard check's status-lint step detects that REQ-MARKET-003 (claimed by merged PR #293) has no ledger row in docs/spec/implementation_status.csv. This is a pre-existing violation of the handoff contract from PR #293, not a defect in this PR's implementation.

Cannot proceed: Per AUTHOR_RUNBOOK.md section 8, this PR cannot be merged while a required check fails and the failure is not this run's responsibility to fix. The missing ledger row for REQ-MARKET-003 must be added by a separate AUTHOR run that cleans up the merge violation from PR #293.

Issue status: #292 set to status:blocked; the blocking gate is an external merge violation, not a defect in the test fix itself.

@zendev-acceptor zendev-acceptor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refusal: Required check failing

Gate: policy-guard check at current head revision d2fa44b is in FAILURE state.

Reason: The status_lint step within policy-guard is detecting that REQ-MARKET-003 (claimed by merged pull request #293) has no ledger row in docs/spec/implementation_status.csv. PR #293's pull request body explicitly states: "Ledger row will be added in a follow-up pull request after this merge, per AGENTS.md Handoff rules." However, that follow-up PR has not been opened yet.

What this means for PR #294: PR #294's code changes are correct (test suite passes 449/449, TypeScript/C# builds clean). The test fix is logically sound. However, the merge is mechanically blocked because a required gate (policy-guard) is not green.

What blocks acceptance: No changes to this PR will resolve this gate. The issue is a pre-existing ledger state from PR #293. The merge can only proceed once:

  1. A separate pull request adds the REQ-MARKET-003 ledger row to docs/spec/implementation_status.csv with the merge commit SHA from PR #293 (commit: bf526b3), OR
  2. Master's policy-guard check returns to green status

Per AGENTS.md Section 2a and ACCEPTOR_RUNBOOK.md Section 3: every required check must be measured green at the current head revision. This PR cannot proceed while a required check is red on master.

Recommendation: Do not rework this PR. Open a follow-up PR to add the REQ-MARKET-003 ledger row as promised by PR #293, which will allow master's policy-guard to return to green, after which this PR #294 can be reviewed and merged cleanly.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Rework bound reached: 3 refusals on one pull request

Closed by the forge at head d2fa44ba, not by a reviewer. The bound is 3 REQUEST_CHANGES verdicts: a further round on a branch that has failed review this often costs more than a fresh start from master with the record in hand.

Refusals:

The commits stay reachable from this pull request. Issue #292 returns to status:ready with this record; the next AUTHOR run starts from master and reads every verdict above before claiming it.

@github-actions github-actions Bot closed this Sep 8, 2026
@github-actions
github-actions Bot deleted the claude/issue-292-provenance-self-test branch September 8, 2026 04:34
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.

Ledger provenance self-test rejects the required pre-merge row shape

0 participants