Skip to content

Commit d465ce8

Browse files
alistair3149claude
andcommitted
Pin two cache-hint seams
A resources/read result now asserts the per-operation hint — the one operation where a per-registration hint would take precedence, so a future registerResource cacheHint cannot silently shadow it. The legacy-era test asserts hints stay off 2025-era responses. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 036e0a9 commit d465ce8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/transport/modernEra.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ describe('2026-07-28 era over Streamable HTTP (in-memory)', () => {
103103
const resources = await client.listResources();
104104
expect(resources.ttlMs).toBe(60_000);
105105
expect(resources.cacheScope).toBe('private');
106+
107+
// resources/read is the one operation with a competing precedence path
108+
// (a per-registration cacheHint would override field by field), so pin
109+
// that the per-operation hint reaches an actual read result.
110+
const read = await client.readResource({ uri: 'mcp://wikis/test-wiki' });
111+
expect(read.ttlMs).toBe(60_000);
112+
expect(read.cacheScope).toBe('private');
106113
});
107114

108115
it('falls back to a legacy handshake through the same handler when negotiation is off', async () => {
@@ -115,6 +122,10 @@ describe('2026-07-28 era over Streamable HTTP (in-memory)', () => {
115122

116123
const tools = await client.listTools();
117124
expect(tools.tools.length).toBeGreaterThan(0);
125+
// Cache hints are a 2026-07-28 wire feature; a legacy-era response must
126+
// not carry them.
127+
expect(tools.ttlMs).toBeUndefined();
128+
expect(tools.cacheScope).toBeUndefined();
118129
});
119130

120131
it('delivers toolsChanged to a modern listen subscriber when a management tool reconciles', async () => {

0 commit comments

Comments
 (0)