M-L1-T3e: upsertParams defaults for CHECK-constrained pg columns#131
Merged
Conversation
…d columns Production bug 2026-05-07 12:02 UTC after PR #129 merged: fetch-ai crawl returns processed:9226, upserted:0, storageErrors:9226, durationMs:315365. Adapter NOW successfully fetches 9226 records (huge progress from processed:0 across PRs #120/#124/#125/#126/#129 — adapter pipeline is finally working end-to-end up to storage layer). But every upsert fails. Root cause: pg CHECK constraints on new taxonomy columns reject NULL. Adapter doesn't populate optional Zod fields (framework, wallet_status, payment_facilitator, security_badge_level). upsertParams uses `?? undefined` → pg coerces to NULL → CHECK constraint violation → 100% failure. Affected columns (003_taxonomy.sql): - framework IN ('langchain','crewai',...,'unknown') DEFAULT 'unknown' - wallet_status IN ('paxio-native','external','none') DEFAULT 'none' - payment_facilitator IN ('paxio',...,'unknown') DEFAULT 'unknown' - security_badge_level IN (...) DEFAULT 'none' RED test in products/01-registry/tests/postgres-storage.test.ts asserts upsertParams emits SQL-DEFAULT-matching enum strings (NOT undefined/NULL) for these 4 fields when AgentCard fields absent. Currently 1 RED of 28. Fix is registry-dev scope (postgres-storage.ts upsertParams). Slim spec in docs/sprints/M-L1-T3e-storage-defaults.md. Acceptance: scripts/verify_M-L1-T3e-storage-defaults.sh (4 step / 4+ checks).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
4 Skipped Deployments
|
Production bug after PR #129 merge: fetch-ai crawl returned 9226 storageErrors / 0 upserted. Root cause: pg CHECK constraints on new taxonomy columns reject NULL; adapter doesn't populate these (Zod-optional); upsertParams used `?? undefined` → pg coerced to NULL → CHECK violation on every insert. Fix: emit SQL-DEFAULT-matching enum values for CHECK-constrained columns: framework='unknown', wallet_status='none', payment_facilitator='unknown', security_badge_level='none'. Replace remaining `?? undefined` with `?? null` for non-enum fields. 28/28 postgres-storage tests GREEN.
a3ka
pushed a commit
that referenced
this pull request
May 7, 2026
Phase N review — APPROVED, no must-fix, no TD entries. 5th iteration on M-L1 fetch-ai pipeline closes the storage CHECK-violation layer. After PR #129 (body-stringify) restored adapter to ~9226 records, all 9226 hit storage.upsert() and pg rejected each with CHECK violation on framework/wallet_status/payment_facilitator/security_badge_level columns (?? undefined → NULL → CHECK fail). Fix: emit SQL-DEFAULT-matching enum strings ('unknown'/'none') at positions \$18/\$21/\$26/\$39 + replace remaining `?? undefined` with `?? null` (pg 8.x deprecates undefined params). 2-commit chain on clean base (b6768f8): - 2fa4b85 architect — RED spec (1 test + slim spec + acceptance) - 00ee0cc registry-dev — impl (1 file, 22-line edit) Reviewer worktree validation (identity=reviewer): - pnpm typecheck: 0 errors - pnpm exec vitest run: 1454 passed | 16 skipped | 5 todo (full baseline) - postgres-storage.test.ts target: 28/28 GREEN - bash scripts/verify_M-L1-T3e-storage-defaults.sh: PASS=7 FAIL=0 - quality-gate.sh per test-runner report: 7/7 GREEN - git status clean - per-commit identity matches scope-guard table - tests SACRED honored (registry-dev touched 0 test files) Standards walk: - P0 clean (no multi-tenancy break, no SQL injection, no any/cast) - P1 clean (factory frozen, domain purity preserved, AppError untouched, conventional commits, tests sacred) - P2 clean (rationale comments, consistent return shape, no dead code) Note: acceptance script step 2 has cosmetic glitch (echoes literal `??` producing benign `line 26: ??: command not found` warning); does NOT affect PASS counter; architect-owned P2 cosmetic. → architect merges PR #131 → dev per workflow.md gate-1 autonomous.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Production bug 2026-05-07 12:02 UTC after PR #129 merged. Adapter NOW fetches 9226 records (5 iterations of fetch-ai pipeline finally yielding records!) but storage fails 100%:
```
processed: 9226
upserted: 0
storageErrors: 9226
durationMs: 315365 (5+ min real HTTP work)
```
Root cause: pg CHECK constraints on new taxonomy columns reject NULL. Adapter doesn't populate optional fields. upsertParams uses `?? undefined` → pg → NULL → CHECK violation.
Affected:
Changes
Готово когда
🤖 Generated with Claude Code