feat: add bounded native pattern cache - #118
Conversation
There was a problem hiding this comment.
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
ReggieCompiledPatternCompilerwith an exact-capacity LRU cache and in-flight deduplication usingCompletableFuture. - Adds
ReggieNativeCompileBudgetand a new rejection reasonSOURCE_TOO_LONGfor 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.
There was a problem hiding this comment.
💡 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".
0bec80d to
4986ff3
Compare
Codecov Report❌ Patch coverage is 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
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
4986ff3 to
1cd9e2c
Compare
1cd9e2c to
9d259b3
Compare
Summary
Adds an opt-in, bounded, instance-owned cache for native named-LTS compiled patterns.
RuntimeCompilercaches remain untouched.Validation
./gradlew :reggie-runtime:test --tests com.datadoghq.reggie.runtime.ReggieCompiledPatternCompilerTest./gradlew :reggie-runtime:test./gradlew spotlessApply