Skip to content

feat(ci): add tests and md files#7

Merged
calvinbrewer merged 1 commit intomainfrom
public-prep
Nov 19, 2024
Merged

feat(ci): add tests and md files#7
calvinbrewer merged 1 commit intomainfrom
public-prep

Conversation

@calvinbrewer
Copy link
Copy Markdown
Contributor

No description provided.

@calvinbrewer calvinbrewer merged commit 637e0e2 into main Nov 19, 2024
@calvinbrewer calvinbrewer deleted the public-prep branch November 19, 2024 16:41
calvinbrewer pushed a commit that referenced this pull request Feb 10, 2025
…ncrypt-decrypt-opt

Add service token as encrypt and decrypt opt
coderdan added a commit that referenced this pull request May 4, 2026
…invariant

Two fixes from a smoke-test run on the supatest spike project.

Fix 1: backfill / drop never wrote `.cipherstash/migrations.json`

The manifest was modelled as the *intent* leg of the three-source
state model (intent in repo, EQL config in DB, runtime state in
cs_migrations) but no CLI command actually wrote the file —
`writeManifest` was exported from @cipherstash/migrate but never
called from the CLI. Plan and status emitted "no manifest" forever
and the drift-detection features were dead code.

Wired:
- New `upsertManifestColumn(table, column, cwd?)` in
  @cipherstash/migrate. Reads the existing manifest (or starts
  fresh), replaces the matching column entry under the named table,
  writes back. Preserves entries for other columns / other tables.
- New `setManifestTargetPhase(table, columnName, phase, cwd?)` —
  no-op when the column isn't tracked yet, used by `drop` to bump
  intent forward.
- `backfill.ts` calls `upsertManifestColumn` after the dual-write
  confirmation. The entry is derived from the encryption client's
  EncryptedTable schema (cast_as → manifest.castAs, configured
  index kinds → manifest.indexes); pkColumn flows through when
  the user passed `--pk-column`. targetPhase defaults to
  `cut-over`. Idempotent — re-runs replace the same entry.
- `drop.ts` calls `setManifestTargetPhase(... 'dropped')` after
  the migration file is written, so the manifest reflects the
  user's commitment to fully removing the plaintext column.

Cutover doesn't touch the manifest (current state lives in
cs_migrations; the manifest is only intent).

10 new tests in @cipherstash/migrate covering upsert idempotence,
target-phase update, and the no-op-when-untracked path.

Fix 2: bundler-exclusion invariant promoted

The skill mentioned that `@cipherstash/stack` must be excluded from
bundling (it wraps a native FFI module) but in a single line buried
in Installation. Claude missed it on the smoke test, then hit the
runtime crash.

- AGENTS-doctrine.md gains it as invariant #7 — the seventh
  "never break this" rule, alongside never-log-plaintext and
  jsonb-null-on-creation. Concrete config snippets for Next.js,
  webpack, esbuild, and Vite SSR included so the agent doesn't have
  to guess the field names.
- stash-encryption skill's Installation section gets a more
  prominent callout (`> [!IMPORTANT]`) plus the same per-bundler
  snippets.
- setup-prompt.ts adds it to path 1 step 1 ("if this is the first
  encrypted column in the project, configure the bundler exclusion
  first") and to path 3 schema-add as the same precondition.

The exclusion now appears at every layer the agent reads: doctrine,
skill, and project-specific action prompt. Test asserts
`serverExternalPackages` and `@cipherstash/protect-ffi` appear in
the rendered prompt.
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