Skip to content

fix(search,minimize): validate replay outcomes and allow deadlocked invariant minimization - #51

Merged
SamuelIVX merged 2 commits into
mainfrom
fix/trace-replayer-and-delta-debugger
Oct 12, 2026
Merged

SamuelIVX merged 2 commits into
mainfrom
fix/trace-replayer-and-delta-debugger

Conversation

@SamuelIVX

Copy link
Copy Markdown
Owner

Description

This PR addresses PR 1 from the approved remediation plan:

  1. Item 1 (TraceReplayer): Replay execution now checks that each step execution outcome matches the outcome recorded in the trace. On divergence, it fails fast by throwing a newly introduced CorruptedTraceException instead of silently stepping into inconsistent states.
  2. Item 3 (DeltaDebugger): isStillFailing now evaluates invariant violations directly when an invariant is present, removing the restrictive !config.isDeadlockCandidate() check. Invariant violations occurring in deadlocked terminal configurations are now properly recognized and can be minimized by ddmin.

Verification

  • Added test coverage:
    • TraceReplayerTest: verified outcome verification and fail-fast CorruptedTraceException behavior on mismatch.
    • DeltaDebuggerTest: verified minimization of an invariant violation in a deadlocked terminal configuration.
  • ./gradlew test: 529 tests pass.
  • ./gradlew check: clean build and verification.
  • ./gradlew javadoc: passes with strict doclint (-Werror).
  • ./gradlew --max-workers=1 -PpitestThreads=1 pitest: mutation ratchet passes at 255/268 (95.15%) >= 94%.

…nvariant minimization

- TraceReplayer now executes each step and verifies that the actual
  StepOutcome matches the recorded trace outcome, failing fast with
  CorruptedTraceException on divergence.
- DeltaDebugger.isStillFailing evaluates invariant violations directly
  when an invariant is present, allowing counterexamples in deadlocked
  configurations to be minimized.
- Add test coverage in TraceReplayerTest and DeltaDebuggerTest.

Co-authored-by: Codex <noreply@openai.com>
@github-actions

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository YAML (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 57c91550-e3e1-40d8-9233-1cf28f4d1764

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository YAML (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 100d330c-ecc5-4ff5-8e90-b14205d5ab3f


📥 Commits

Reviewing files that changed from the base of the PR and between 5247280 and 242400f.



📒 Files selected for processing (5)
  • src/main/java/dev/samhb/interleave/minimize/DeltaDebugger.java
  • src/main/java/dev/samhb/interleave/search/CorruptedTraceException.java
  • src/main/java/dev/samhb/interleave/search/TraceReplayer.java
  • src/test/java/dev/samhb/interleave/minimize/DeltaDebuggerTest.java
  • src/test/java/dev/samhb/interleave/search/TraceReplayerTest.java


Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Mutation
  • GitHub Check: Build
  • GitHub Check: Analyze (java-kotlin)


🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

📓 Path-based instructions (4)
Apply implementation criteria to production and example code.

⚙️ CodeRabbit configuration file

Files:

  • src/main/java/dev/samhb/interleave/search/CorruptedTraceException.java
  • src/main/java/dev/samhb/interleave/minimize/DeltaDebugger.java
  • src/main/java/dev/samhb/interleave/search/TraceReplayer.java

Review tests and fixtures for their ability to detect plausible regressions in the behavior or contract under test.

⚙️ CodeRabbit configuration file

Files:

  • src/test/java/dev/samhb/interleave/minimize/DeltaDebuggerTest.java
  • src/test/java/dev/samhb/interleave/search/TraceReplayerTest.java

Prioritize correctness, security, data integrity, and user-visible regressions.

⚙️ CodeRabbit configuration file

Files:

  • src/main/java/dev/samhb/interleave/search/CorruptedTraceException.java
  • src/main/java/dev/samhb/interleave/minimize/DeltaDebugger.java
  • src/test/java/dev/samhb/interleave/minimize/DeltaDebuggerTest.java
  • src/test/java/dev/samhb/interleave/search/TraceReplayerTest.java
  • src/main/java/dev/samhb/interleave/search/TraceReplayer.java

Source excerpt: CodeRabbit’s 80% docstring threshold is a minimum acceptance check, not a documentation target.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • src/main/java/dev/samhb/interleave/search/CorruptedTraceException.java
  • src/main/java/dev/samhb/interleave/minimize/DeltaDebugger.java
  • src/test/java/dev/samhb/interleave/minimize/DeltaDebuggerTest.java
  • src/test/java/dev/samhb/interleave/search/TraceReplayerTest.java
  • src/main/java/dev/samhb/interleave/search/TraceReplayer.java



🔇 Additional comments (5)
src/main/java/dev/samhb/interleave/search/CorruptedTraceException.java (1)

1-16: LGTM!


src/main/java/dev/samhb/interleave/search/TraceReplayer.java (1)

37-44: Replay trusts the recorded outcome when it builds the successor.

Line 44 passes the recorded outcome to config.successor. The check on Lines 38-43 guarantees outcome == actualOutcome, so the behavior is correct. The code is clearer if it uses actualOutcome here.

The replay Javadoc also drops the old precondition about aligned lists and valid IDs. trace.outcomes().get(i) throws IndexOutOfBoundsException if the lists have different sizes. The @throws clause covers this case.

No defect found.


src/test/java/dev/samhb/interleave/search/TraceReplayerTest.java (1)

15-54: LGTM!


src/main/java/dev/samhb/interleave/minimize/DeltaDebugger.java (1)

105-105: LGTM!


src/test/java/dev/samhb/interleave/minimize/DeltaDebuggerTest.java (1)

96-147: LGTM!





📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Trace replay now detects when an action’s actual outcome differs from the recorded trace, rather than continuing with inconsistent results.
    • Invariant violations can be identified and minimized even when replay ends in a deadlock or termination state.
📝 Summary

Walkthrough

Trace replay now checks executed step outcomes against recorded outcomes and reports mismatches with CorruptedTraceException. Delta debugging now recognizes invariant violations in deadlocked or terminated configurations.

Changes

Trace handling

Layer / File(s) Summary
Replay outcome validation
src/main/java/dev/samhb/interleave/search/CorruptedTraceException.java, src/main/java/dev/samhb/interleave/search/TraceReplayer.java, src/test/java/dev/samhb/interleave/search/TraceReplayerTest.java
TraceReplayer.replay compares each executed step outcome with the recorded outcome and throws CorruptedTraceException when they differ. Tests cover matching outcomes and a mismatch.
Invariant violations in deadlocked configurations
src/main/java/dev/samhb/interleave/minimize/DeltaDebugger.java, src/test/java/dev/samhb/interleave/minimize/DeltaDebuggerTest.java
DeltaDebugger accepts an invariant failure as a violation regardless of termination or deadlock. A test verifies minimization retains the write that causes the violation.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix



Merge Risk: ⚪ Minimal · up to 24240

Replay now fails fast when a recorded outcome disagrees with the executed step, and minimization now handles invariant violations in deadlocked configurations. No concrete merge-blocking risk was found.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly summarizes both primary changes: replay outcome validation and deadlocked invariant minimization.
Description check Passed The description directly explains the replay validation and deadlocked invariant minimization changes, and it includes relevant verification details.
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.



✨ Finishing Touches
📝 Generate docstrings



🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Completed: Generate docstrings for PR #51 — View commit 01d9aac

@SamuelIVX
SamuelIVX merged commit 6f69389 into main Oct 12, 2026
11 checks passed
@SamuelIVX
SamuelIVX deleted the fix/trace-replayer-and-delta-debugger branch October 12, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant