feat: add interruptible native matching - #117
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in cooperative interruption mechanism for Reggie’s native LinearTokenSequence-based matching, allowing callers to supply a cancellation/deadline hook via an InterruptibleCharSequence while preserving existing behavior for plain CharSequence inputs.
Changes:
- Introduces
InterruptibleCharSequenceas aCharSequencewith a synchronouscheckInterrupted()callback. - Adds an interruptible execution path in
ReggieMatchStateandLinearTokenSequenceMatcherusing a checkpointing wrapper (bounded to every 256charAt()calls). - Adds targeted runtime tests validating checkpoint frequency, exception identity propagation, and match-state clearing on cancellation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| reggie-runtime/src/test/java/com/datadoghq/reggie/runtime/InterruptibleCharSequenceTest.java | Adds coverage for interruptible matching behavior, checkpoint bounds, and state clearing semantics. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieMatchState.java | Routes interruptible inputs to a new interruptible matcher path and tracks which path was used. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/LinearTokenSequenceMatcher.java | Implements checkpointing via a CharSequence wrapper and an interruptible match entrypoint. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/InterruptibleCharSequence.java | Defines the interruptible input contract and documents usage constraints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6cd2d0882b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
6cd2d08 to
255bea4
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## agent/logs-reggie-l1f #117 +/- ##
=======================================================
Coverage ? 84.4%
Complexity ? 1
=======================================================
Files ? 153
Lines ? 43194
Branches ? 5898
=======================================================
Hits ? 36498
Misses ? 4906
Partials ? 1790
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
255bea4 to
f3e412e
Compare
f3e412e to
f7b758a
Compare
Summary
Adds opt-in cooperative interruption for the native named LTS API.
InterruptibleCharSequencesupplies a caller-thread cancellation/deadline hook.CharSequencekeeps the existing context-free matching path.charAt()checkpoints, with exception identity preserved and match state cleared on cancellation.Validation
./gradlew :reggie-runtime:test --tests com.datadoghq.reggie.runtime.InterruptibleCharSequenceTest./gradlew :reggie-runtime:test./gradlew spotlessApply