Skip to content

M-L1-T3e: upsertParams defaults for CHECK-constrained pg columns#131

Merged
a3ka merged 2 commits into
devfrom
feature/M-L1-T3e-storage-defaults
May 7, 2026
Merged

M-L1-T3e: upsertParams defaults for CHECK-constrained pg columns#131
a3ka merged 2 commits into
devfrom
feature/M-L1-T3e-storage-defaults

Conversation

@a3ka
Copy link
Copy Markdown
Contributor

@a3ka a3ka commented May 7, 2026

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:

  • `framework`, `wallet_status`, `payment_facilitator`, `security_badge_level` — all CHECK-constrained enums with DEFAULT but no IS NULL OR escape hatch.

Changes

  • RED test in `products/01-registry/tests/postgres-storage.test.ts` (1 RED of 28)
  • Acceptance script `scripts/verify_M-L1-T3e-storage-defaults.sh` (4 checks)
  • Slim spec for registry-dev in `docs/sprints/M-L1-T3e-storage-defaults.md`

Готово когда

  • 28/28 postgres-storage tests GREEN
  • baseline GREEN
  • production smoke: fetch-ai `upserted > 0`, agents count rises ~9K

🤖 Generated with Claude Code

…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).
@a3ka a3ka added dev-ready Phase 0 APPROVED, dev can start implementation (M-Q2) spec-ready Triggers spec-review.yml fast-CI gate (M-Q2) labels May 7, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
paxio-docs Canceled Canceled May 7, 2026 0:15am
paxio-fleet Canceled Canceled May 7, 2026 0:15am
paxio-landing Canceled Canceled May 7, 2026 0:15am
paxio-pay Ready Ready Preview, Comment May 7, 2026 0:15am
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
paxio-intel Ignored Ignored Preview May 7, 2026 0:15am
paxio-radar Ignored Ignored Preview May 7, 2026 0:15am
paxio-registry Ignored Ignored Preview May 7, 2026 0:15am
paxio-wallet Ignored Ignored Preview May 7, 2026 0:15am

Request Review

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 a3ka merged commit 06aa9a5 into dev May 7, 2026
20 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-ready Phase 0 APPROVED, dev can start implementation (M-Q2) spec-ready Triggers spec-review.yml fast-CI gate (M-Q2)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant