Verification — P1.5.9 Model Candidates Table Population

Task: P1.5.9 — Phase 1.5 graduation Wave 1 (foundation). Branch: feature/p1-5-9-candidates. Implementation commit: 90d0401b. Verification date: 2026-05-13.

1. Acceptance criteria (from staging file §”Acceptance criteria”)

# Criterion Result Evidence
1 Migration named with the next sequential number after the final Phase 0 migration PASS src/db/migrations/009_model_candidates.sql; last shipped on main was 008_experience_tokens.sql
2 8 total rows in mcp_model_candidates post-migration PASS Test T5: seeds exactly 8 rows (15 tests pass)
3 All 8 expected model_ids present (Claude Sonnet, Haiku, GPT-4o, GPT-4o mini, Gemini 1.5 Pro, Llama 3.3 70B, Mixtral 8x22B, Kimi K2) PASS Test T6: seeds all 8 expected model_ids
4 Columns per row: model_id, provider, context_window_tokens, latency_tier, cost_bps_per_kilotoken, domain_fit_profile, enabled (default false for 7 new rows) PASS Test T9: matches the contract row values byte-for-byte
5 Column values match concept doc §”Phase 1.5 candidate cohort” exactly PASS Tests T6 + T9; rows pinned in docs/contracts/p1-5-9-candidates-contract.md §2.1 against the concept doc cohort table
6 Migration is idempotent (INSERT OR IGNORE on PK) PASS Test T12: is idempotent — re-running the migration body keeps 8 rows
7 Migration is reversible — DOWN section deletes the 7 new rows PASS (manual) DOWN block present at the bottom of 009_model_candidates.sql (commented per Phase 0 convention — see 002/007/008)
8 npm run build && npm run lint && npm test green PASS Tail captured in §3

2. Contract invariants (from docs/contracts/p1-5-9-candidates-contract.md §6)

# Invariant Result Evidence
I1 Exactly 8 rows post-migration PASS T5, T6
I2 Exactly one row has enabled = 1 and its model_id = 'claude-sonnet-3-5' PASS T7, T8
I3 Re-running the migration body is idempotent PASS T12
I4 domain_fit_profile is in [0, 255] and non-zero for every row PASS T10 (also asserts pairwise distinctness)
I5 latency_tier ∈ {'fast', 'balanced', 'slow'} for every row PASS T2 (CHECK constraint) + T9 (every seeded value lies in the set)
I6 cost_bps_per_kilotoken ≥ 0 for every row PASS rejects cost_bps_per_kilotoken below 0 test + T9
I7 Migration uses only -- line comments PASS Manually verified (grep -E '/\*' src/db/migrations/009_model_candidates.sql returns nothing)
I8 No Phase 0 code path mutates the table PASS git diff --stat origin/main..HEAD shows zero source-file changes outside src/db/migrations/ and src/__tests__/db/migrations/
I9 Forward-compat: model_id is the PK PASS CREATE TABLE line in migration PRIMARY KEY (model_id) (implicit via inline PRIMARY KEY)

3. Test gate evidence

3.1. npm run build

> colibri@0.0.1 build
> tsc


> colibri@0.0.1 postbuild
> node scripts/copy-migrations.mjs

copy-migrations: copied 9 migration(s) E:\AMS\.worktrees\claude\p1-5-9-candidates\src\db\migrations -> E:\AMS\.worktrees\claude\p1-5-9-candidates\dist\db\migrations

Result: green. The postbuild step copied 9 migrations (was 8 on main), confirming the new file is picked up.

3.2. npm run lint

> colibri@0.0.1 lint
> eslint src

Result: green. Zero lint output, zero violations introduced.

3.3. npm test

First run hit the documented pre-existing consensus/parity-harness G7.1 performance flake (5361ms vs 5000ms budget). Per the dispatch packet, this is a known post-R91 flake; the test was rerun. Tail of the green second run:

Test Suites: 70 passed, 70 total
Tests:       3117 passed, 3117 total
Snapshots:   0 total
Time:        31.548 s, estimated 46 s
Ran all test suites.

Test count delta: main c44e709f ships 3102 tests; this branch ships 3117 tests (+15). The new 15 tests are the file at src/__tests__/db/migrations/009-model-candidates.test.ts:

  • schema (5): T1 table exists, T2/T3/T4 CHECK constraints, plus a cost-bps-negative CHECK test.
  • seed (7): T5 row count, T6 ID presence, T7 exactly-Sonnet-enabled, T8 seven-disabled, T9 byte-for-byte values, T10 distinct bitmasks, plus a provider-list sanity assertion.
  • idempotency + tracking (3): T11 user_version bump, T12 re-execution of the migration body, plus a re-initDb runner-level idempotency test.

The pre-existing consensus/parity-harness G7.1 flake recurred once (see Common Verification Failures in colibri-verification/SKILL.md); it does not block the gate per dispatch packet authorization.

4. Surface delta

