Skip to content

feat(stack-drizzle)!: remove EQL v2 root and collapse ./v3 to root#770

Open
tobyhede wants to merge 3 commits into
feat/remove-eql-v2-pr4-supabasefrom
feat/remove-eql-v2-pr5-drizzle
Open

feat(stack-drizzle)!: remove EQL v2 root and collapse ./v3 to root#770
tobyhede wants to merge 3 commits into
feat/remove-eql-v2-pr4-supabasefrom
feat/remove-eql-v2-pr5-drizzle

Conversation

@tobyhede

Copy link
Copy Markdown
Contributor

Part of the EQL v2 removal effort (#707). PR 5 of the linear stack — stacked on #769 (PR 4, stack-supabase).

⚠️ Draft: stacked on #769#768. Review/merge PRs 3 and 4 first. Diff shows only stack-drizzle (+ bench importer) changes on top of PR 4.

What this does

Removes the EQL v2 root from @cipherstash/stack-drizzle and collapses ./v3., per the design §"PR 5".

  • Deleted the v2 root (src/index.ts, src/operators.ts, src/schema-extraction.ts) — confirmed v2-only (eql_v2_encrypted type, @cipherstash/stack/schema imports) — plus two v2-only query-builder test files.
  • ./v3. hard break, no alias (Decision 5): moved src/v3/*src/*, de-suffixed createEncryptionOperatorsV3/extractEncryptionSchemaV3 to unsuffixed. Removed the ./v3 export block and typesVersions from package.json; root keeps import+require.
  • packages/bench importer fixed and given a real build (tsc --noEmit) script it previously lacked, so the importer is guarded in CI.
  • Skill (stash-drizzle), README, changeset (stack-drizzle: major, stash: patch) updated.

Green gate

build ✓ · test:types 7 pass · test 364 pass (all mock-driven, 0 skipped) · bench tsc --noEmit exit 0 · code:check 0 errors.

Decision 6

The deleted v2 root was authoring/query-building only — no decrypt path lived there (decrypt is via @cipherstash/stack). The v3 codec + its 26-test round-trip suite are retained; read coverage is not dropped.

Notes for reviewer

  • Bench sql/schema.sql v3 index SQL is best-effort, not live-validated — the eql_v3.eq_term/match_term/ste_vec index-term function names weren't run against a live EQL v3 DB (no creds). Verify against the installed bundle before relying on bench numbers. Outside the build/typecheck gate.
  • examples/basic (also a drizzle importer) intentionally left for PR 7.
  • AGENTS.md / SECURITY.md meta-honesty sweep deferred to PR 7.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f45eba37-b2b9-4035-9f0b-6dbe34319b1e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remove-eql-v2-pr5-drizzle

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8b1a459

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@cipherstash/stack-drizzle Major
stash Major
@cipherstash/bench Patch
@cipherstash/basic-example Patch
@cipherstash/e2e Patch
@cipherstash/stack Major
@cipherstash/stack-supabase Major
@cipherstash/prisma-next Major
@cipherstash/wizard Major
@cipherstash/test-kit Patch
@cipherstash/prisma-next-example Patch

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

Delete the EQL v2 authoring surface (`src/index.ts` `encryptedType` +
config extraction, `src/operators.ts`, `src/schema-extraction.ts`) and
promote the EQL v3 implementation from `./v3` to the package root as a
hard break with no alias.

- Drop the `./v3` subpath from the `exports` map and remove `typesVersions`;
  the v3 impl now lives at `src/*` and is the sole `.` export.
- De-suffix the public API: `createEncryptionOperatorsV3` ->
  `createEncryptionOperators`, `extractEncryptionSchemaV3` ->
  `extractEncryptionSchema`. No `*V3` aliases (they would type-check v2 call
  sites against v3 semantics).
- Delete the two v2 operator test files; move the v3 test suite to
  `__tests__/*` and repoint imports. ESM+CJS both preserved.
- Fix the `@cipherstash/bench` importer: rewrite the Drizzle table to v3
  `types.*` domains + `EncryptionV3`, switch operator usages off the removed
  v2-only ops (`like`/`ilike`, jsonb-path) to `matches`/`contains`/`selector`,
  and update the bench fixture schema.sql to the eql_v3 domains/index terms.
- Update the README and the bundled `stash-drizzle` skill to the collapsed
  root imports; remove v2 authoring guidance.

Existing v2 ciphertext still decrypts via `@cipherstash/stack`; only the
Drizzle-side v2 authoring/query-building is removed (Decision 6).

BREAKING CHANGE: `@cipherstash/stack-drizzle` no longer exports an EQL v2
surface and the `./v3` subpath is removed. Import the v3 API from the package
root with the de-suffixed names.
@tobyhede
tobyhede force-pushed the feat/remove-eql-v2-pr5-drizzle branch from a1bfe1a to 36b099b Compare July 23, 2026 02:07
…ollapse

PR 3 made EncryptionV3 an overloaded alias; ReturnType<typeof EncryptionV3>
now resolves to the nominal overload (EncryptionClient) not the typed client.
Infer through a single-signature helper so the bench handle keeps the typed
client type.
@tobyhede
tobyhede force-pushed the feat/remove-eql-v2-pr5-drizzle branch from 2a1dca6 to 30e7b55 Compare July 23, 2026 02:17
…the image

The bench fixture schema moved to concrete EQL v3 domains
(`public.eql_v3_text_search`, `eql_v3.eq_term(...)`), but tests-bench.yml
started `postgres-eql:17-2.3.1` — which ships EQL v2 — and ran the suite
immediately. `applySchema` failed with `type "public.eql_v3_text_search" does
not exist`. Nothing tied the image tag to the EQL version the fixtures need,
so the coupling broke silently.

Install v3 the way every integration suite already does: a vitest
`globalSetup` calling test-kit's `installEqlV3`, which shells out to the real
`stash eql install --eql-version 3`. That needs only a database URL — no
CipherStash credentials — so `db-only.test.ts` stays the credential-free smoke
test it is meant to be, and CI and `pnpm test:local` become the same path
rather than CI depending on a step the local flow never ran.

The globalSetup imports `@cipherstash/test-kit/install` (a new narrow subpath
export) rather than the barrel: the barrel reaches `needle-for.ts`, which
consumes stack source through the `@/` alias, and bench has no
`stackSourceAlias` in its vitest config. `install.ts` depends on node builtins
only.

Workflow changes:
- Use the `integration-setup` composite, which already builds the `stash` CLI
  the install needs (pinned to this job's existing Node 22).
- Start only the `postgres` service; docker-compose.yml also defines a
  PostgREST that bench never talks to.
- Widen the trigger paths to follow the package graph. bench depends on
  `@cipherstash/stack` and `@cipherstash/stack-drizzle`, and now on the CLI's
  EQL installer, but the filter covered only `packages/bench/**` and
  `local/**` — a break upstream could never trigger this job.

No changeset: `@cipherstash/bench` and `@cipherstash/test-kit` are both
private, and workflow files are repo tooling.
@tobyhede
tobyhede marked this pull request as ready for review July 23, 2026 04:43
@tobyhede
tobyhede requested a review from a team as a code owner July 23, 2026 04:43
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.

1 participant