fix(consolidation): default invalid dedup actions to keep#2565
Merged
benfrank241 merged 1 commit intoJul 7, 2026
Merged
Conversation
Member
|
lgtm. defaulting anything that isn't exactly merge/keep to keep is the right conservative call. Merging. Thanks! |
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.
Summary
Fixes #2545.
Consolidation dedup already defaulted a missing structured
actiontokeep, but near-miss or malformed action values from a lax structured-output model could still fail Pydantic validation before the conservative no-merge path ran.This adds a
mode="before"validator on_DedupDecision.actionthat:"merge"/"keep"decisions"keep"That keeps malformed dedup verdicts from accidentally merging observations or requeueing the consolidation job.
Tests
ruff check hindsight_api/engine/consolidation/consolidator.py tests/test_consolidation_dedup.pyruff format --check hindsight_api/engine/consolidation/consolidator.py tests/test_consolidation_dedup.pypython3 -m py_compile hindsight_api/engine/consolidation/consolidator.py tests/test_consolidation_dedup.pyMerge, list/dict values, and missing actionI could not run
pytest tests/test_consolidation_dedup.pyin this macOS arm64 environment:uv runresolvesonnxruntime==1.27.0, which has no wheel for the current Python/platform combo, and directPYTHONPATH=. pytest ... -o addopts=''cannot collect without the project runtime deps such asasyncpginstalled.Codex review noted a low-confidence import concern about
field_validator; the module already imports it from Pydantic andpy_compilepassed.