Skip to content

feat(cli,examples,docs)!: de-suffix the init scaffold, rewrite examples/basic to v3, sweep the meta (EQL v2 removal PR 7)#776

Merged
tobyhede merged 2 commits into
remove-v2from
feat/remove-eql-v2-pr7-scaffold-examples-meta
Jul 24, 2026
Merged

feat(cli,examples,docs)!: de-suffix the init scaffold, rewrite examples/basic to v3, sweep the meta (EQL v2 removal PR 7)#776
tobyhede merged 2 commits into
remove-v2from
feat/remove-eql-v2-pr7-scaffold-examples-meta

Conversation

@tobyhede

@tobyhede tobyhede commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

PR 7 of the EQL v2 removal stack (#707), on top of remove-v2. Part of #752.

PRs 3–5 froze the target names — Encryption over EncryptionV3, encryptedSupabase as the v3 factory, stack-drizzle's ./v3 collapsed to root. Nothing type-checks the artefacts that describe those names, so three classes of them were left wrong.

What was broken

stash init scaffolded the deprecated name into customer source. init/utils.ts emitted EncryptionV3 in template literals. Commit 7b783eef fixed the drizzle half; the @cipherstash/stack/v3 half was missed, and utils-codegen.test.ts actively pinned the old form.

examples/basic had not compiled since the removal. It imported encryptedType (deleted in #770) and called the v2 encryptedSupabase({ encryptionClient, supabaseClient }) (deleted in #769). Root build/test filter to ./packages/*, so no example was ever compiled by CI — this sat on a fully green board.

Shipped skills inverted the Supabase naming. skills/ ships in the stash tarball and is copied into customer repos. stash-encryption and stash-cli both described encryptedSupabase as the legacy v2 wrapper; it is the v3 factory. stash-drizzle taught EncryptionV3 as canonical, contradicting stash-encryption, which correctly calls it deprecated.

Changes

@cipherstash/stack/v3 now re-exports Encryption. It exported EncryptionV3 but not the name it aliases, so the scaffold could not emit one clean import — and the deprecation example in v3.ts already told users to import Encryption from there, which did not resolve.

Scaffold and its tests flipped, with negative assertions added mirroring the drizzle precedent.

examples/basic ported to the v3 types.* factories. Its Supabase branch is deleted rather than ported: src/lib/supabase/ and src/queries/ imported a contactsTable that src/encryption/index.ts never exported, so they were already dead before this work — and examples/supabase-worker carries the Supabase story. Rebuilding a working demo there would mean authoring a table that never existed, which is example-writing, not v2 removal.

New turbo typecheck task gates examples/basic in CI so ^build builds its deps first. Verified the gate fails on the exact regression that shipped (reintroduced encryptedType, confirmed error TS2305, reverted).

Docs corrected: the @cipherstash/stack README claimed DynamoDB "still requires v2" and pointed at #657#768 removed the v2 write overloads and #657 is closed. The root README quickstart still taught the v2 chainable builders as its primary example.

Deliberately not in scope

The v2 CLI/database sections of docs/reference/supabase-sdk.md, packages/cli/README.md, and the db push / --eql-version 2 parts of skills/stash-cli are accurate today and move with the SQL teardown. Likewise the v2 read path documented in stash-dynamodb — that is intentional per design Decision 6.

Verification

code:check clean (0 errors), lint:package-paths, lint:runners, test:scripts, full build, cli suite (837), type tests for stack/drizzle/supabase, prisma-next + wizard typechecks, examples/basic typecheck, and the cjs-require circular-import guard — all pass.

18 @cipherstash/stack tests fail locally with Key provider error: Profile not found; they are credential-gated and CI supplies the CS_* secrets. The additive re-export's one real risk was the known index.ts ↔ v3.ts circular import, which cjs-require.test.ts guards — it passes.

Branch is rebased on remove-v2 — two commits, no merge commits. packages/stack-drizzle/README.md is fixed against the version currently on remove-v2; #775's rewrite of that file lands separately when remove-v2 next takes main, and will need the same EncryptionV3Encryption fix applied to its new text.

@tobyhede
tobyhede requested a review from a team as a code owner July 24, 2026 01:32
@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5282281

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

This PR includes changesets to release 11 packages
Name Type
stash Patch
@cipherstash/stack Patch
@cipherstash/basic-example Patch
@cipherstash/e2e Patch
@cipherstash/bench Patch
@cipherstash/prisma-next Patch
@cipherstash/stack-drizzle Patch
@cipherstash/stack-supabase Patch
@cipherstash/test-kit Patch
@cipherstash/prisma-next-example Patch
@cipherstash/wizard 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

@coderabbitai

coderabbitai Bot commented Jul 24, 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: c11246ff-b391-45d3-9595-dc09b22c59dc

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:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remove-eql-v2-pr7-scaffold-examples-meta

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.

@freshtonic freshtonic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

Reviewed the full diff against the PR branch source (base remove-v2). This is a well-scoped correctness sweep for the v2 removal — one small functional change plus scaffold/example/doc/skill corrections — and everything I checked holds up.

Verified

The one functional change — export { Encryption } from @cipherstash/stack/v3 (packages/stack/src/encryption/v3.ts)

  • Encryption is the value imported from @/ffi; the re-export is legitimate.
  • No duplicate-export hazard: @/eql/v3 (pulled in by the adjacent export *) exports no Encryption symbol, so export * + export { Encryption } can't collide. export const EncryptionV3 = Encryption already coexists with that export *, which is the same guarantee.
  • This is what makes the scaffold's emitted import { Encryption, encryptedTable, types } from '@cipherstash/stack/v3' resolve to a single specifier — the deprecation example in v3.ts had documented that import without it resolving.

Scaffold + its testsutils.ts flips every EncryptionV3Encryption (real template output + placeholder comments); utils-codegen.test.ts adds .not.toContain('EncryptionV3') negatives mirroring the drizzle precedent, so a regression to the deprecated name fails a test rather than shipping silently.

examples/basic — deleted src/lib/supabase/* and src/queries/contacts.ts are gone with no dangling importers; encrypt.ts / index.ts / src/encryption/index.ts are clean; tsconfig.json and the typecheck script exist; package name @cipherstash/basic-example matches the CI --filter. The turbo typecheck task's dependsOn: ["^build"] correctly builds stack/stack-drizzle/stash first, and the gate lands on the .github/workflows/tests.yml typecheck stage.

Doc/skill corrections are accurate, not aspirational — confirmed against packages/stack-supabase/src/index.ts on this branch: encryptedSupabase is the v3 factory and encryptedSupabaseV3 is export const … = encryptedSupabase (@deprecated). So the AGENTS.md / SECURITY.md / supabase-sdk.md / stash-cli / stash-encryption / stash-drizzle / stash-prisma-next edits all match reality. The "DynamoDB writes v3, reads v2" reframing lines up with the merged #725 work and the stack-encryption skill.

Changesetsstash + @cipherstash/stack patch covers scaffold + re-export + skills (skills ship in the stash tarball); @cipherstash/stack-drizzle patch covers the README. Correct.

Minor, non-blocking

  • turbo.json's new typecheck task sets "cache": false. Typecheck is deterministic and cacheable, but with a single consumer and no remote cache the win is negligible — fine as-is, just noting it's inconsistent with build being cached.

Couldn't independently run the live/credential-gated @cipherstash/stack suite (as the PR notes, those need CS_* secrets CI supplies), but the additive re-export's only real risk — the index.ts ↔ v3.ts circular import — is covered by cjs-require.test.ts. LGTM.

tobyhede added 2 commits July 24, 2026 11:42
…sic to v3

PRs 3-5 of the EQL v2 removal froze the target names, but nothing
type-checks the artefacts that describe them, so two were left wrong.

`stash init` scaffolded `EncryptionV3` into customer source. That name is
a deprecated alias now, and the scaffold is a template literal, so only an
assertion can catch it — the codegen tests pinned the old form, so they
are flipped with negatives added, mirroring the drizzle precedent from
7b783ee.

`@cipherstash/stack/v3` exported `EncryptionV3` but not `Encryption`, so
the scaffold could not emit a single clean import. Re-export it — the
deprecation example in v3.ts already told users to import it from there.

`examples/basic` had not compiled since the removal deleted
`encryptedType` and the v2 `encryptedSupabase`. Ported to the v3 types.*
factories. Its Supabase branch is deleted rather than ported: it imported
a `contactsTable` that was never exported, so it was already dead before
this work, and examples/supabase-worker carries the Supabase story.

Root `build`/`test` filter to ./packages/*, so CI never compiled any
example and the breakage sat on a green board. Gate examples/basic
through a new turbo `typecheck` task so `^build` builds its deps first.
Verified the gate fails on the exact regression that shipped.
PRs 3-5 froze the API names but the prose describing them was not swept,
so the shipped guidance told users the opposite of what the code does.

The worst of it is in skills/, which ship inside the stash tarball and get
copied into customer repos: stash-encryption and stash-cli both described
`encryptedSupabase` as the legacy EQL v2 wrapper. It is the EQL v3 factory
— the v2 wrapper was deleted in #769. stash-drizzle taught `EncryptionV3`
as the canonical client, contradicting stash-encryption, which correctly
calls it deprecated.

Also corrects the @cipherstash/stack README, the npm landing page, which
claimed DynamoDB "still requires v2" and pointed at #657#768 removed the
v2 write overloads and #657 is closed. The root README quickstart still
taught the v2 chainable builders as the primary example.

Reframes the "Legacy: EQL v2" sections to say what is actually true now: v2
is a read path, not an authoring surface. Left alone deliberately: the v2
CLI/database sections in supabase-sdk.md and the v2 read path in
stash-dynamodb — both accurate today, and the CLI text moves with the SQL
teardown.

`export { Encryption }` in v3.ts is ordered after the `export *` so Biome's
organizeImports is satisfied without detaching the comment from its subject.
@tobyhede
tobyhede force-pushed the feat/remove-eql-v2-pr7-scaffold-examples-meta branch from f2cccf8 to 5282281 Compare July 24, 2026 01:59
@tobyhede
tobyhede merged commit a16302f into remove-v2 Jul 24, 2026
14 checks passed
@tobyhede
tobyhede deleted the feat/remove-eql-v2-pr7-scaffold-examples-meta branch July 24, 2026 02:07
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.

2 participants