test: add end-to-end rewrite-retention regression check (#200)#208
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdded an isolated end-to-end regression harness that generates synthetic Claude Code transcripts, simulates retention rewrites, scans results, and validates parity, restart stability, and optional baseline drift. ChangesRewrite-retention regression check
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/rewrite-retention-check/check_retention.py`:
- Around line 91-96: Update the R2 result construction around the same check so
its failure detail also reports cost-only drift, not just the existing diff()
output for integer totals. Preserve the current success message and integer-diff
reporting, while adding the relevant base/post cost differences when the cost
tolerance check is what makes same false.
In `@scripts/rewrite-retention-check/run_check.sh`:
- Around line 41-44: Update the scan function to set XDG_STATE_HOME and
XDG_DATA_HOME to the fake home alongside HOME when invoking the stats command,
ensuring the retention check uses only isolated fake state and data directories.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a576cdd1-dfa5-44e1-83b5-61f3c254ee9c
📒 Files selected for processing (5)
scripts/rewrite-retention-check/README.mdscripts/rewrite-retention-check/check_retention.pyscripts/rewrite-retention-check/gen_corpus.pyscripts/rewrite-retention-check/run_check.shscripts/rewrite-retention-check/simulate_rewrite.py
As offered in #200 — a self-contained e2e guard for the #204 fix.
What it does: generates a synthetic Claude Code corpus (streaming-duplicate
lines, skip-cases) under an isolated
$HOME, scans it with the built binary,simulates a resume/compact rewrite (drops the last N assistant
message-groups), rescans, and asserts:
SPLITRAIL_BASELINE_BIN=…3.5.9) demonstrates the pre-fix driftVerified: passes on 3.6.0; R2 fails on 3.5.9 as expected (that's the bug).
On my real ~50-day corpus the same protocol passed all four assertions
(details in #200). Touches nothing outside
scripts/rewrite-retention-check/;no real
~/.claudedata, no config, no upload path. Unix + python3 stdlib only.Happy to adjust layout/conventions or wire it into CI if you want it there.
Summary by CodeRabbit