Skip to content

M-L1-T3b: fetch-ai adapter GET → POST + JSON body (RED spec)#125

Merged
a3ka merged 4 commits into
devfrom
feature/M-L1-T3b-fetch-post
May 3, 2026
Merged

M-L1-T3b: fetch-ai adapter GET → POST + JSON body (RED spec)#125
a3ka merged 4 commits into
devfrom
feature/M-L1-T3b-fetch-post

Conversation

@a3ka
Copy link
Copy Markdown
Contributor

@a3ka a3ka commented May 2, 2026

Why

PR #120 merged real fetch-ai adapter using GET /v1/search/agents?offset=&limit=. PR #124 fixed wiring so adapter actually receives a working httpClient. Production smoke 2026-05-02 22:36 UTC:

```
gh workflow run "Scheduled · Crawl MCP" -f source=fetch-ai
→ {processed:0, upserted:0, sourceErrors:0, durationMs:101, stoppedReason:'completed'}
```

Adapter ran (durationMs:101 vs 0 before wiring fix), but yielded zero agents. Direct curl of real Agentverse API:

```bash
curl -X GET "https://agentverse.ai/v1/search/agents?offset=0&limit=10\"
→ HTTP 405 {"detail":"Method Not Allowed"}

curl -X POST "https://agentverse.ai/v1/search/agents\" \
-H "Content-Type: application/json" \
-d '{"search_text":"","filters":{},"sort":"relevancy","direction":"asc","offset":0,"limit":10}'
→ HTTP 200 {"agents":[...]}
```

Adapter's defensive `try{...} catch { return; }` swallows the 405 → silent zero. T-3 spec used stale API contract; T-3b corrects.

What this PR adds

  • `products/01-registry/tests/fetch-ai-adapter.test.ts` — un-skip TD-34 deferred behaviour block, update first test to assert POST + body shape (+50/−9 lines)
  • `docs/sprints/M-L1-T3b-fetch-post.md` — milestone + slim spec for registry-dev

Готово когда

  • 9/9 tests in `products/01-registry/tests/fetch-ai-adapter.test.ts` GREEN
  • `pnpm typecheck` clean
  • `pnpm exec vitest run` baseline GREEN
  • Production smoke (post-merge): `processed > 0` for fetch-ai crawl

Vitest output now (RED, expected)

```
Test Files 1 failed (1)
Tests 5 failed | 4 passed | 2 skipped
```

5 failures cover the body-shape contract (method=POST, no query params, Content-Type header, body fields with valid types).

Next step

Merge → registry-dev session implements adapter fix per slim spec → reviewer Phase N → architect autonomous merge → re-trigger fetch-ai crawl, verify ~2M agents.

🤖 Generated with Claude Code

PR #120 merged real fetch-ai adapter using GET /v1/search/agents?offset=&limit=.
PR #124 fixed wiring so adapter receives a working httpClient. Production
smoke 2026-05-02 22:36 UTC: adapter ran (durationMs:101) but produced zero
agents. Direct curl of real API:

  GET https://agentverse.ai/v1/search/agents?offset=0&limit=10
    → HTTP 405 {"detail":"Method Not Allowed"}

  POST https://agentverse.ai/v1/search/agents
    Content-Type: application/json
    {"search_text":"","filters":{},"sort":"relevancy","direction":"asc",
     "offset":0,"limit":10}
    → HTTP 200 {"agents":[{"address":"agent1...",...},...]}

T-3 spec used a stale/incorrect contract; T-3b corrects.

Changes:
  - Un-skip behavior describe block (was TD-34 placeholder)
  - Update first test 'GETs ...' → 'POSTs ... with offset+limit in JSON body'
  - Assert method=POST, no query params, Content-Type: application/json header,
    body shape {search_text, filters, sort, direction, offset, limit}
  - Other behavior tests (yields, paginates, 401, 429, 5xx) inherit POST
    contract — they pass any req shape since fakeHttp ignores it

Vitest output (RED): 5 fail, 4 pass (factory tests + 2 not-yet-targeted).
Slim spec for registry-dev included in milestone doc.
@a3ka a3ka added the spec-ready Triggers spec-review.yml fast-CI gate (M-Q2) label May 2, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 2, 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 10:34am
7 Skipped Deployments
Project Deployment Actions Updated (UTC)
paxio-docs Ignored Ignored Preview May 3, 2026 10:34am
paxio-fleet Ignored Ignored Preview May 3, 2026 10:34am
paxio-intel Ignored Ignored Preview May 3, 2026 10:34am
paxio-pay Ignored Ignored Preview May 3, 2026 10:34am
paxio-radar Ignored Ignored Preview May 3, 2026 10:34am
paxio-registry Ignored Ignored Preview May 3, 2026 10:34am
paxio-wallet Ignored Ignored Preview May 3, 2026 10:34am

Request Review

@a3ka
Copy link
Copy Markdown
Contributor Author

a3ka commented May 2, 2026

Phase 0 SPEC APPROVED (architect self-call)

Reviewer ran Phase 0 spec-review per architect-protocol.md::§6.5. Verdict: SPEC APPROVED.

Summary:

  • Coverage: 4/4 "Готово когда" criteria covered. Body shape contract locked (search_text, filters, sort, direction, offset, limit + Content-Type header + POST method).
  • Vacuous-skip: RED tests fail for the right reason — expect(url).not.toMatch(/[?&](offset|limit)=/) fails because adapter currently sends offset/limit in query string. Other 4 fails are downstream consequences of GET adapter against fakeHttp.
  • Test integrity (C31): architect modified own test contract — sanctioned per testing.md (subject = dev). Diff confined to un-skip + first test rewrite; factory tests + skipped toCanonical untouched.
  • Coding standards: P0 → P1 → P2 walk clean. No any, no class, factory pattern preserved, case-insensitive header lookup via Object.keys().find().
  • Slim spec: 2-file read budget, explicit replacement diff, no on-demand skills needed (paxio-backend-architecture always-on covers scope).
  • Infrastructure: lockfile clean, typecheck clean.

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

🤖 Phase 0 reviewer (sub-agent self-call by architect)

registry-dev and others added 2 commits May 3, 2026 10:07
Real Agentverse API requires POST /v1/search/agents with JSON body
{search_text, filters, sort, direction, offset, limit}; previous GET
with query params returned 405. Adapter's defensive catch swallowed
the 405 → silent processed:0 in production despite wiring fix (PR #124).

fetchAgents: bare URL + POST with JSON body (offset/limit moved to body).
SAFETY_MAX_PAGES, 429 Retry-After, 5xx single retry — preserved.
Capability inference, toCanonical, DID derivation — unchanged.

Tests: 9/9 GREEN (factory + 8 behaviour, 2 toCanonical skipped per TD-34).
Full baseline: 70 files, 1437 passed.

NOTE: validAgent fixture (registeredAt: ISO string → ms number) and
'paginates offset += limit' pageSize=1 fix needed in test file — see
scope-violation-request in session log.
… for pagination

Two fixture-level corrections to the architect-authored RED spec, applied
by architect after registry-dev escalated SCOPE VIOLATION REQUEST during
T-3b impl. Both changes are contract evolution, not test-weakening:

1. validAgent.registeredAt: '2026-04-20T10:00:00.000Z' (ISO string) → 1714000000000
   (Unix epoch ms). ZodFetchAiAgent.registeredAt is z.number().int().nonnegative()
   per packages/types/src/sources/fetch-ai.ts. ISO string failed Zod validation
   silently → toCanonical projection.ok=false → adapter yielded zero records.
   Also added missing required schema fields:
     profileUrl: z.string().url() — required
     tags: z.array(...).default([]) — explicit value
     isOnline: z.boolean().default(false) — explicit value
     reputationScore: z.number().nullable() — explicit null

2. 'paginates offset += limit until empty' test: createFetchAiAdapter call
   now passes { httpClient, pageSize: 1 }. With default pageSize=100 and
   1 agent per response, adapter sees received < pageSize and terminates
   after page 1 (correct behaviour — short page means end). pageSize=1
   makes each response a "full page" so pagination advances through
   3 pages as the test asserts (count===3).

Verified: 9/9 fetch-ai tests GREEN with registry-dev's impl (4b20c30).
Full baseline: 1437 passed | 18 skipped | 5 todo. Typecheck clean.
a3ka pushed a commit that referenced this pull request May 3, 2026
Phase N: scope clean, tests integrity, 9/9 GREEN, standards walk PASS.
No new tech debt. Ready for architect gate-1 merge.

(architect-applied via patch from reviewer's worktree 1af8c14 — reviewer
session has no GitHub credentials per scope-guard.md narrow push exception;
chore content authored by reviewer agent, applied verbatim.)
…ure checks

scripts/verify_M-L1-T3b-fetch-post.sh — 9-step / 18-check verification:
  1. Adapter sends method: 'POST' (not GET) + no GET fetch calls left
  2. Content-Type: application/json header
  3. All 6 Agentverse body fields (search_text, filters, sort, direction, offset, limit)
  4. URL bare /v1/search/agents (no query string)
  5. ZodFetchAiAgent.registeredAt is z.number().int().nonnegative()
  6. Test fixture validAgent.registeredAt is Unix epoch ms (number)
  7. Test fixture has all required schema fields (profileUrl, tags, isOnline, reputationScore)
  8. Pagination test overrides pageSize: 1
  9. Vitest target file 9/9 GREEN

Local run: PASS=18 FAIL=0. Unblocks scripts/quality-gate.sh M-L1-T3b-fetch-post
step 6/6 (test-runner reported missing acceptance — M-Q27 fallback regex
`-T[0-9]+([._-][[:alnum:]]+)*$` doesn't match T<num><letter> styles like T3b).

NB: M-Q27 regex extension to handle T3b-style suffixes is separate concern,
will file as TD if becomes recurring (currently 1st T<num><letter> task).
@a3ka a3ka merged commit 3752a0c into dev May 3, 2026
19 of 20 checks passed
a3ka pushed a commit that referenced this pull request May 3, 2026
…* packages

Pre-existing infrastructure debt: packages/types/src/index.ts uses .js
extension imports (TS NodeNext). Next.js webpack does NOT transpile
workspace packages by default — fails to resolve './agent-category.js'
(actual file: agent-category.ts).

Broke at M-L1-taxonomy merge (commit 120988e, ~April 30). Last successful
landing CI: f4cefcf (April 30). Path-filtered landing CI didn't trigger
on backend PRs (#118-#125) → silent for 3 days. PR #99 (M-L10.7.3) is
first PR touching landing since → CI red → exposes baseline.

Affects all 8 frontend apps' production builds + likely silently breaks
their Vercel deploys.

Acceptance script verifies (17 checks):
  1. all 8 apps' next.config.ts have transpilePackages field (8 checks)
  2. transpilePackages includes @paxio/types (8 checks)
  3. landing-app build succeeds (1 smoke check)

Currently RED 0/17 (no transpilePackages in any config; landing-app build
fails on .js resolution). Fix is frontend-dev scope — slim spec in
docs/sprints/TD-FE-transpile.md.
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