Skip to content

feat: add bounded native pattern cache - #118

Open
jbachorik wants to merge 1 commit into
agent/logs-reggie-l1gfrom
agent/logs-reggie-l1h
Open

feat: add bounded native pattern cache#118
jbachorik wants to merge 1 commit into
agent/logs-reggie-l1gfrom
agent/logs-reggie-l1h

Conversation

@jbachorik

Copy link
Copy Markdown
Collaborator

Summary

Adds an opt-in, bounded, instance-owned cache for native named-LTS compiled patterns.

  • Successful native patterns are cached with exact LRU capacity.
  • Rejections are never cached; legacy RuntimeCompiler caches remain untouched.
  • Equal concurrent requests share in-flight admission; clear and exceptional admission behavior are deterministic and tested.

Validation

  • ./gradlew :reggie-runtime:test --tests com.datadoghq.reggie.runtime.ReggieCompiledPatternCompilerTest
  • ./gradlew :reggie-runtime:test
  • ./gradlew spotlessApply
  • 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 an opt-in, bounded, instance-owned cache for native named linear-token-sequence (LTS) compiled patterns, including a configurable “maximum source length” budget gate and single-flight behavior for concurrent identical compile requests.

Changes:

  • Introduces ReggieCompiledPatternCompiler with an exact-capacity LRU cache and in-flight deduplication using CompletableFuture.
  • Adds ReggieNativeCompileBudget and a new rejection reason SOURCE_TOO_LONG for over-budget requests.
  • Adds comprehensive unit tests covering LRU eviction/recency, cache independence, deterministic exceptional admissions, and budget boundary + concurrency behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieCompiledPatternCompiler.java New bounded, instance-owned LRU cache + in-flight single-flight admission mechanism.
reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieNativeCompileBudget.java New budget type for rejecting overly long sources prior to admission/in-flight registration.
reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieCompiledPattern.java Refactors compilation entry to route through tryCompileNative helper used by the compiler.
reggie-runtime/src/main/java/com/datadoghq/reggie/runtime/ReggieCompilationRejection.java Adds SOURCE_TOO_LONG rejection reason.
reggie-runtime/src/test/java/com/datadoghq/reggie/runtime/ReggieCompiledPatternCompilerTest.java New tests for LRU behavior, independence, concurrency single-flight, clear-during-admission, and exceptional admissions.
reggie-runtime/src/test/java/com/datadoghq/reggie/runtime/ReggieNativeCompileBudgetTest.java New tests for budget validation, UTF-16 length semantics, and concurrency behavior under budget rejection.

💡 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-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: 0bec80d15e

ℹ️ 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-l1h branch from 0bec80d to 4986ff3 Compare August 14, 2026 13:05
@codecov-commenter

codecov-commenter commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.41758% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.4%. Comparing base (f7b758a) to head (9d259b3).

Files with missing lines Patch % Lines
.../reggie/runtime/ReggieCompiledPatternCompiler.java 86.8% 7 Missing and 3 partials ⚠️
...atadoghq/reggie/runtime/ReggieCompiledPattern.java 40.0% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##             agent/logs-reggie-l1g    #118     +/-   ##
=========================================================
- Coverage                     84.4%   84.4%   -0.1%     
  Complexity                       1       1             
=========================================================
  Files                          153     155      +2     
  Lines                        43194   43283     +89     
  Branches                      5898    5910     +12     
=========================================================
+ Hits                         36498   36571     +73     
- Misses                        4906    4918     +12     
- Partials                      1790    1794      +4     
Files with missing lines Coverage Δ
...ghq/reggie/runtime/ReggieCompilationRejection.java 100.0% <100.0%> (ø)
...oghq/reggie/runtime/ReggieNativeCompileBudget.java 100.0% <100.0%> (ø)
...atadoghq/reggie/runtime/ReggieCompiledPattern.java 70.0% <40.0%> (-30.0%) ⬇️
.../reggie/runtime/ReggieCompiledPatternCompiler.java 86.8% <86.8%> (ø)

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 f7b758a...9d259b3. 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-l1h branch from 4986ff3 to 1cd9e2c Compare August 14, 2026 13:33
@jbachorik
jbachorik force-pushed the agent/logs-reggie-l1h branch from 1cd9e2c to 9d259b3 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