feat(cli): read EQL v3 install SQL from @cipherstash/eql at runtime (CIP-3518)#692
Open
coderdan wants to merge 1 commit into
Open
feat(cli): read EQL v3 install SQL from @cipherstash/eql at runtime (CIP-3518)#692coderdan wants to merge 1 commit into
coderdan wants to merge 1 commit into
Conversation
…CIP-3518) The v3 install SQL was vendored into packages/cli/src/sql/cipherstash-encrypt-v3.sql (~44k lines) by a build script (gen:eql-v3-sql), sha256-verified against the pinned @cipherstash/eql. That copy defeats the point of depending on @cipherstash/eql: it drifts from the pin on every bump (re-vendor required) and — as ~44k lines of plpgsql in the tree — made GitHub classify the whole repo as plpgsql (CIP-3518). Read it from the package at runtime instead: - `readV3InstallSql()` calls `@cipherstash/eql/sql` `readInstallSql()` (the same source the stack + prisma-next consume); the v3 branches of `loadBundledEqlSql` and `EQLInstaller` route to it, so `resolveBundledFilename` is now v2-only. - `@cipherstash/eql` moves devDependency → dependency, externalized in tsup so the real package (and its `dist/sql/*.sql`) resolves at runtime. - Delete `cipherstash-encrypt-v3.sql` + `scripts/build-eql-v3-sql.mjs` + the `gen:eql-v3-sql` script and its CI drift-check (tests.yml). No behaviour change: same one-artifact v3 bundle (self-adapts to non-superuser / Supabase via the DO-block privilege catch), v2 path untouched. A `@cipherstash/eql` bump now flows straight through. 557 cli unit green; bundle read verified via the bin from an external cwd. Claude-Session: https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
🦋 Changeset detectedLatest commit: 8d46579 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughChangesEQL v3 runtime source
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant EQLInstaller
participant readV3InstallSql
participant EQLPackage as `@cipherstash/eql`
EQLInstaller->>readV3InstallSql: request v3 install SQL
readV3InstallSql->>EQLPackage: readInstallSql()
EQLPackage-->>readV3InstallSql: return SQL bundle
readV3InstallSql-->>EQLInstaller: return SQL or wrapped error
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
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.
Why
The v3 install SQL was vendored into
packages/cli/src/sql/cipherstash-encrypt-v3.sql(~44k lines) by a build script (gen:eql-v3-sql), sha256-verified against the pinned@cipherstash/eql. That copy defeats the point of depending on@cipherstash/eql:What
Read it from the package at runtime instead —
@cipherstash/eqlis the single source of truth (the samereadInstallSql()the@cipherstash/stackinstaller and prisma-next already consume):readV3InstallSql()calls@cipherstash/eql/sqlreadInstallSql(); the v3 branches ofloadBundledEqlSqlandEQLInstallerroute to it, soresolveBundledFilenameis now v2-only.@cipherstash/eqlmoves devDependency → dependency, externalized intsupso the real package (and itsdist/sql/*.sql) resolves at runtime (the bin already externalizes all deps viaskipNodeModulesBundle).cipherstash-encrypt-v3.sql+scripts/build-eql-v3-sql.mjs+ thegen:eql-v3-sqlscript and its CI drift-check.Net: −44,130 lines. A
@cipherstash/eqlbump now flows straight through.No behaviour change
Same one-artifact v3 bundle. There is no Supabase/no-operator-family variant for v3 — the bundle self-adapts to non-superuser environments (its operator-class statements run inside a
DOblock that catchesinsufficient_privilegeand skips, then disables the ORE domains if absent). The v2 path (vendored.sql, variant selection) is untouched.Verified
readInstallSql()returns the v3 bundle (1.67 MB, correct content) resolved from the installed package.eql migrationdry-run on the stacked branch, which shares this installer code).pnpm install --frozen-lockfileconsistent.Changeset:
stashpatch.Follow-ups (separate): the v2 vendored files (~22k more plpgsql lines) still sit in the tree — fully closing CIP-3518 means dropping v2 or sourcing it likewise; and a repo-wide
@cipherstash/eql3.0.0 → 3.0.1 bump (npmlatest) with a prisma-next re-emit.https://claude.ai/code/session_01MxTTPaPP16m6br7Hoab94w
Summary by CodeRabbit
--latestoption.