Repository navigation
regex_match gates fail in the standalone runtime: Cannot find module 're2js' - #623
Merged
Merged
Conversation
|
Important Review skippedThis PR was authored by a bot without an assigned CodeRabbit review seat. Ask an organization administrator to assign a seat to the bot. See the seat-assignment guide. After the seat is assigned, request a review again. ⚙️ Run configuration
You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
|
@coderabbitai review |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix bundled
regex_matchgates by embedding the pinned RE2 engine source in the SDK.Standalone CLI and authored Node bundles previously tried to resolve
re2jsbeside the executing bundle, where no package exists. Lowering now imports a committed compressed CJS source constant, so both bundles can emit self-contained gate commands. The generator checks the CJS engine, compares inflated bytes and version, and preserves an existing equivalent embed.re2jsis pinned to 2.8.6 so validation and execution use the same version. Regenerate withnpm run gen:re2js --prefix packages/sdk; generation is deliberately separate from build.Regression coverage includes an unconditional esbuild bundle executed outside the checkout, passing and failing gate verdicts, an installed-engine drift check, and a regex gate in the existing Bun 1.4.0 standalone lifecycle case. Named gates remain inside each producer's spec; the authored journal now includes
run-3andcomplete-4.The commands and literal outputs below cover 139 focused tests, 21 standalone/live-journal tests, SDK typechecking/build, and generated-source checks. The full SDK suite was not run. The standalone suite requires Bun exactly 1.4.0: another version fails its hook rather than skipping. Setup transcripts are committed in kernel-build.txt and bun-install.txt.
The unconditional bundle regression was mutation-verified by restoring the original lowering file from HEAD, capturing MODULE_NOT_FOUND, restoring the fixed bytes, and capturing the pass. The two diffs and both outputs are included below. A separate version mutation changes RE2JS_VERSION from 2.8.6 to 2.8.5, captures
--checkfailing, restores the original bytes, and captures success.Tradeoffs: bundles contain both the validation engine and the compressed execution source. The generated constant is about 81 KB; the journaled command remains about 82 KB, as before. Level 9 compression changes the emitted command bytes (and therefore hashes of specs containing regex gates) relative to the old default compression. Subsequent regeneration preserves compressed bytes when the inflated source and version agree.
CI coverage comes from
.github/workflows/cloud-runtime-artifact.yml, whose SDK job runs the whole vitest suite. Its PR paths coverpackages/sdk/**, including engine dependency bumps, but a future change only toscripts/generate-re2js-embed.mjswould not trigger it. No workflow files were changed. Implementation stays on the requested current branch; no PR was opened or merged.check-1.txt
check-2.txt
check-3.txt
check-4.txt
generate-again.txt
live-tests.txt
mutation-revert.diff
mutation-reverted.txt
mutation-restore.diff
mutation-restored.txt
version-stale.txt
version-restored.txt
Checks
Relayflow found no way to run this repository's tests — no check command, no CI test job it could follow, no test target and no recognised project file — so no checks ran. Review the change with that in mind.
Fixes #457
Note
Medium Risk
Changes how regex gates are lowered and executed in bundled/standalone paths; stale embed or version skew would break gates, and command-byte changes affect specs containing regex gates.
Overview
Fixes
regex_matchgates in standalone and esbuild-bundled runtimes that previously failed withCannot find module 're2js'because lowering resolved the package at emit time.named-gate-loweringnow inlines the RE2 engine from a committedre2js-embedded.tsconstant (RE2JS_DEFLATED_BASE64+ version) instead of readingnode_modulesviacreateRequire. Gate commands stay self-containednode -esnippets that inflate and eval the pinned CJS source.Adds
scripts/generate-re2js-embed.mjsandnpm run gen:re2jsto regenerate or--checkstaleness against installedre2js. The dependency is pinned to2.8.6. Regression tests cover embed drift, a temp-dir esbuild bundle withNODE_PATHcleared, and aregex_matchstep in the Bun standalone lifecycle fixture (journal expectations updated for a third gated run).Tradeoff: ~81 KB generated embed in the SDK; level-9 compression can change journaled gate command bytes (and thus hashes) vs the old runtime deflate default.
Reviewed by Cursor Bugbot for commit a0d56a8. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes
regex_matchgates in standalone bundles failing withCannot find module 're2js'by embedding a committed, compressed copy of the RE2 engine source in the SDK, so both standalone CLI and authored Node bundles are self-contained. Fixes #457.re2jsis pinned to exactly2.8.6;npm run gen:re2js --prefix packages/sdkregenerates the embed, and the generator's--checkmode verifies it is current.Written for commit a0d56a8. Summary will update on new commits.