fix(X402-43): variant-aware extensions.bazaar validation (D.5)#76
Merged
fardinvahdat merged 1 commit intoMay 22, 2026
Merged
Conversation
`@x402/[email protected]` ships TWO discovery-extension variants — MCP-discovery (top-level `name` + `description`) and Body-discovery (`info.input` + `info.output` + `schema`). v0.3.0/0.3.1 assumed only the MCP shape and false-positive `implementation_issue` on every Body-discovery service. AsaiShota surfaced this on #72 with exact package-source citation; 0xdespot corroborated on #2207 with hyperD. New `src/bazaar/extensions-bazaar.ts` helper: - detectBazaarVariant() — body-discovery indicators win, else assume mcp-discovery per ADR-004 ("else assume Mcp"); third "unknown" branch is defensive for future @x402/extensions variants - validateBazaarExtension() — variant-appropriate required-field check; pure-function, presentation-free; callers format messages in their own voice Both `src/bazaar/challenge.ts` (existing check) and `src/bazaar/ well-known.ts` (the check added by PR #70 for D.1 manifest hygiene) now consume the helper. Existing mcp-discovery behavior preserved (29 existing tests still pass); body-discovery is a new pass path. JSON output gains `detail.variant` on extensions.bazaar-related check results — additive, per the JSON API stability contract from ADR-004. Tests: 21 new (13 helper + 4 challenge + 4 well-known); 450 total passing (was 429). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7 tasks
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.
Summary
X402-43 (D.5) — bug fix carrying the v0.3.2 metadata-propagation work forward. Variant-aware
extensions.bazaarvalidation per ADR-004 Pillar 1's verdict semantics + the original bug report from @AsaiShota on #72.Closes false-positive
implementation_issueon every body-discovery v2 service.Why
@x402/[email protected]ships TWO discovery-extension variants:name,descriptioninfo.input+info.output+schemadeclareDiscoveryExtension(...)(AsaiShota test-echo-cdp, 0xdespot hyperD)v0.3.0/0.3.1 assumed only the MCP shape. PR #70's D.1 manifest hygiene check carried the same assumption into
well-known.ts. Real-world v2 services using the Body-discovery shape verdict toimplementation_issuedespite being correctly implemented — verdict overrides the substantive indexing-probe signal.What changes
New file:
src/bazaar/extensions-bazaar.ts(variant detection + validation helper)detectBazaarVariant(bazaar)— body-discovery indicators win when all 3 present (info.input + info.output + schema); else assume mcp-discovery per ADR-004 "else assume Mcp"; third "unknown" branch is defensive for future@x402/extensionsvariantsvalidateBazaarExtension(bazaar)— variant-appropriate required-field check; pure-function, presentation-free; callers format messages in their own voicesrc/bazaar/challenge.ts(refactor)Inline validation replaced with
validateBazaarExtensioncall. mcp-discovery behavior preserved (regression-clean). New body-discovery pass + fail paths. New defensive "unknown variant" pass path.src/bazaar/well-known.ts(refactor)Same refactor as challenge.ts. The pillar-2 D.1 manifest hygiene check (PR #70) now respects variant.
JSON output additive
detail.variantfield added to extensions.bazaar-related check results. Additive per the JSON API stability commitment (ADR-004 Pillar 2); no field renames/removals.CHANGELOG.md
[Unreleased]### FixedCrediting @AsaiShota for the diagnosis + @0xdespot for the second-voice corroboration.
### JSON APIsubsection documents the additivedetail.variantfield.Acceptance criteria (X402-43)
bazaar-checkagainst AsaiShota'sx402-market-api.lien-studio-akiyama.workers.dev/api/seller-4068b8fc/test-echo-cdpunder v0.3.2 produceschallenge: passfor the body-discovery variant — verified via the body-discovery happy-path test inbazaar-challenge.test.tschallenge.tsreturns pass with "variant not recognised; skipping" message;well-known.tshandles via catch-all branchStrict audit gate — abbreviated (user-in-loop mode per ADR-003)
### Fixedentry crediting evidence sources{}(mcp default, fails as before — regression preserved); null/undefined (caller pre-screens); hybrid both-shapes (body wins per detection order);infonon-object (falls to mcp);info.input/outputnull after detection (body-discovery, validate-fails); unicode in fields; future 3rd variant (defensive unknown path); concurrency (pure-function, no shared state); whitespace-only strings (.trim()preserved); foreign-key objects (mcp default per AC)not_applicable_non_cdpstate) + X402-47 (fixture consumption) all presentWhat unblocks on merge
detail.variantfield as part of the baseline🤖 Generated with Claude Code