Skip to content

test(ai-persistence): static tests for the persistence adapter skills #1919

Closed

Description

@tombeckenham

Problem

The persistence adapter skills in packages/ai-persistence/skills/ai-persistence/ have no tests. An agent following build-drizzle-adapter on Postgres wrote only chat_threads and chat_runs and dropped chat_interrupts and chat_metadata. PR #1918 fixed the skill text. Nothing stops the next regression.

Goal

Deterministic checks that run in pnpm test:pr and fail when a recipe is incomplete or does not compile. No LLM in the loop. Agent evals are a separate follow-up.

Tasks

  1. Type-check the skill snippets with kiira. kiira.config already includes packages/*/skills/**/*.md, but the adapter blocks are marked ts ignore because they import @/db, @/db/schema, drizzle-orm, pg, and @prisma/client. Add those as docs-only dev deps and tsconfig.docs.json path stubs for the app-local imports, then drop ignore on the schema and store blocks in build-drizzle-adapter (SQLite and Postgres), build-prisma-adapter, and build-custom-adapter. Follow .agent/self-learning/lessons/2026-06-23-authoring-kiira-doc-snippets.md and kiira-ci-setup.md.
  2. Run the conformance suite on the recipe code. Extract each recipe's chat-persistence.ts block into a vitest file under packages/ai-persistence/skills-test/ (or similar) and call runPersistenceConformance from @tanstack/ai-persistence/testkit against it. Drizzle: node:sqlite and PGlite (@electric-sql/pglite, new dev dep). Custom: PGlite via the pg-compatible driver. Prisma: skip if it needs a generated client; say so in the PR. Extraction can be a small script that pulls the fenced block by a marker comment so the test and the skill cannot drift.
  3. Lint for all four tables. A small test that asserts each of build-drizzle-adapter, build-prisma-adapter, build-custom-adapter, and build-cloudflare-adapter names all four tables (threads, runs, interrupts, metadata) and all four store factories in defineAIPersistence.
  4. Wire into an Nx target that test:pr already runs (test:lib in packages/ai-persistence is fine).

Out of scope

Agent evals (claude plugin eval, fixture apps, pass-rate thresholds). Track separately.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions