Repository navigation
fix(dives): exit a folded dive where the later record did, and backfill earlier folds - #343
Merged
Merged
Conversation
…ll earlier folds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ecording Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A fold's two records run one after the other, so its exit fix now comes from the later record's dive and its entry from the earlier one's (
fold_fixes), each falling back to the other where blank. That completes the by-side rule CNS, OTU and tank pressures already follow.backfill_folded_divesapplies that rule to dives merged before it existed. It finds each fold by itsmergeprofile and the absorbed dive by the soft-delete stamped in the same request. It takes the absorbed record's CNS and OTU from its files, since its recording row is gone, and its tanks and fixes from the soft-deleted dive. A fold is repaired in full only when it is its dive's only recording. Beside another recording (a second computer, or a later merge that moved it), and wherever the absorbed dive can't be singled out, only the readouts are repaired; the run logs that dive and counts it. Every change is logged as before -> after, and a second run changes nothing.To run on the flagship after this deploys, from the API service's shell:
python -m src.scripts.backfill_folded_dives --dry-run, then again without--dry-run.Verified with the full suite against Postgres, including fold tests for both record orders and backfill tests for a full repair, a dry run, a second run, an ambiguous window and a fold a later merge moved onto another computer's dive. The only failures were the two known ones a copied
src/.envcauses. mypy, ruff and mdformat are clean.🤖 Generated with Claude Code