fix(tdx-hydro): derive duplicate adjudication verdict - #212
Merged
CooperBigFoot merged 1 commit intoAug 10, 2026
Conversation
_adjudicate_duplicate previously returned BasinVerdict.SOURCE_DEFECT as an unconditional literal while computing but never consulting spatially_equal and coordinate_sequences_equal. The verdict is now derived by _derive_duplicate_verdict from the measured geometry. The rule is defined only over valid, finite, two-dimensional polygonal geometry; every other input refuses with ValueError before Shapely .equals() is reached. The emitted evidence records the raw measurements plus a machine-readable derivation rule and selected branch so a ledger reader can recompute the verdict.
CooperBigFoot
merged commit Aug 10, 2026
bd2606c
into
pce/close-the-seven-basin-coverage-gap/milestone-6
5 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_adjudicate_duplicatepreviously returnedBasinVerdict.SOURCE_DEFECTas an unconditional literal while computing, but never consulting,spatially_equalandcoordinate_sequences_equal.Derivation rule
The verdict is now derived by
_derive_duplicate_verdictfrom the measured geometry:spatially_equalis true — the twostreamID 9features describe the same ground written twice, which an adaptercould safely collapse, so the verdict is
BasinVerdict.ADAPTER_STRICTNESSand the selected branch issame_ground.spatially_equalandcoordinate_sequences_equalare both false — the two features describe different groundcolliding on one identifier, which no adapter-side deduplication can resolve without dropping a drainage unit, so
the verdict is
BasinVerdict.SOURCE_DEFECTand the selected branch isdifferent_ground.coordinate_sequences_equaltrue withspatially_equalfalse is mutually inconsistent and refuses.The rule is justified from source, not from the acquired data:
_validate_duplicate_idsrefuses on a bareCounterof
streamIDvalues without ever consulting geometry, so the adapter's refusal is unconditional on the duplicatecount — which is exactly what makes the two branches distinguishable. This change makes no prediction about which
branch basin
1020018110's acquired data selects.Refusal domain
The rule is defined only over non-empty, valid, finite, two-dimensional polygonal geometry. Every other input refuses with
ValueErrorbefore Shapely.equals()is reached.Evidence
The emitted evidence records the raw
spatially_equalandcoordinate_sequences_equalmeasurements, a machine-readable derivation rule, and the selected branch. A verdict-ledger reader can therefore recompute the verdict from the recorded measurements.Falsification
Reinstating a hardcoded verdict is caught by
test_duplicate_orchestration_derives_both_verdicts,test_duplicate_orchestration_uses_helper_result, andtest_duplicate_stream_id_extracts_both_coordinate_sequences.The full adapter suite passes 112 tests, and all five repository gates exit 0.
This step publishes no verdict ledger, contacts no external party, and touches no evidence tree.