Skip to content

M-L1-T3c: fetch-ai Zod schema rewrite for real Agentverse API (RED spec)#126

Merged
a3ka merged 3 commits into
devfrom
feature/M-L1-T3c-fetch-schema
May 3, 2026
Merged

M-L1-T3c: fetch-ai Zod schema rewrite for real Agentverse API (RED spec)#126
a3ka merged 3 commits into
devfrom
feature/M-L1-T3c-fetch-schema

Conversation

@a3ka
Copy link
Copy Markdown
Contributor

@a3ka a3ka commented May 3, 2026

Why

PR #120/T-3 authored ZodFetchAiAgent against IMAGINED API. PR #124/T-3-wiring fixed httpClient injection. PR #125/T-3b fixed HTTP method (POST + body). Production smoke 2026-05-03 11:16 UTC: adapter ran (durationMs:109) but processed:0 — Zod validation rejects every real record.

Live curl 2026-05-03 confirmed real response shape:

  • address prefix: agent1... (NOT fetch1...)
  • Registration: created_at ISO string (NOT registeredAt Unix ms)
  • Tags: system_wide_tags (NOT tags)
  • Online: status: "active"|"inactive" string (NOT isOnline boolean)
  • Reputation: rating: 0..5 float (NOT reputationScore: 0..100)
  • profileUrl: NOT in response — derived from address

Total ~10K agents in API (offset cap = 9999, verified empirically — far less than my earlier 2M estimate).

Changes (architect zone)

  • packages/types/src/sources/fetch-ai.ts: schema rewrite + 4 projection helpers (fetchAiProfileUrl, fetchAiRatingToReputation, fetchAiStatusToOnline, fetchAiDisplayName)
  • products/01-registry/tests/fetch-ai-adapter.test.ts: validAgent fixture → real raw shape (28 fields), un-skip toCanonical block + 5 new projection assertions
  • docs/sprints/M-L1-T3c-fetch-schema.md: milestone + slim spec for registry-dev

Готово когда

  • 14/14 fetch-ai-adapter tests GREEN (1 factory + 7 pagination + 5 projection + 1 misc)
  • pnpm typecheck clean
  • pnpm exec vitest run baseline GREEN
  • Production smoke (post-merge): processed > 0, agent count rises by ~10K

Vitest output now (RED, expected)

```
Test Files 1 failed (1)
Tests 4 failed | 10 passed (14)
```

4 failures cover toCanonical projection — adapter still uses old field names (raw.tags, raw.endpoint). Registry-dev impl per slim spec fixes.

🤖 Generated with Claude Code

PR #120 (T-3) authored ZodFetchAiAgent against IMAGINED API. PR #124 fixed
wiring (httpClient injection); PR #125 fixed HTTP method (POST + body).
Production smoke 2026-05-03 11:16 UTC: adapter ran (durationMs:109) but
processed:0 — Zod validation rejects every real record because schema
shape doesn't match real API.

Live curl 2026-05-03 verified real response shape:
  - address prefix: agent1... (not fetch1...)
  - registration: created_at ISO string (not registeredAt Unix ms)
  - tags field: system_wide_tags (not tags)
  - online: status: "active"|"inactive" string (not isOnline boolean)
  - reputation: rating: 0..5 float (not reputationScore: 0..100)
  - profileUrl: NOT in response (must be derived from address)

Total ~10K agents in API (offset cap = 9999, verified empirically).

Changes:
  - packages/types/src/sources/fetch-ai.ts: rewrite ZodFetchAiAgent to
    mirror raw Agentverse response (snake_case, ISO strings, agent1
    prefix, .passthrough() for forward-compat). Add 4 projection helpers:
      fetchAiProfileUrl(address) → URL
      fetchAiRatingToReputation(rating) → 0..100 | null (× 20, null if 0)
      fetchAiStatusToOnline(status) → bool ("active" only)
      fetchAiDisplayName(raw) → name||prefix||"agent <addr[6:14]>"
  - products/01-registry/tests/fetch-ai-adapter.test.ts: update validAgent
    fixture to real raw shape (28 fields). Un-skip toCanonical describe
    block + 5 new projection assertions (DID format, sourceUrl construction,
    name fallback chain, description truncation, parse_error on bad regex).

Vitest output (RED): 4 fail, 10 pass — adapter still uses old field
names (raw.tags, raw.endpoint, etc.). Fix is registry-dev scope:
update inferCapability + toCanonical projection per slim spec in
docs/sprints/M-L1-T3c-fetch-schema.md.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 3, 2026

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

