Skip to content

test(lineage): cover nested dangling rollback - #3010

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/lineage-order-independence
Jul 17, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/lineage-order-independence

Conversation

@Sinity

@Sinity Sinity commented Jul 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds deterministic production-route lineage regressions for nested dangling ancestry and failure after full-replace graph resolution.

Problem

The existing lineage suite covered direct dangling cuts and caller-owned rollback, but not a descendant inheriting through a parent whose own branch point disappeared, nor an exception after real graph resolution.

Solution

The new tests assert physical message rows, resolved link rows, composed transcript, typed completeness, atomic rollback, and repeated-retry convergence through write_parsed_session_to_archive. A resolved relation remains resolved when only its historical branch-point message is absent; the typed degraded state is LineageCompleteness(dangling_branch_point).

Ref polylogue-866e.

Verification

  • devtools test tests/unit/storage/test_lineage_normalization.py -k "nested_dangling or full_replace_graph_failure" — 2 passed.
  • POLYLOGUE_HYPOTHESIS_REUSE_FAILURES=1 devtools test tests/property/test_write_path_state_machine.py — 3 passed.
  • devtools test -k session_links — 5 passed.
  • devtools test -k composed — 6 passed.
  • devtools verify --seed-testmon --skip-slow — 15,933 recorded, zero failures.
  • POLYLOGUE_PYTEST_WORKERS=0 devtools verify — passed. The default parallel repeat hit the separately tracked xdist collection-divergence pathology before tests ran.

Summary by CodeRabbit

  • Bug Fixes

    • Improved lineage handling when ancestor branch points are missing, preserving reachable message history while accurately marking incomplete lineage.
    • Ensured failed full-replacement writes roll back completely, allowing safe retries without data corruption or duplicate changes.
  • Tests

    • Added regression coverage for dangling lineage branches, transactional rollback, and idempotent repeated writes.

Problem: lineage coverage did not prove a dangling ancestor propagated\nthrough a descendant or that a full replacement could roll back after graph\nresolution.\n\nWhat changed: add production-route regressions that assert physical rows,\nlink state, composed content, completeness, rollback, and idempotent retry.\n\nRef polylogue-866e.\n\nCo-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 38473028-a82f-43f7-832c-b01199fd23c7

📥 Commits

Reviewing files that changed from the base of the PR and between 314bcb0 and 030fbb6.

📒 Files selected for processing (1)
  • tests/unit/storage/test_lineage_normalization.py

📝 Walkthrough

Walkthrough

Adds two storage regression tests covering dangling ancestor lineage normalization and atomic full-replacement rollback with idempotent retries.

Changes

Lineage normalization regressions

Layer / File(s) Summary
Dangling ancestor lineage handling
tests/unit/storage/test_lineage_normalization.py
Verifies descendant reads retain reachable message tails, report dangling_branch_point lineage truncation, and preserve physical messages and session links.
Replacement rollback and retry
tests/unit/storage/test_lineage_normalization.py
Injects a graph-resolution failure, verifies complete state rollback, then confirms repeated full replacements converge idempotently.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/lineage-order-independence

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 2211f97 into master Jul 17, 2026
1 of 2 checks passed
@Sinity
Sinity deleted the feature/fix/lineage-order-independence branch July 17, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant