Skip to content

test(native): pin PR #194 spike — 79-migration walk as CI gate#204

Merged
Dewinator merged 1 commit into
mainfrom
agent/migration-walk-test
May 3, 2026
Merged

test(native): pin PR #194 spike — 79-migration walk as CI gate#204
Dewinator merged 1 commit into
mainfrom
agent/migration-walk-test

Conversation

@Dewinator

Copy link
Copy Markdown
Owner

Summary

  • Walks every supabase/migrations/*.sql against an in-memory PGlite to pin PR docs(native-pg): re-validate spike — all 79 migrations green on PGlite (#177) #194's spike claim ("all 79 migrations green on PG 17.5 + pgvector 0.8.1") as a permanent CI gate.
  • Complementary to pglite-adapter.test.ts: that file pins the chain-shape contract; this one pins the migration corpus + runner contract (idempotency, ordering).
  • Four tests, all pass on a clean checkout of main (~16s wallclock, dominated by 4× full-corpus PGlite spin-up).

Why now

PR #194 documented "79/79 migrations green" as a finished spike on main. Without a regression test, the next PR that uses a Postgres-only feature PGlite can't honour (e.g. pg_stat_* views, LISTEN/NOTIFY, certain CREATE EXTENSION shapes) silently breaks the native-app boot path — npm run build would still pass while the Tauri shell would fail at first launch. This locks the claim into CI so the failure mode flips from "production-only" to "PR-time".

What's tested

  1. migration-walk: every *.sql applies cleanly + outcomes preserve lexicographic order. The runner sorts before walking and the bookkeeping table relies on that order so a partial run can be resumed deterministically.
  2. idempotency: a second applyMigrations() on the same PGlite handle marks every file skipped, applies none.
  3. RPC smoke (scalar + vector params only): match_memories_cognitive, dedup_similar_memories, forget_weak_memories, consolidate_memories — proves the post-migration RPC surface resolves through PGliteAdapter.
  4. empty-array → jsonb cast contract: serializeValue() in pglite.ts deliberately routes empty arrays through ::jsonb because TEXT[] vs JSONB ambiguity for [] is unresolvable without column metadata. Pinned so a future "helpful" attempt to make empty-array TEXT[]/UUID[] calls work surfaces this assumption rather than silently changing semantics.

Out of scope (deliberately)

  • UUID[]/TEXT[]-parameter RPCs (touch_memories, coactivate_memories, spread_activation, …). Those require the env-switch sub-task to also resolve the adapter's type-inference gap — see #184 follow-up. The pinned empty-array test documents the workaround consumers already use (arr.length > 0 guard).

Test plan

  • cd mcp-server && npm run build && node --test dist/__tests__/native/pglite-migration-walk.test.js → 4/4 pass on main
  • CI runs npm test (which globs dist/__tests__/**/*.test.js) — new file is picked up automatically, no script change needed
  • Sanity-check duration: ~16s on M-series; below the typical 2-minute CI per-file budget

Closes nothing — this is a regression-test follow-up to PR #194 / #185, complementary to pglite-adapter.test.ts. Atomic, depends only on what's already on main, no dependency on PR #202 or #203.

🤖 Generated with Claude Code

Walks every supabase/migrations/*.sql against an in-memory PGlite to lock
in the PR #194 claim ("all 79 migrations green on PG 17.5 + pgvector
0.8.1") so a future migration that uses a Postgres-only feature PGlite
can't honour breaks the build instead of breaking the native-app boot
path silently.

Four tests, complementary to pglite-adapter.test.ts (which pins the
chain-shape contract):

  1. migration-walk: every *.sql applies cleanly + outcomes preserve
     lexicographic order.
  2. idempotency: a second applyMigrations() on the same handle marks
     every file skipped, applies none.
  3. RPC smoke (scalar + vector params only): match_memories_cognitive,
     dedup_similar_memories, forget_weak_memories, consolidate_memories
     — proves the post-migration RPC surface resolves through the
     adapter on PGlite.
  4. empty-array → jsonb cast contract: serializeValue() in pglite.ts
     deliberately routes empty arrays through `::jsonb`; pinned so a
     future "helpful" attempt to make empty-array TEXT[]/UUID[] calls
     work surfaces this assumption.

Run locally:  cd mcp-server && npm run build && \
              node --test dist/__tests__/native/pglite-migration-walk.test.js
All four pass on main (~16s, dominated by 4× full-corpus PGlite spin-up).

Scoped intentionally narrow: UUID[]/TEXT[]-parameter RPCs (touch_memories,
coactivate_memories, spread_activation, …) require the env-switch sub-task
to also resolve the adapter's type-inference gap — out of scope here.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Dewinator Dewinator merged commit 25df030 into main May 3, 2026
1 check passed
Dewinator added a commit that referenced this pull request May 4, 2026
The previous "0 PRs offen" snapshot is stale: the agent itself opened a
4-PR queue in the last 4 ticks (#208 standalone + #209#210#211 stack).
Refresh the Aktiver-Code-Bestand block to credit landed sub-tasks (#202
DATA_DIR, #203 Tauri shell, #204 CI gate, #205 migration helpers) and
add a Queue-Stand note that names the open stack, the linear merge
constraint, and the ~19 still-supabase-direct services that the
DbClient migration sub-story will work through atomically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Dewinator added a commit that referenced this pull request May 4, 2026
…sks 1/2/3-most/4/5/7-core landed

The 09024a2 (tick 103) snapshot is two days stale: 9 of the 9 PRs in its
"recommended merge order" have merged, plus #197/#198/#201/#202/#203/#204/
#205/#206/#207 landed in the same window. Refresh the doc that "is the
canonical entry point for the native-app initiative" so a fresh reader
does not get a 79-tick-old picture.

Concrete changes:
- Phase line: "spike phase complete · gated on PR-queue drain" →
  "implementation underway · sub-tasks 1, 2, 3 (most), 4, 5, 7 (core)
  landed; 5 PRs open, ~26 h Reed-lag since #202#207".
- End-state installer list: ".dmg / .msi / .AppImage" → ".pkg / .msi /
  .AppImage", with the 2026-05-04 epic-body decision (.pkg, not .dmg)
  cited.
- Sub-task table: legend (✅ landed, 🔄 PR open, ⏳ spike-only) plus
  per-row PR status reflecting the current main:
  - Row 1 picks up #204 (79-migration walk as CI gate).
  - Row 3 picks up #202, #203, #206, #207 as landed and #208#211 as
    open. Row was "_none yet_".
  - Row 4 / 5 reframed as "inherent" (PGlite is one WASM binary;
    node-llama-cpp ships per-platform bindings).
  - Row 7 picks up #205 (Docker → PGlite migration helpers core).
- New "DbClient sub-story" subsection: 22 services touch Supabase
  directly on main; 2 in flight (Skills, SwarmPin); 20 remain after
  the open stack lands. Pattern: one service per PR.
- "Recommended merge order — open PR queue (9 deep)" section replaced
  with "Open PR queue (5 deep, all CLEAN+MERGEABLE)" — the 9 it
  documented have all merged.
- "Post-drain implementation gate" → "Post-stack implementation gate":
  parallel tracks (DbClient long-tail of 20 services + the sub-tasks
  6/8/9 release-pipeline triangle on tauri-plugin-updater per #207).

Doc-only, zero risk, direct-to-main per the standing rule for this
file shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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