2020from tests .interaction ._requirements import (
2121 CONNECTABLE_TRANSPORTS ,
2222 REQUIREMENTS ,
23+ SPEC_2026_BASE_URL ,
24+ SPEC_BASE_URL ,
2325 SPEC_VERSIONS ,
2426 ArmExclusion ,
2527 KnownFailure ,
@@ -116,6 +118,12 @@ def test_spec_versions_are_known_and_include_latest() -> None:
116118 assert LATEST_PROTOCOL_VERSION in SPEC_VERSIONS
117119
118120
121+ def test_spec_base_urls_are_pinned_to_their_revision () -> None :
122+ """SPEC_BASE_URL constants are pinned literals, so growing SPEC_VERSIONS cannot repoint existing source links."""
123+ assert SPEC_BASE_URL == "https://modelcontextprotocol.io/specification/2025-11-25"
124+ assert SPEC_2026_BASE_URL == "https://modelcontextprotocol.io/specification/2026-07-28"
125+
126+
119127def test_connectable_transports_match_connect_factories () -> None :
120128 """CONNECTABLE_TRANSPORTS and the conftest factory map name exactly the same transports."""
121129 assert set (CONNECTABLE_TRANSPORTS ) == set (_FACTORIES )
@@ -260,8 +268,8 @@ def _req(
260268
261269
262270def test_compute_cells_with_no_requirements_yields_full_grid () -> None :
263- """An empty requirement list yields one cell per connectable transport at the single active spec version ."""
264- cells = compute_cells ([])
271+ """With a single-version axis, an empty requirement list yields one cell per connectable transport."""
272+ cells = compute_cells ([], spec_versions = ( "2025-11-25" ,) )
265273 assert [c .id for c in cells ] == ["in-memory" , "sse" , "streamable-http" , "streamable-http-stateless" ]
266274 assert [c .values for c in cells ] == [
267275 (("in-memory" , "2025-11-25" ),),
@@ -301,7 +309,10 @@ def test_compute_cells_drops_era_locked_transport_outside_its_versions() -> None
301309
302310def test_compute_cells_honours_arm_exclusion_from_any_stacked_requirement () -> None :
303311 """An arm exclusion on any stacked requirement drops the matching cell even when other requirements have none."""
304- cells = compute_cells ([_req (), _req (arm_exclusions = (ArmExclusion (reason = "requires-session" , transport = "sse" ),))])
312+ cells = compute_cells (
313+ [_req (), _req (arm_exclusions = (ArmExclusion (reason = "requires-session" , transport = "sse" ),))],
314+ spec_versions = ("2025-11-25" ,),
315+ )
305316 assert [c .id for c in cells ] == ["in-memory" , "streamable-http" , "streamable-http-stateless" ]
306317
307318
@@ -313,7 +324,10 @@ def test_compute_cells_wildcard_arm_exclusion_drops_every_cell() -> None:
313324
314325def test_compute_cells_marks_known_failure_as_strict_xfail () -> None :
315326 """A known failure attaches a strict xfail mark to exactly the matching cell and leaves others unmarked."""
316- cells = compute_cells ([_req (known_failures = (KnownFailure (note = "broken on sse" , transport = "sse" ),))])
327+ cells = compute_cells (
328+ [_req (known_failures = (KnownFailure (note = "broken on sse" , transport = "sse" ),))],
329+ spec_versions = ("2025-11-25" ,),
330+ )
317331 by_id = {c .id : c for c in cells }
318332 assert set (by_id ) == {"in-memory" , "sse" , "streamable-http" , "streamable-http-stateless" }
319333 assert by_id ["sse" ].marks [0 ].name == "xfail"
@@ -325,21 +339,21 @@ def test_compute_cells_marks_known_failure_as_strict_xfail() -> None:
325339
326340def test_compute_cells_wildcard_known_failure_marks_every_cell () -> None :
327341 """A known failure with both transport and spec_version unset marks every emitted cell as strict xfail."""
328- cells = compute_cells ([_req (known_failures = (KnownFailure (note = "all broken" ),))])
342+ cells = compute_cells ([_req (known_failures = (KnownFailure (note = "all broken" ),))], spec_versions = ( "2025-11-25" ,) )
329343 assert len (cells ) == 4
330344 assert all (c .marks [0 ].name == "xfail" for c in cells )
331345 assert all (c .marks [0 ].kwargs == {"reason" : "all broken" , "strict" : True } for c in cells )
332346
333347
334348def test_compute_cells_ignores_transports_field () -> None :
335349 """Requirement.transports is descriptive metadata only and does not filter the cell grid."""
336- cells = compute_cells ([_req (transports = ("stdio" ,))])
350+ cells = compute_cells ([_req (transports = ("stdio" ,))], spec_versions = ( "2025-11-25" ,) )
337351 assert [c .id for c in cells ] == list (CONNECTABLE_TRANSPORTS )
338352
339353
340354def test_cell_id_omits_version_when_single_spec_version () -> None :
341- """With one active spec version the cell id is just the transport name, keeping today's node ids byte-identical ."""
342- assert cell_id ("sse" , "2025-11-25" ) == "sse"
355+ """With a single- version axis the cell id is just the transport name."""
356+ assert cell_id ("sse" , "2025-11-25" , spec_versions = ( "2025-11-25" ,) ) == "sse"
343357
344358
345359def test_cell_id_appends_version_when_multiple_spec_versions () -> None :
0 commit comments