Skip to content

test(mcp): pin RFC #110 cache-prefix claims with 6 unit tests#112

Merged
esengine merged 1 commit intomainfrom
test/mcp-reconnect-prefix-invariant
May 2, 2026
Merged

test(mcp): pin RFC #110 cache-prefix claims with 6 unit tests#112
esengine merged 1 commit intomainfrom
test/mcp-reconnect-prefix-invariant

Conversation

@esengine
Copy link
Copy Markdown
Owner

@esengine esengine commented May 2, 2026

Refs #110.

What

The reconnect RFC's central claim — "re-bridging tools mid-session breaks the prompt prefix when the new tool surface differs from the old" — was an architecture-derived assertion, not an empirical result. Cheap to lock down at the ImmutablePrefix.fingerprint layer.

tests/mcp-reconnect-prefix-invariant.test.ts covers six cases the RFC directly references:

case result
identical tool list fingerprint unchanged (safe-reconnect case)
one tool added fingerprint changes
one tool removed fingerprint changes
description-only edit on an existing tool fingerprint changes
parameter-schema edit fingerprint changes
same tools reordered fingerprint changes (array order is part of the prefix bytes via JSON.stringify)

Why

This gives RFC #110 a concrete reference to point at when weighing strict / permissive / --force approaches: any drift past the "identical bytes" line is a guaranteed cache miss, full stop. So the design conversation can focus on UX policy ("refuse vs warn vs flag-gated"), not on whether the underlying claim is actually true.

This is a tests-only change, no source files touched. Doesn't unblock C2b implementation by itself — that still needs the design call in #110 first.

Test plan

  • npm run verify passes locally (1760 tests, +6)
  • All 6 cases pass against the existing ImmutablePrefix (no behavior change in src/)

The reconnect RFC's central claim — "re-bridging tools mid-session
breaks the prompt prefix when the new tool surface differs from the
old" — was so far an architecture-derived assertion, not an empirical
result. Cheap to lock down at the prefix-fingerprint layer.

`tests/mcp-reconnect-prefix-invariant.test.ts` covers six cases the
RFC directly references:

- identical tool list → fingerprint unchanged (the safe-reconnect case)
- one tool added → fingerprint changes
- one tool removed → fingerprint changes
- description-only edit on an existing tool → fingerprint changes
- parameter-schema edit → fingerprint changes
- same tools reordered → fingerprint changes (array order is part of
  the prefix bytes via JSON.stringify)

This gives RFC #110 a concrete reference to point at when weighing the
strict / permissive / `--force` approaches: any drift past the
"identical bytes" line is a guaranteed cache miss, full stop.

Refs #110.
@esengine esengine merged commit b9a97bb into main May 2, 2026
1 check passed
@esengine esengine deleted the test/mcp-reconnect-prefix-invariant branch May 2, 2026 08:41
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