feat(native): migrate SkillsService onto DbClient + shared dbClient (#176, stacked on #210)#211
Conversation
…dbClient (#176) Second service migrated off the (supabaseUrl, supabaseKey) constructor pattern, stacked on PR #210. Also renames the previously per-service PostgrestClient instance into a shared `dbClient` so subsequent migrations can reuse it instead of allocating their own. Why SkillsService is the right second target after SwarmPin: it is RPC-only (3 methods, all `.rpc()`, no `.from()` chains) and the `.rpc(name, args)` shape is identical across PostgrestClient and PGliteAdapter. That keeps the migration trivially safe — no surface- area widening question to debate per call site. The local widening cast at each `.rpc()` call site is needed because TypeScript can't unify the two backends' rpc signatures even though both return `{ data, error }` at runtime. Same pattern as the swarm-pin `.from()` widening in PR #210, just narrower (per-call instead of per-method-block). Validation: rm -rf dist && npm run build → clean node --test dist/__tests__/affect-skill-record-payload.test.js → 8/8 node --test dist/__tests__/swarm-pin.test.js → 14/14 node --test dist/__tests__/db-client.test.js → 4/4 node --test 'dist/__tests__/*.test.js' → 1010 pass / 1 skip / 0 fail Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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>
…ture) + 26h Reed-lag Last refresh (ec8a088, tick 173) captured the 4-PR native-app cluster (#208/#209/#210/#211) right after Reed drained #202-#207. Tick 174 then opened PR #212 (W4.1 echo-chamber row 4), which is off-track from the native-app cluster — it's a Wave-4 fixture PR against issue #196, not a DbClient or sidecar-bundle PR. CLAUDE.md still framed the queue as 4 PRs all in one narrative; this corrects it to 5 PRs with the fixture-PR called out separately, and surfaces the empirical Reed-lag (≈26 h since the 2026-05-03 10:24 UTC merge wave) so the next tick has the right baseline for the queue-too-deep guard. Also corrects ~21 → 22 (true grep count today on main) for the Supabase-direct service file count, with explicit "verbleibend nach Merge: 20" so the next DbClient-migration tick can locate the right service to pick. No production code touched; pure CLAUDE.md doc-accuracy fix, direct-to-main per the agent-loop convention for risk-free doc refreshes.
…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>
Local stack validation — combined merge clean (190th tick, 2026-05-04)CI runs each PR isolated; this exercises the combined result of merging #209 → #210 → #211 in order, which is what StepsResults
The single skipped test is pre-existing (not introduced by this stack — same skip count on Merge-order noteBases chain — autonomous tick / agent |
The bird's-eye doc lagged the 2026-05-03 merge wave (PRs #202–#207 landing sub-tasks 1, 2, 3-scaffold, 4, 5, 7-core) and the W3 spike chain that settled the empirical mDNS budgets on `main`. Changes: - Wave 1 row: 9-PR queue → 5-PR queue (#208 sidecar bundling closing sub-task 3; #209→#210→#211 linear DbClient migration stack; unrelated W4.1 fixture #212). Note the 22-services DbClient sub-story with 2 already in flight. - Wave 3 row: design-spike-only → 11-spike chain on `main` with named empirical budgets (64 KiB / 2 000 ms hostile-fetch, 5-s/3-fail heartbeat → 15 s eviction, ~1.3 s cold-rebrowse settle, 260 ms wake republish, 4 000 ms blocked-network threshold from K=10 trials). Cross-platform re-validation (Linux/Avahi, Windows) named as the open item before locking the library pick. - Wave 1 narrative: matches the 5-PR reality, removes stale "9 PRs 998/999 tests green" claim, keeps the queue-drain gate on sub-tasks 6/8/9/10. Verified: 11 spike files in experiments/swarm-discovery/, PRs #202–#207 all merged (gh pr list --state merged), 5 open PRs all CLEAN+MERGEABLE. Refresh date bumped to 2026-05-04. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…sub-task 3 After PR #210 (SwarmPin) and #211 (Skills) the canonical native-app-track.md just says "20 services remain" — but doesn't tell Reed which one to pick next, what shape each one is (Group A constructor-only vs Group B full SwarmPin-style swap), or how big it is. Adds docs/native-dbclient-migration-tracker.md with a per-service table: LOC, .from() / .rpc() callsite counts, current import (PostgrestClient vs SupabaseClient), and a recommended PR order (Group A smallest-first, then Group B smallest-first, then the agent-bus layer last). Linked from native-app-track.md DbClient sub-story section so it surfaces when Reed (or the next agent tick) picks PR #213. Empirical counts via grep against main HEAD a1fb5de — methodology block included so the table is reproducible. The numbers are upper bounds (some hits are in comments/strings); order-of-magnitude is what matters. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Empirical: combined-stack tip is greenLocal validation on the linear merge state of #209 → #210 → #211 (PR head Extends the 190th-tick validation (which only covered #209 + #210) — adding No conflicts surfaced; rebase order Reed will use is |
204th-tick empirical merge-order proof — full stack lands clean on latest mainVerified the full DbClient stack (#209 → #210 → #211) merges cleanly into the current Method: fetched all three PR refs, branched Merge result: No conflicts. Implication for Reed's merge: the stack is one-shot mergeable in stack order (#209 → #210 → #211) without rebase. GitHub's Queue orthogonality (5 PRs): #208 (sidecar) and #212 (W4.1 row 4 echo-chamber) are independent of the DbClient stack — different file trees ( 🤖 Posted by autonomous tick (mycelium 204th) |
214th-tick — DbClient stack rebases cleanly + 1046/1047 tests green on top of current
|
Summary
Second service migrated off the
(supabaseUrl, supabaseKey)constructor pattern and onto the sharedDbClientsurface. Stacked on PR #210 (SwarmPin migration), which is itself stacked on PR #209 (DbClient factory). Both must merge first.Why SkillsService is the right next target
RPC-only — 3 methods (
record,stats,recommend), all.rpc(name, args), no.from()chains. The.rpc()shape is identical acrossPostgrestClientandPGliteAdapter(both returnPromise<{ data, error }>— the adapter contract tests gate that). So unlike SwarmPin (which had to widen.from()chains), Skills has nothing surface-area-y to debate.149 LOC, 8 contract tests on the pure helper (
buildSkillRecordPayload), no class-level test to update. Smaller surface than SwarmPin.Changes
mcp-server/src/services/skills.ts:DbClient(PostgrestClient | PGliteAdapter) instead of(url, key).@supabase/postgrest-jsimport; pullsDbClienttype fromdb-client.js..rpc()call site widens locally with a typed cast — TypeScript can't unify the two backends' rpc method signatures even though both return{ data, error }at runtime. Same pattern as the swarm-pin.from()widening in PR feat(native): migrate SwarmPinService onto DbClient (#176, stacked on #209) #210, just narrower (per-call instead of per-method-block).mcp-server/src/index.ts:swarmPinDbClient→dbClient(shared instance for all migrated services).SkillsServicenow also takesdbClient.PostgrestClient(instead ofcreateDbClient()) is unchanged from feat(native): migrate SwarmPinService onto DbClient (#176, stacked on #209) #210:MYCELIUM_USE_PGLITE=1mode-switch lights up once boot goes async, which is worth doing once enough services consume DbClient to make the blast radius pay off.Validation
Stacking
Base:
agent/swarm-pin-dbclient-stacked(PR #210). When #210 merges, GitHub auto-rebases this PR's base to main.Test plan
dbClientnaming reads well across the index.ts service-construction blockMigration train so far
.from()chains +defaultDeps()wideningcausal.ts(151 LOC) orrelations.ts(207 LOC)~15 services still on the legacy pattern.
Related
🤖 Generated with Claude Code