$ git diff --stat origin/main..HEAD
 docs/audits/p1-5-9-candidates-audit.md                       | 301 +++++
 docs/contracts/p1-5-9-candidates-contract.md                 | 284 +++++
 docs/packets/p1-5-9-candidates-packet.md                     | 208 +++++
 docs/verification/p1-5-9-candidates-verification.md          | ??? (this file)
 src/__tests__/db/migrations/009-model-candidates.test.ts     | 372 +++++
 src/db/migrations/009_model_candidates.sql                   | 110 +++

(File-count line will land once this file is committed; pre-commit status above.)

No files outside docs/audits/, docs/contracts/, docs/packets/, docs/verification/, src/db/migrations/, or src/__tests__/db/migrations/ are touched. In particular:

  • src/db/index.ts — unchanged (runner auto-discovers new migrations).
  • src/db/schema.sql — unchanged (reference asset; not load-bearing).
  • src/domains/router/scoring.ts + fallback.ts — unchanged (Phase 0 stub invariants intact; scoring/fallback consumption of the new table is P1.5.1’s slice).
  • No MCP tool registration.
  • No src/server.ts change.
  • No env-var changes.

5. Cohort summary (what shipped)

# model_id provider Context Latency tier Cost (bps/1k) Domain profile (hex) enabled
1 claude-sonnet-3-5 anthropic 200,000 balanced 300 0x8B 1
2 claude-haiku-3-5 anthropic 200,000 fast 80 0x42 0
3 gpt-4o openai 128,000 balanced 250 0x23 0
4 gpt-4o-mini openai 128,000 fast 15 0x41 0
5 gemini-1-5-pro google 1,000,000 slow 125 0xA2 0
6 llama-3-3-70b meta 128,000 balanced 50 0x91 0
7 mixtral-8x22b mistral 64,000 fast 60 0x05 0
8 kimi-k2 moonshot 200,000 balanced 120 0x49 0

Six distinct providers represented (anthropic, openai, google, meta, mistral, moonshot). Cost bps span 15 → 300 (1.5%–30.0% markup band, indicative per spec). Context windows span 64_000 → 1_000_000. Latency tiers cover all three vocabulary values. Domain bitmasks are pairwise distinct (verified by T10).

6. Deviations from the staging file

The staging file’s P1.5.9 slice anticipated that the table was “already populated with a single row (Claude Sonnet)” and that this migration would add 7 new rows. The audit (Step 1 §3.1) found that the table was not present in any prior migration. To make the post-condition match the staging file’s intent (8 total rows, only Sonnet enabled), this migration:

  1. Creates the table itself (via CREATE TABLE IF NOT EXISTS).
  2. Seeds the Claude Sonnet row at enabled = 1 alongside the 7 new enabled = 0 rows.

The staging file’s stated post-conditions (“8 total rows,” “7 new rows ship enabled = false,” “all column values match the cohort table”) are unchanged. The only delta is who inserts the Sonnet row — under the staging file’s anticipation, an earlier (nonexistent) migration would have inserted it; under this implementation, migration 009 does.

No other deviations.

7. Writeback (for PM to relay into the ζ chain when a client attaches)

task_id: P1.5.9
branch: feature/p1-5-9-candidates
worktree: .worktrees/claude/p1-5-9-candidates
commits:
  audit:    445c4b41  audit(p1-5-9-candidates): inventory candidate-table surface
  contract: 99dc8424  contract(p1-5-9-candidates): behavioral contract for candidate table
  packet:   d1da05c1  packet(p1-5-9-candidates): execution plan
  feat:     90d0401b  feat(p1-5-9-candidates): seed mcp_model_candidates with real cohort (no stubs)
  verify:   <Step 5 SHA — this commit>
tests:    npm run build && npm run lint && npm test
result:   PASS (3117/3117 after the pre-existing parity-harness G7.1 flake reran green)
summary:  R92 Phase 1.5 graduation Wave 1 closed. Migration 009 creates the mcp_model_candidates table and seeds 8 real model rows: 1 Claude Sonnet (enabled=1, the Phase 0 active model) and 7 Phase-1.5 candidates (Haiku, GPT-4o, GPT-4o mini, Gemini 1.5 Pro, Llama 3.3 70B, Mixtral 8x22B, Kimi K2; all enabled=0 until their adapters land). Migration is self-idempotent (CREATE IF NOT EXISTS + INSERT OR IGNORE) on top of the runner's PRAGMA user_version shield. domain_fit_profile is an 8-bit bitmask over the 8 ξ domains. No router code, no MCP tool registration. Unblocks P1.5.1 scoring.
blockers: none.

8. Sign-off

All 8 acceptance criteria PASS. All 9 contract invariants PASS. The gates npm run build && npm run lint && npm test are green at HEAD post-Step-4. The migration is idempotent, reversible, and produces the cohort the staging file specified. The task is complete.


Back to top

Colibri — documentation-first MCP runtime. Apache 2.0 + Commons Clause.

This site uses Just the Docs, a documentation theme for Jekyll.