Project Deployment Actions Updated (UTC)
paxio-landing Error Error May 3, 2026 3:27pm
7 Skipped Deployments
Project Deployment Actions Updated (UTC)
paxio-docs Ignored Ignored Preview May 3, 2026 3:27pm
paxio-fleet Ignored Ignored Preview May 3, 2026 3:27pm
paxio-intel Ignored Ignored Preview May 3, 2026 3:27pm
paxio-pay Ignored Ignored Preview May 3, 2026 3:27pm
paxio-radar Ignored Ignored Preview May 3, 2026 3:27pm
paxio-registry Ignored Ignored Preview May 3, 2026 3:27pm
paxio-wallet Ignored Ignored Preview May 3, 2026 3:27pm

Request Review

Phase 0 reviewer (round 1) REJECTED — 2 orphan test files referenced old
fetch-ai schema (would break baseline after registry-dev impl):

  1. tests/registry-source-adapters.test.ts:164-202 — describe block
     "M-L1 — Fetch.ai agent schema" still parsed old shape (fetch1 prefix,
     registeredAt: number, tags, endpoint, profileUrl, isOnline,
     reputationScore). Rewrote to "M-L1-T3c — Fetch.ai (Agentverse) raw API
     schema" with raw-shape fixture matching real curl response.

  2. products/01-registry/tests/stub-adapters.test.ts:150-188 — validFetchAi
     fixture used old shape; "fetch-ai stub adapter" describe asserted
     against stub. Replaced with thin "fetch-ai real adapter (smoke)" —
     factory + zero-yield from empty mock httpClient. Comprehensive
     coverage lives in fetch-ai-adapter.test.ts (M-L1-T3b/T3c).

  3. packages/types/src/sources/fetch-ai.ts — widened AGENTVERSE_ADDRESS
     regex from {38,58} to {50,64} body chars. Real production address
     observed at 59 body chars (65 total) — original upper bound rejected
     real records. Floor raised to 50 (regex was already too generous).

Updated docs/sprints/M-L1-T3c-fetch-schema.md::Готово когда — explicit
listing of all 3 test files + zero-failed baseline requirement.

Vitest now: 4 RED in fetch-ai-adapter.test.ts (toCanonical projection,
expected — registry-dev impl makes GREEN), 1438 GREEN baseline, 0 unrelated
failures. Ready for Phase 0 round 2.
@a3ka
Copy link
Copy Markdown
Contributor Author

a3ka commented May 3, 2026

Phase 0 SPEC RE-APPROVED (round 2, architect self-call)

Round 1 reviewer rejected with 3 must-fix items (orphan old-schema fixtures in 2 test files + Готово-когда coverage gap). Architect commit 44816e5 closed all 3 + bonus regex fix.

Round 2 verdict: SPEC RE-APPROVED.

Confirmed:

dev-ready label applied. Registry-dev session can pick up via slim spec in docs/sprints/M-L1-T3c-fetch-schema.md.

🤖 Phase 0 reviewer (sub-agent self-call by architect, round 2/3)

…Card

Schema rewrite landed in @paxio/types (architect commit on this branch)
changed ZodFetchAiAgent to mirror real Agentverse response shape.
Adapter updated to project new raw fields:
  - system_wide_tags / protocols → capability inference
  - created_at ISO string → card.createdAt (no conversion)
  - fetchAiProfileUrl(address) → card.sourceUrl
  - fetchAiDisplayName(raw) → card.name with fallback chain

14/14 fetch-ai-adapter tests GREEN.
Full baseline: 70 files, 1442 passed.
@a3ka a3ka merged commit 9c8a76e into dev May 3, 2026
19 of 20 checks passed
a3ka pushed a commit that referenced this pull request May 3, 2026
Phase N: 14/14 fetch-ai tests GREEN, baseline 1442/1442, scope clean per
commit (registry-dev impl only fetch-ai.ts; architect updated own fixtures
+ schema + sprint doc). Standards walk PASS. No new tech debt.

(architect-applied chore on behalf of reviewer 8d3c19c verdict from
/tmp/paxio-rev-pr126 — narrow push permission per scope-guard.md.)
a3ka pushed a commit that referenced this pull request May 3, 2026
Production bug after PR #126: adapter passes object body to wiring's
httpClient.fetch; wrapper passed it as-is to native fetch; Node coerces
object via String() → "[object Object]" → Agentverse rejects → adapter
silent processed:0.

Fix: serialize body to JSON string when it is an object before native fetch.
String/Buffer bodies pass through unchanged.

5/5 wiring tests GREEN.
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