Skip to content

test: add the toolkit join parity harness - #1113

Draft
teallarson wants to merge 1 commit into
mainfrom
chore/join-parity-harness
Draft

test: add the toolkit join parity harness#1113
teallarson wants to merge 1 commit into
mainfrom
chore/join-parity-harness

Conversation

@teallarson

@teallarson teallarson commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Why

The generator is being split into upstream data, enrichment, and curation layers. This adds a deterministic parity gate that answers one question: does joining those layers still reproduce the toolkit JSON we ship today?

It turns output preservation from a manual review task into a mechanical check, protecting the pipeline as its sources are extracted and reorganized.

How it fits

catalog snapshot + enrichment + curation
                    │
                    v
              real merger
                    │
                    v
          parity check vs shipped JSON

The harness sits alongside generation rather than replacing it: it uses the production merger, reports the first structural difference by JSON path, and makes future pipeline slices independently verifiable.

Changes

  • Added a paginated catalog snapshot script that records total_count and rejects truncated fetches.
  • Added a join verifier using the real merger, with committed toolkit data as the current baseline until extracted layers land.
  • Added tests for the zero-difference case, enrichment changes, missing catalog tools, and the catalog response shape.

Verification

  • Re-joining all 117 committed toolkits produces zero differences.
  • Injected enrichment changes fail with a precise JSON path.
  • Optional-field equivalence and volatile generatedAt are handled structurally to avoid false positives.

Independent of #1112 at merge time, but intended to validate it and the subsequent enrichment/source-extraction slices.


Note

Low Risk
New scripts and tests only; no changes to the production generator merge or shipped data paths.

Overview
Adds a join parity gate for the upcoming catalog / enrichment / curation split: mechanically check that those layers still produce the same shipped toolkit JSON.

capture-catalog-snapshot.ts paginates Engine /v1/tool_metadata (aligned with EngineApiSource), records total_count, and refuses to write truncated snapshots. .gitignore keeps the ~10 MB local snapshot out of git.

verify-toolkit-join.ts loads a snapshot through parseToolMetadataResponse, runs the real mergeToolkit path (design-system metadata + provider resolver), overlays frozen enrichment (codeExample, secretsInfo, summary), and compares to data/toolkits with a structural diff (ignores generatedAt, treats optional null/absent keys as equivalent). Non-zero exit on mismatch or missing catalog tools. Until separate layer dirs exist, enrichment/curation default to the committed toolkit files.

verify-toolkit-join.test.ts covers the diff helpers, catalog reshape, full round-trip over all committed toolkits, and failure cases (enrichment drift, missing catalog entries).

Reviewed by Cursor Bugbot for commit f18ce96. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 12, 2026 7:16pm

Request Review

Comment thread toolkit-docs-generator/scripts/verify-toolkit-join.ts Outdated
Comment thread toolkit-docs-generator/scripts/verify-toolkit-join.ts
Comment thread toolkit-docs-generator/scripts/verify-toolkit-join.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e9a38de. Configure here.

Comment thread toolkit-docs-generator/scripts/verify-toolkit-join.ts
Comment thread toolkit-docs-generator/scripts/capture-catalog-snapshot.ts
@teallarson
teallarson marked this pull request as draft August 11, 2026 16:29
@teallarson
teallarson force-pushed the chore/join-parity-harness branch from f18ce96 to ead048a Compare August 11, 2026 17:35
@teallarson
teallarson changed the base branch from main to chore/extract-prose August 11, 2026 17:35
Deterministic gate answering one question: does joining the catalog snapshot
with the enrichment and curation layers through the real merger still
reproduce the toolkit JSON we ship?

Rebased onto main after #1112 squash-merged, and re-verified against it:

- `curationSourceHash` joins `generatedAt` as ignored. It records which
  curation produced a file, not anything a reader sees, and no committed
  artifact carries it until the next nightly writes one.
- `customImports` is no longer exempt. Curation now compiles `imports/*.mdx`,
  so all 119 toolkits reproduce their imports and the exemption would hide a
  real parity dimension.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@teallarson
teallarson force-pushed the chore/join-parity-harness branch from ead048a to b4e6704 Compare August 12, 2026 19:13
@teallarson
teallarson changed the base branch from chore/extract-prose to main August 12, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant