Skip to content

Remove vestigial progress-chain parent repair#175

Merged
cboos merged 1 commit into
mainfrom
wf/simplify/drop-progress-repair
May 30, 2026
Merged

Remove vestigial progress-chain parent repair#175
cboos merged 1 commit into
mainfrom
wf/simplify/drop-progress-repair

Conversation

@cboos
Copy link
Copy Markdown
Collaborator

@cboos cboos commented May 29, 2026

What

Removes the _scan_file_progress / _scan_progress_chains / _repair_parent_chains trio from converter.py and its two call sites (directory and single-file load).

Net: −90 lines of code, plus a test-file trim (+20 / −244 overall).

Why it's safe

The trio was superseded by the PassthroughTranscriptEntry mechanism. Since progress entries carry uuid+sessionId, they are parsed as Passthrough nodes that sit in the DAG as valid parents — so _repair_parent_chains (which explicitly skips entries already present in the parsed set) could only ever fire for a progress entry lacking a sessionId. That case occurs in none of the real fixtures (0/11 progress entries), and even the synthetic test helper sets a sessionId, so the prior unit tests already asserted no-op behavior.

In that (unreachable) case the new behavior is not byte-identical to the old repair: instead of re-nesting the orphaned child under the dropped entry's nearest surviving ancestor, build_dag clears the dangling parentUuid and promotes the child to a root — a tree-shape difference, plus possibly an orphan warning. It degrades gracefully and never crashes.

Removing the trio also eliminates a redundant directory re-scan in the directory-load path.

Verification

  • Neutering _repair_parent_chains to a no-op left the full unit + snapshot suite passing unchanged, confirming behavior-neutrality on all reachable inputs.
  • After the change: full unit + snapshot suite 1907 passed, 7 skipped; pyright claude_code_log/converter.py clean; ruff check + format clean.

Tests

Drops the unit tests that exercised the deleted helpers (they asserted no-op behavior). Keeps the genuine behavioral guarantees — no orphan warnings, and progress-as-Passthrough on real data — under a renamed TestProgressEntryPassthrough.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Simplified transcript DAG construction by restructuring progress entry handling. Progress entries are now represented as distinct node types within the transcript hierarchy instead of being processed through an automatic repair mechanism. Removed automatic parent link adjustments that previously corrected UUID references when progress entries were dropped during conversion operations.

Review Change Stack

The _scan_file_progress / _scan_progress_chains / _repair_parent_chains
trio was superseded by the PassthroughTranscriptEntry mechanism. Since
`progress` entries carry uuid+sessionId, they are parsed as Passthrough
nodes that sit in the DAG as valid parents — so the repair only ever
fired for a progress entry lacking a sessionId, a case that occurs in no
real transcript.

In that (unreachable) case the new behavior is not byte-identical to the
old repair: instead of re-nesting the orphaned child under the dropped
progress entry's nearest surviving ancestor, build_dag clears the
dangling parentUuid and promotes the child to a root (dag.py:190-222) —
a tree-shape difference, plus possibly a non-suppressed orphan warning
(the debug-suppression only covers progress passthroughs). It degrades
gracefully, never crashes.

Verified behavior-neutral on all reachable inputs: neutering
_repair_parent_chains to a no-op left the full unit + snapshot suite
passing unchanged. Removing the trio and its two call sites (directory +
single-file load) drops a whole parse-time pass and a redundant
directory re-scan.

Tests: drop the unit tests that exercised the deleted helpers (they
already asserted no-op behavior) and keep the genuine behavioral
guarantees — no orphan warnings and progress-as-Passthrough on real
data — under a renamed TestProgressEntryPassthrough.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a9fb6f1e-62ca-427b-86bc-69cb3f8623d2

📥 Commits

Reviewing files that changed from the base of the PR and between 6392821 and 453fd88.

📒 Files selected for processing (2)
  • claude_code_log/converter.py
  • test/test_dag_integration.py
💤 Files with no reviewable changes (1)
  • claude_code_log/converter.py

📝 Walkthrough

Walkthrough

The PR removes internal progress chain repair logic from the converter module and updates integration tests. Three helper functions and their invocation sites are deleted, eliminating post-load parent-link rewrites for progress entries. Tests are refactored to validate that progress entries now function as PassthroughTranscriptEntry DAG nodes without requiring repair.

Changes

Progress chain repair removal and validation

Layer / File(s) Summary
Remove progress chain repair helpers
claude_code_log/converter.py
_scan_file_progress, _scan_progress_chains, and _repair_parent_chains functions and their internal section are deleted, eliminating the logic that mapped and rewrote parentUuid fields around dropped progress entries.
Remove repair invocations from conversion pipeline
claude_code_log/converter.py
The post-load "Repair parent chains" step is removed from load_directory_transcripts, and the single-file "Repair progress chain gaps" block is removed from convert_jsonl_to. Both conversion paths no longer invoke progress-chain scanning or repair.
Test refactoring for passthrough entry validation
test/test_dag_integration.py
Internal progress-helper imports are removed; unit-test classes for scanning and repairing are replaced by TestProgressEntryPassthrough, which verifies that progress entries appear as PassthroughTranscriptEntry nodes and that downstream entries reference those progress UUIDs as valid DAG parents.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 The chains are mended now with grace,
No scanning through each progress trace,
The passthrough nodes do hold their place,
As orphans fade without a trace!
Links preserved through DAG's embrace. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Remove vestigial progress-chain parent repair' accurately summarizes the main change: removing three progress-chain repair functions and their call sites from the converter.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 wf/simplify/drop-progress-repair

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 and usage tips.

@cboos cboos added the cleanup Code and test clean-ups label May 29, 2026
@cboos cboos merged commit 1b79151 into main May 30, 2026
11 checks passed
cboos added a commit that referenced this pull request May 30, 2026
Records Wave A + detail-visibility as merged (PRs #175-178, #181) and the
current sequential track opp 1 -> 6 -> 7 (stacked branches/PRs).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code and test clean-ups

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant