Skip to content

M-L1-T3-wiring: inject httpClient into fetch-ai adapter (RED spec)#124

Merged
a3ka merged 2 commits into
devfrom
feature/M-L1-T3-wiring-httpclient
May 2, 2026
Merged

M-L1-T3-wiring: inject httpClient into fetch-ai adapter (RED spec)#124
a3ka merged 2 commits into
devfrom
feature/M-L1-T3-wiring-httpclient

Conversation

@a3ka
Copy link
Copy Markdown
Contributor

@a3ka a3ka commented May 2, 2026

Why

PR #120 merged real fetch-ai Agentverse REST adapter into products/01-registry/app/domain/sources/fetch-ai.ts. Adapter expects httpClient.fetch({url, method, body?, headers?}) injected. Wiring (apps/back/server/wiring/01-registry.cjs) was NOT updated alongside — fetch-ai falls into else: {} branch:

const adapterDeps = source === 'mcp' ? {...} 
  : source === 'paxio-curated' ? {...}
  : {};  // ← fetch-ai lands here, deps.httpClient = undefined

Adapter's defensive try/catch swallows the resulting TypeError and returns from the async generator without yielding → crawler reports processed:0, sourceErrors:0, stoppedReason:'completed'. Silent failure mode.

Production manifest 2026-05-02 20:56 UTC: gh workflow run "Scheduled · Crawl MCP" -f source=fetch-ai returned {processed:0, upserted:0, durationMs:0}. Agent count remained 3266 (paxio-curated baseline).

What this PR adds

  • tests/wiring-rest-adapter-httpclient.test.ts — 4 tests:
    • 2 RED (fetch-ai injection + HttpResponse shape) — fail for right reason on dev
    • 2 regression guards (MCP get(url), paxio-curated curatedAgentsPath + fs) — pass on dev
  • docs/sprints/M-L1-T3-wiring-httpclient.md — milestone + slim spec for backend-dev

Готово когда

  • 4/4 tests in tests/wiring-rest-adapter-httpclient.test.ts GREEN
  • pnpm typecheck clean
  • pnpm exec vitest run baseline GREEN
  • Production smoke (post-merge): processed > 0 for fetch-ai crawl

Next step

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

🤖 Generated with Claude Code

…iring

PR #120 merged real fetch-ai REST adapter but didn't update wiring. fetch-ai
falls into else: {} branch in apps/back/server/wiring/01-registry.cjs, gets
empty deps, deps.httpClient is undefined. Adapter's
  try { deps.httpClient.fetch(...) } catch { return; }
silently yields zero agents. Crawler reports processed:0, sourceErrors:0,
stoppedReason:'completed'.

RED test loads the actual CJS wiring module via createRequire, calls
wireRegistryDomain with mock raw domain capturing the createFetchAiAdapter
deps argument, and asserts:
  - deps.httpClient defined
  - typeof deps.httpClient.fetch === 'function'
  - calling httpClient.fetch returns HttpResponse {status, headers Map, body}
  - regression guards: mcp still gets httpClient.get(url),
    paxio-curated still gets curatedAgentsPath + fs

Vitest output (RED): 2/4 tests fail for right reason (TypeError on
undefined.fetch). Fix is a single ternary branch in wiring/01-registry.cjs;
slim spec for backend-dev included in milestone doc.
@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 2, 2026 10:32pm
7 Skipped Deployments
Project Deployment Actions Updated (UTC)
paxio-docs Ignored Ignored Preview May 2, 2026 10:32pm
paxio-fleet Ignored Ignored Preview May 2, 2026 10:32pm
paxio-intel Ignored Ignored Preview May 2, 2026 10:32pm
paxio-pay Ignored Ignored Preview May 2, 2026 10:32pm
paxio-radar Ignored Ignored Preview May 2, 2026 10:32pm
paxio-registry Ignored Ignored Preview May 2, 2026 10:32pm
paxio-wallet Ignored Ignored Preview May 2, 2026 10:32pm

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. 2 RED tests pin the bug class, 2 regression-guards prevent MCP/paxio-curated breakage.
  • Vacuous-skip: RED tests fail for the right reason (expected undefined on deps.httpClient line 73; TypeError on .fetch line 107) — not setup/import errors.
  • Coding standards: P0 → P1 → P2 walk clean. No any, no class, plain object factory, fixture isolation via try/finally, deterministic mocks.
  • Slim spec: ~38 LOC, 2 files to read, inline impl skeleton — fits MiniMax-M2.7 budget.
  • Infrastructure: lockfile clean, typecheck PASS. RED tests fail as expected (will GREEN with backend-dev impl).

Non-blocking note: tests/m-q22-reviewer-chore-coverage.test.ts reports 5 pre-existing orphan-PR merges (#118-#121, #123) lacking chore(reviewer) coverage. Unrelated to this PR — flag for retroactive reviewer pass per architect-protocol.md::§6.5 cost-of-catchup.

dev-ready label applied. Backend-dev session can pick up via slim spec in docs/sprints/M-L1-T3-wiring-httpclient.md.

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

Wiring fix complementary to PR #120 (real fetch-ai adapter).
Adapter expects httpClient.fetch({url,method}) injected; previously
fell into else: {} branch, deps.httpClient was undefined, silent
return-zero in production.

4/4 wiring tests GREEN: 2 fetch-ai + 2 regression guards (mcp, paxio-curated).
@a3ka a3ka merged commit 0b64a20 into dev May 2, 2026
19 of 20 checks passed
a3ka pushed a commit that referenced this pull request May 2, 2026
Phase N: scope clean, tests unchanged, 4/4 GREEN, standards walk PASS.
No new tech debt. Ready for architect gate-1 merge.

(architect-applied via patch from reviewer's worktree e05b44c — reviewer
session has no GitHub credentials per scope-guard.md; chore content
authored by reviewer agent, applied verbatim.)
a3ka pushed a commit that referenced this pull request May 3, 2026
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.
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