# adichaudhary/x402-conformance-lab architecture

> Architecture diagram of the GitHub repository adichaudhary/x402-conformance-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adichaudhary/x402-conformance-lab
- Repository: https://github.com/adichaudhary/x402-conformance-lab

## Overview

This is an x402 V2 interoperability and conformance lab. Its main workflow is to load an implementation config and role-specific catalog tests, send test steps to the implementation, evaluate responses against assertions, then print and optionally write a report. The README also describes mock server/facilitator capabilities and local-chain testing; some of these are planned or undersampled, so their links are documented rather than inferred from unseen code.

Main entry points: [`src/runner/run.ts`](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/run.ts) (Test runner), [`src/cli/index.ts`](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/cli/index.ts) (Conformance CLI), [`src/runner/schemas.ts`](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/schemas.ts) (Schema validation), [`src/runner/catalog.ts`](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/catalog.ts) (Catalog loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_cli["Conformance CLI<br/>[index.ts]"]
end

subgraph group_execution["Test execution"]
  node_config["Implementation config<br/>[config.ts]"]
  node_catalog["Catalog loader<br/>[catalog.ts]"]
  node_schema_runtime["Schema validation<br/>[schemas.ts]"]
  node_runner["Test runner<br/>[run.ts]"]
  node_assertions["Assertion evaluation<br/>[assertions.ts]"]
  node_expectations["Expectation checks<br/>[expect.ts]"]
  node_version["Suite and spec version<br/>[version.ts]"]
end

subgraph group_fixtures["Test definitions"]
  node_definitions["Role-based test catalog"]
  node_schemas["Schema definitions"]
end

subgraph group_output["Results and reports"]
  node_text_report["Text report<br/>[text.ts]"]
  node_json_report["JSON report writer<br/>[json.ts]"]
  node_markdown_report["Compatibility grid<br/>[markdown.ts]"]
end

node_engineer(("Suite operator"))
node_implementation["Target implementation"]
node_mock_server["Mock resource server"]
node_mock_facilitator["Mock facilitator"]
node_local_chain["Local chain harness"]

node_engineer -->|"invokes"| node_cli
node_cli -->|"loads config"| node_config
node_cli -->|"loads catalog"| node_catalog
node_catalog -->|"reads tests"| node_definitions
node_catalog -->|"validates tests"| node_schema_runtime
node_config -->|"validates config"| node_schema_runtime
node_schema_runtime -->|"loads definitions"| node_schemas
node_cli -->|"runs tests"| node_runner
node_runner -->|"sends HTTP steps"| node_implementation
node_runner -->|"evaluates assertions"| node_assertions
node_assertions -->|"checks expectations"| node_expectations
node_runner -->|"checks features"| node_config
node_runner -->|"records version"| node_version
node_cli -->|"displays version"| node_version
node_cli -->|"formats output"| node_text_report
node_cli -->|"writes report"| node_json_report
node_json_report -->|"validates report"| node_schema_runtime
node_runner -->|"provides results"| node_text_report
node_runner -->|"provides results"| node_markdown_report
node_mock_server -.->|"can serve as target"| node_implementation
node_mock_facilitator -.->|"supports mock-facilitator tests"| node_runner
node_local_chain -.->|"supports chain tests"| node_runner

click node_cli "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/cli/index.ts"
click node_config "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/config.ts"
click node_catalog "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/catalog.ts"
click node_definitions "https://github.com/adichaudhary/x402-conformance-lab/tree/main/tests/catalog"
click node_schemas "https://github.com/adichaudhary/x402-conformance-lab/tree/main/schemas"
click node_schema_runtime "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/schemas.ts"
click node_runner "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/run.ts"
click node_assertions "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/assertions.ts"
click node_expectations "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/expect.ts"
click node_version "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/version.ts"
click node_mock_server "https://github.com/adichaudhary/x402-conformance-lab/tree/main/src/mocks/server"
click node_mock_facilitator "https://github.com/adichaudhary/x402-conformance-lab/tree/main/src/mocks/facilitator"
click node_text_report "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/report/text.ts"
click node_json_report "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/report/json.ts"
click node_markdown_report "https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/report/markdown.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli toneBlue
class node_config,node_catalog,node_schema_runtime,node_runner,node_assertions,node_expectations,node_version toneAmber
class node_definitions,node_schemas,node_mock_server toneMint
class node_text_report,node_json_report,node_markdown_report toneRose
class node_engineer,node_implementation,node_local_chain toneIndigo
class node_mock_facilitator toneTeal
```

## Components

### CLI entry

- [Conformance CLI](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/cli/index.ts): `src/cli/index.ts`

### Test execution

- [Implementation config](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/config.ts): `src/runner/config.ts`
- [Catalog loader](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/catalog.ts): `src/runner/catalog.ts`
- [Schema validation](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/schemas.ts): `src/runner/schemas.ts`
- [Test runner](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/run.ts): `src/runner/run.ts`
- [Assertion evaluation](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/assertions.ts): `src/runner/assertions.ts`
- [Expectation checks](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/runner/expect.ts): `src/runner/expect.ts`
- [Suite and spec version](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/version.ts): `src/version.ts`

### Test definitions

- [Role-based test catalog](https://github.com/adichaudhary/x402-conformance-lab/tree/main/tests/catalog): `tests/catalog`
- [Schema definitions](https://github.com/adichaudhary/x402-conformance-lab/tree/main/schemas): `schemas`

### Results and reports

- [Text report](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/report/text.ts): `src/report/text.ts`
- [JSON report writer](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/report/json.ts): `src/report/json.ts`
- [Compatibility grid](https://github.com/adichaudhary/x402-conformance-lab/blob/main/src/report/markdown.ts): `src/report/markdown.ts`

### Other components

- **Suite operator**
- **Target implementation**
- [Mock resource server](https://github.com/adichaudhary/x402-conformance-lab/tree/main/src/mocks/server): `src/mocks/server`
- [Mock facilitator](https://github.com/adichaudhary/x402-conformance-lab/tree/main/src/mocks/facilitator): `src/mocks/facilitator`
- **Local chain harness**

## Connections

- Suite operator → Conformance CLI: invokes (evidence: `README.md`)
- Conformance CLI → Implementation config: loads config (evidence: `src/cli/index.ts`)
- Conformance CLI → Catalog loader: loads catalog (evidence: `src/cli/index.ts`)
- Catalog loader → Role-based test catalog: reads tests (evidence: `src/runner/catalog.ts`)
- Catalog loader → Schema validation: validates tests (evidence: `src/runner/catalog.ts`)
- Implementation config → Schema validation: validates config (evidence: `src/runner/config.ts`)
- Schema validation → Schema definitions: loads definitions (evidence: `src/runner/schemas.ts`)
- Conformance CLI → Test runner: runs tests (evidence: `src/cli/index.ts`)
- Test runner → Target implementation: sends HTTP steps (evidence: `src/runner/run.ts`)
- Test runner → Assertion evaluation: evaluates assertions (evidence: `src/runner/run.ts`)
- Assertion evaluation → Expectation checks: checks expectations (evidence: `src/runner/assertions.ts`)
- Test runner → Implementation config: checks features (evidence: `src/runner/run.ts`)
- Test runner → Suite and spec version: records version (evidence: `src/runner/run.ts`)
- Conformance CLI → Suite and spec version: displays version (evidence: `src/cli/index.ts`)
- Conformance CLI → Text report: formats output (evidence: `src/cli/index.ts`)
- Conformance CLI → JSON report writer: writes report (evidence: `src/cli/index.ts`)
- JSON report writer → Schema validation: validates report (evidence: `src/report/json.ts`)
- Test runner → Text report: provides results (evidence: `src/report/text.ts`)
- Test runner → Compatibility grid: provides results (evidence: `src/report/markdown.ts`)
- Mock resource server → Target implementation: can serve as target (evidence: `README.md`)
- Mock facilitator → Test runner: supports mock-facilitator tests (evidence: `README.md`)
- Local chain harness → Test runner: supports chain tests (evidence: `README.md`)
