Skip to content

feat: add interruptible native matching - #117

Open
jbachorik wants to merge 1 commit into
agent/logs-reggie-l1ffrom
agent/logs-reggie-l1g
Open

feat: add interruptible native matching#117
jbachorik wants to merge 1 commit into
agent/logs-reggie-l1ffrom
agent/logs-reggie-l1g

Conversation

@jbachorik

Copy link
Copy Markdown
Collaborator

Summary

Adds opt-in cooperative interruption for the native named LTS API.

  • InterruptibleCharSequence supplies a caller-thread cancellation/deadline hook.
  • Plain CharSequence keeps the existing context-free matching path.
  • Interruptible inputs receive bounded 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
  • final implementation-plan validation: clean
  • final independent code review: clean

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 InterruptibleCharSequence as a CharSequence with a synchronous checkInterrupted() callback.
  • Adds an interruptible execution path in ReggieMatchState and LinearTokenSequenceMatcher using a checkpointing wrapper (bounded to every 256 charAt() 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.

FileDescription
reggie-runtime/src/test/java/com/datadoghq/reggie/runtime/InterruptibleCharSequenceTest.javaAdds coverage for interruptible matching behavior, checkpoint bounds, and state clearing semantics.
reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieMatchState.javaRoutes interruptible inputs to a new interruptible matcher path and tracks which path was used.
reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/LinearTokenSequenceMatcher.javaImplements checkpointing via a CharSequence wrapper and an interruptible match entrypoint.
reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/InterruptibleCharSequence.javaDefines the interruptible input contract and documents usage constraints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jbachorik
jbachorik marked this pull request as ready for review August 14, 2026 12:55

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@jbachorik
jbachorikforce-pushed the agent/logs-reggie-l1g branch from 6cd2d08 to 255bea4CompareAugust 14, 2026 13:05
@codecov-commenter

codecov-commenter commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (agent/logs-reggie-l1f@561a013). Learn more about missing BASE report.

Files with missing linesPatch %Lines
...ghq/reggie/runtime/LinearTokenSequenceMatcher.java85.7%2 Missing ⚠️
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 
Files with missing linesCoverage Δ
...atadoghq/reggie/runtime/ReggieCompiledPattern.java100.0% <100.0%> (ø)
...com/datadoghq/reggie/runtime/ReggieMatchState.java100.0% <100.0%> (ø)
...ghq/reggie/runtime/LinearTokenSequenceMatcher.java81.3% <85.7%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 561a013...f7b758a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jbachorik
jbachorikforce-pushed the agent/logs-reggie-l1g branch from 255bea4 to f3e412eCompareAugust 14, 2026 13:33
@jbachorik
jbachorikforce-pushed the agent/logs-reggie-l1g branch from f3e412e to f7b758aCompareAugust 14, 2026 13:42
Sign up for freeto 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.

3 participants

@jbachorik@codecov-commenter