Skip to content

feat: add native compiled pattern state API - #116

Open
jbachorik wants to merge 1 commit into
agent/logs-reggie-l1efrom
agent/logs-reggie-l1f
Open

feat: add native compiled pattern state API#116
jbachorik wants to merge 1 commit into
agent/logs-reggie-l1efrom
agent/logs-reggie-l1f

Conversation

@jbachorik

Copy link
Copy Markdown
Collaborator

Summary

Adds a deliberately narrow native compiled-pattern API for the named linear-token-sequence profile:

  • immutable request/result/pattern types with only NONE and DOTALL native-profile flags;
  • a per-input, single-thread-confined match state that retains spans but never the input;
  • whole-match and named-group absolute span access without creating a 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
  • final implementation-plan validation: clean
  • final independent code review: clean

Copilot AI 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

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 ReggieMatchState to hold per-input, single-thread-confined match state that stores only absolute spans (no retained input).
  • Extends LinearTokenSequenceMatcher with 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.

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

@chatgpt-codex-connector chatgpt-codex-connector Bot 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: 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".

@jbachorik
jbachorik force-pushed the agent/logs-reggie-l1f branch from c744977 to 05c4e5e Compare August 14, 2026 13:05
@codecov-commenter

codecov-commenter commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.09677% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.4%. Comparing base (362ae27) to head (561a013).

Files with missing lines Patch % Lines
...atadoghq/reggie/runtime/ReggieCompiledPattern.java 66.6% 5 Missing and 1 partial ⚠️
...adoghq/reggie/runtime/ReggieCompilationResult.java 73.3% 2 Missing and 2 partials ⚠️
...ghq/reggie/runtime/LinearTokenSequenceMatcher.java 88.8% 1 Missing and 1 partial ⚠️
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     
Files with missing lines Coverage Δ
...rc/main/java/com/datadoghq/reggie/ReggieFlags.java 100.0% <ø> (ø)
...ghq/reggie/runtime/ReggieCompilationRejection.java 100.0% <100.0%> (ø)
...om/datadoghq/reggie/runtime/ReggieCompileFlag.java 100.0% <100.0%> (ø)
...datadoghq/reggie/runtime/ReggieCompileRequest.java 100.0% <100.0%> (ø)
...com/datadoghq/reggie/runtime/ReggieMatchState.java 100.0% <100.0%> (ø)
...ghq/reggie/runtime/LinearTokenSequenceMatcher.java 80.8% <88.8%> (+0.4%) ⬆️
...adoghq/reggie/runtime/ReggieCompilationResult.java 73.3% <73.3%> (ø)
...atadoghq/reggie/runtime/ReggieCompiledPattern.java 66.6% <66.6%> (ø)

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 362ae27...561a013. Read the comment docs.

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

@jbachorik
jbachorik force-pushed the agent/logs-reggie-l1f branch from 05c4e5e to ffc87e1 Compare August 14, 2026 13:33
@jbachorik
jbachorik force-pushed the agent/logs-reggie-l1f branch from ffc87e1 to 561a013 Compare August 14, 2026 13:42
@jbachorik
jbachorik requested a review from Zenithar August 14, 2026 14:47
Sign up for free to 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