Skip to content

fix(dives): exit a folded dive where the later record did, and backfill earlier folds - #343

Merged
aleskiontherun merged 4 commits into
mainfrom
claude/fold-exit-fix-and-backfill
Oct 17, 2026
Merged

aleskiontherun merged 4 commits into
mainfrom
claude/fold-exit-fix-and-backfill

Conversation

@aleskiontherun

Copy link
Copy Markdown
Member

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_dives applies that rule to dives merged before it existed. It finds each fold by its merge profile 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/.env causes. mypy, ruff and mdformat are clean.

🤖 Generated with Claude Code

aleskiontherun and others added 3 commits October 17, 2026 19:25
…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>
@github-actions github-actions Bot added the fix Set from the PR title by pr-title.yml label Oct 17, 2026
@aleskiontherun
aleskiontherun merged commit 8ef8b38 into main Oct 17, 2026
11 checks passed
@aleskiontherun
aleskiontherun deleted the claude/fold-exit-fix-and-backfill branch October 17, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Set from the PR title by pr-title.yml

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant