Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/omnibase_core/validation/validator_occ_merge_eligibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
ModelOccEligibilityResult,
)
from omnibase_core.validation.validator_receipt_gate import (
_CONTRACT_SHA256_REQUIRED_AFTER,
_extract_ticket_ids,
_iter_dod_evidence,
)
Expand Down Expand Up @@ -181,9 +182,28 @@ def validate_occ_merge_eligibility(
f"expected {ticket_id}"
),
)
# OMN-13061: hard-fail when contract_sha256 is None — mirrors
# validator_receipt_gate post-cutoff enforcement (OMN-10421).
# The migration window closed on _CONTRACT_SHA256_REQUIRED_AFTER
# (2026-04-30); all receipts authored after that date must bind
# a contract hash. Historical corpus scanners are ADVISORY only
# (OMN-13060 follow-through unchanged).
if receipt.contract_sha256 is None:
pass
elif receipt.contract_sha256 != contract_hash:
return ModelOccEligibilityResult(
eligible=False,
reason=EnumOccEligibilityReason.CONTRACT_HASH_MISMATCH,
ticket_ids=ticket_ids,
occ_commit_sha=snapshot.occ_commit_sha,
contract_hashes=contract_hashes,
receipt_ids=tuple(sorted(receipt_ids)),
detail=(
f"receipt {receipt_path} missing required contract_sha256 field "
f"(OMN-10421 / OMN-13061): receipts produced after "
f"{_CONTRACT_SHA256_REQUIRED_AFTER.date()} must record the "
"contract hash. Rerun probes to produce a new receipt."
),
)
if receipt.contract_sha256 != contract_hash:
return ModelOccEligibilityResult(
eligible=False,
reason=EnumOccEligibilityReason.CONTRACT_HASH_MISMATCH,
Expand Down
16 changes: 11 additions & 5 deletions tests/unit/validation/test_occ_merge_eligibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,21 @@ def test_contract_hash_mismatch_is_ineligible(tmp_path: Path) -> None:


@pytest.mark.unit
def test_missing_contract_hash_is_migration_compatible(tmp_path: Path) -> None:
contract_hash = _write_contract(tmp_path)
def test_missing_contract_hash_is_ineligible_post_cutoff(tmp_path: Path) -> None:
"""contract_sha256=None must hard-fail (OMN-13061 / OMN-10421 post-cutoff).

The migration window closed on 2026-04-30; receipts without a contract hash
no longer pass silently — this aligns with validator_receipt_gate behaviour.
"""
_write_contract(tmp_path)
_write_receipt(tmp_path, contract_sha256=None)

result = validate_occ_merge_eligibility(_snapshot(tmp_path))

assert result.eligible is True
assert result.reason is EnumOccEligibilityReason.ELIGIBLE
assert result.contract_hashes == {TICKET: contract_hash}
assert result.eligible is False
assert result.reason is EnumOccEligibilityReason.CONTRACT_HASH_MISMATCH
assert "contract_sha256" in (result.detail or "")
assert "OMN-10421" in (result.detail or "")


@pytest.mark.unit
Expand Down
Loading