Skip to content

fix: emit missing DFA_UNROLLED helpers in APT matchers - #147

Merged
jbachorik merged 2 commits into
mainfrom
fix/apt_fix
Oct 5, 2026
Merged

jbachorik merged 2 commits into
mainfrom
fix/apt_fix

Conversation

@jbachorik

Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes two places where annotation-processor (APT) matchers on the DFA_UNROLLED* path call a member the processor never generates. In both cases RuntimeCompiler already emits the member, so Reggie.compile works and only APT matchers fail.

  • Missing findMatchFromForMatch: tagged-DFA match() calls the private findMatchFromForMatch helper, which the processor never emitted, so match() threw NoSuchMethodError. Repro: (?i)^https?://. The processor now calls generateFindMatchFromMethodTaggedNoCut. That method now returns early unless useTaggedDFA && groupCount > 0, the only case in which match() calls the helper.
  • Missing lookup tables: the processor never called generateLookupTables, so charsets with 100+ ranges (e.g. .*[\p{IsAlphabetic}].*) threw NoSuchFieldError: $cs_0. The call now comes after every generate*Method.

Also adds two blank lines to AGENTS.md, written by the SessionStart hook.

Motivation

APT-generated matchers threw at runtime for patterns that work with Reggie.compile. This is the same dual-path gap as #136.

Related Issue(s)

Same class of bug as #136.

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring (no functional change)
  • Documentation
  • Test improvement
  • Build/CI change

Checklist

  • I have read the CONTRIBUTING.md guidelines
  • All existing tests pass (./gradlew build)
  • I have added tests for my changes
  • I have updated documentation (if applicable)
  • My commits are signed

Performance Impact

None. The change only adds members that were missing from generated classes.

Additional Notes

  • Verified with ./gradlew :reggie-processor:test :reggie-runtime:test :reggie-codegen:test. The full ./gradlew build has not been run.
  • Checked DFA_SWITCH and DFA_TABLE for the same gap; none found. Their private helpers (matchesAtStart, findMatchEnd, $nb_step_N, $fe_step_N) are emitted by the methods that call them, and DFA_TABLE decoders are runtime static methods.
  • New tests in ReggieMatcherBytecodeGeneratorTest: taggedDfaUnrolledMatchHelperIsGenerated and dfaUnrolledLookupTablesAreGenerated.

🤖 Generated with Claude Code

jbachorik and others added 2 commits October 5, 2026 14:37
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jbachorik jbachorik added the AI Generated or assisted by AI label Oct 5, 2026
@jbachorik
jbachorik marked this pull request as ready for review October 5, 2026 12:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T12:52:37.387321Z aecc3c4 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-prod-us1-3 datadog-prod-us1-3 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.

Bits Code Review: PASS

More details

The APT generator now emits both DFA_UNROLLED dependencies under the same conditions as their callers, matching the runtime compilation path.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit aecc3c4 · @DataDog review to ask questions

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.1%. Comparing base (2ad23b7) to head (aecc3c4).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../codegen/codegen/DFAUnrolledBytecodeGenerator.java 50.0% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              main    #147     +/-   ##
=========================================
+ Coverage     84.9%   85.1%   +0.2%     
  Complexity       1       1             
=========================================
  Files          163     163             
  Lines        49002   48870    -132     
  Branches      7009    6970     -39     
=========================================
+ Hits         41613   41614      +1     
+ Misses        5379    5255    -124     
+ Partials      2010    2001      -9     
Files with missing lines Coverage Δ
...ggie/processor/ReggieMatcherBytecodeGenerator.java 74.7% <100.0%> (+0.4%) ⬆️
.../codegen/codegen/DFAUnrolledBytecodeGenerator.java 95.5% <50.0%> (+5.2%) ⬆️

... and 5 files with indirect coverage changes


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 2ad23b7...aecc3c4. 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 merged commit a6aecf5 into main Oct 5, 2026
9 checks passed
@jbachorik
jbachorik deleted the fix/apt_fix branch October 5, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated or assisted by AI mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants