feat: add native compiled pattern state API - #116
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new intentionally narrow “native compiled pattern” API for the named linear-token-sequence (LTS) profile in reggie-runtime, enabling span extraction without materializing inputs or touching the general compiler/cache paths.
Changes:
- Introduces new public native-compilation API types (
ReggieCompiledPattern, request/flag/result/rejection types) that only use the direct named-only LTS admission path. - Adds
ReggieMatchStateto hold per-input, single-thread-confined match state that stores only absolute spans (no retained input). - Extends
LinearTokenSequenceMatcherwith workspace reuse and named-group index helpers, plus tests validating cache non-mutation, span behavior, and parallel state usage.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| reggie-runtime/src/test/java/com/datadoghq/reggie/runtime/ReggieCompiledPatternTest.java | Adds coverage for new native compiled-pattern API behavior (admission/rejection, spans, cache invariants, parallel state). |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieMatchState.java | Implements single-thread-confined match state that stores spans only and exposes group span APIs. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieCompileRequest.java | Adds immutable request record for the native compilation profile. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieCompileFlag.java | Defines the restricted native-profile flags (NONE, DOTALL) and maps to ReggieFlags. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieCompiledPattern.java | Adds entry point for native compilation and state creation. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieCompilationResult.java | Adds admitted/rejected result wrapper for native compilation attempts. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieCompilationRejection.java | Adds public rejection reasons for native compilation. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/LinearTokenSequenceMatcher.java | Exposes workspace reuse + group helpers needed by ReggieMatchState. |
| reggie-runtime/src/main/java/com/datadoghq/reggie/ReggieFlags.java | Adds ReggieFlags.NONE constant. |
💡 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: c744977779
ℹ️ 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".
c744977 to
05c4e5e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## agent/logs-reggie-l1e #116 +/- ##
=======================================================
Coverage 84.4% 84.4%
Complexity 1 1
=======================================================
Files 147 153 +6
Lines 43087 43180 +93
Branches 5891 5896 +5
=======================================================
+ Hits 36394 36475 +81
- Misses 4906 4914 +8
- Partials 1787 1791 +4
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
05c4e5e to
ffc87e1
Compare
ffc87e1 to
561a013
Compare
Summary
Adds a deliberately narrow native compiled-pattern API for the named linear-token-sequence profile:
NONEandDOTALLnative-profile flags;String, subsequence,MatchResult, fallback matcher, or compiler-cache entry.The API invokes only the L1e direct native-admission path. Rejection remains explicit and never falls through to the general compiler or JDK fallback.
Validation
./gradlew :reggie-runtime:test --tests com.datadoghq.reggie.runtime.ReggieCompiledPatternTest --tests com.datadoghq.reggie.runtime.NamedOnlyLtsAdmissionTest./gradlew :reggie-runtime:test./gradlew spotlessApply./gradlew jacocoVerify build