Skip to content

Spike: registry-drift vocab from the projected MCP schema (#27) - #30

Merged
bdelanghe merged 1 commit into
mainfrom
claude/spike-vocab-from-schema
Jun 23, 2026
Merged

Spike: registry-drift vocab from the projected MCP schema (#27)#30
bdelanghe merged 1 commit into
mainfrom
claude/spike-vocab-from-schema

Conversation

@bdelanghe

Copy link
Copy Markdown
Contributor

Spike seeding #27 (harden the registry-drift vocab).

Why

Production vocabFromRegistry reads Zod internals (verb.input._def.shape(), field._def.entries) inside a swallowing try/catch. A zod/verbspec bump that changes those internals silently degrades the vocab to {help, version} → valid --flag/--store copy then false-positives as error-level drift and breaks the gate.

What this shows

spikes/vocab-from-schema.mjs (zero-dep, runnable, drives the real prose.mjs registryDrift):

  • vocabFromToolset(toMcpToolset(registry)) — builds the vocab from verbspec's public JSON-schema projection (properties → flags, properties[x].enum → enum values, tool name → verb id). No _def access; this is the surface test.mjs already pins.
  • vocabIsDegraded(vocab) — the fail-safe registryDrift should adopt: an extraction failure → no findings, not false errors.
verbs: audit, extract
flags: catalog, file, grounding, help, store, vale, version
store: fs|cas|socket
“Use the --cache flag; set STORE=redis; run `string-audit lint`.”
  ✗ registry-drift: --cache — not a flag of any verb
  ✗ registry-drift: store=redis — not a valid value (fs|cas|socket)
  ✗ registry-drift: `lint` — verb not in registry (known: audit, extract)
degraded vocab guard: vocabIsDegraded → true (production should no-op here)

Pure spike under spikes/ — not wired into the pipeline. Promotion path is in #27: swap vocabFromRegistry's internals for this, add the degraded-vocab no-op, and test real-registry extraction.

Refs #27.

🤖 Generated with Claude Code


Generated by Claude Code

Seeds the #27 hardening. vocabFromToolset(toMcpToolset(registry)) builds the
drift vocab from verbspec's public JSON-schema projection (properties → flags,
properties[x].enum → enum values, name → verb id) instead of reaching into Zod
internals (verb.input._def.shape() / field._def.entries). Plus a vocabIsDegraded
guard so an extraction failure no-ops rather than false-positiving valid --flags.

Zero-dep, runnable; drives the real prose.mjs registryDrift to show parity.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011GNDVjvsbTPsbWV9fEyjLt
@bdelanghe
bdelanghe marked this pull request as ready for review June 23, 2026 16:09
@bdelanghe
bdelanghe merged commit 7356ae7 into main Jun 23, 2026
1 check passed
@bdelanghe
bdelanghe deleted the claude/spike-vocab-from-schema branch June 23, 2026 20:37
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.

2 participants