test(maf-guard): raise the floor to 1.18.0 first and prove it red on the installed 1.16.0

Iron Law, F15's procedure repeated: the guard moves BEFORE the pin, and the
move is measured (2 failed / 2 passed against the installed 1.16.0) rather
than asserted. The floor still lives in ONE constant and the pyproject assert
still DERIVES its expected string from it; a second literal would reintroduce
the drift F15 removed.

The stale arm gains 1.16.0 and 1.17.0, and its docstring is corrected rather
than left behind: 1.17.0 is rejected even though agent-framework-foundry
1.13.0 and agent-framework-openai 1.14.3 only require core>=1.17.0 -- a
dependency's own floor is not our floor.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-12 16:57:48 +02:00
commit c623498525

View file

@ -26,12 +26,12 @@ _DIST = "agent-framework-core"
#: expected pin string from it. Two literals for one fact drift (the kø-(p) rule), and a drifted #: expected pin string from it. Two literals for one fact drift (the kø-(p) rule), and a drifted
#: floor is a guard that stops guarding without a local diff. #: floor is a guard that stops guarding without a local diff.
_MIN_MAJOR = 1 _MIN_MAJOR = 1
_MIN_MINOR = 16 _MIN_MINOR = 18
_MIN_VERSION = f"{_MIN_MAJOR}.{_MIN_MINOR}.0" _MIN_VERSION = f"{_MIN_MAJOR}.{_MIN_MINOR}.0"
def assert_supported_maf_version(version_str: str) -> None: def assert_supported_maf_version(version_str: str) -> None:
"""Raise ``ValueError`` when ``version_str`` is outside the supported ``>=1.16.0,<2`` range, """Raise ``ValueError`` when ``version_str`` is outside the supported ``>=1.18.0,<2`` range,
naming the private-API premises to re-verify before a bump. Pure string parse no import side naming the private-API premises to re-verify before a bump. Pure string parse no import side
effects, so a fake version can be passed directly (the RED-proof) without touching the real effects, so a fake version can be passed directly (the RED-proof) without touching the real
install.""" install."""
@ -48,7 +48,7 @@ def assert_supported_maf_version(version_str: str) -> None:
def test_installed_maf_version_is_supported() -> None: def test_installed_maf_version_is_supported() -> None:
"""T-2.5d: the real installed distribution (verified 1.16.0) passes the guard — read from """T-2.5d: the real installed distribution (verified 1.18.0) passes the guard — read from
``importlib.metadata.version``, NOT ``agent_framework.__version__`` (a 0.0.0 placeholder).""" ``importlib.metadata.version``, NOT ``agent_framework.__version__`` (a 0.0.0 placeholder)."""
assert_supported_maf_version(importlib.metadata.version(_DIST)) assert_supported_maf_version(importlib.metadata.version(_DIST))
@ -61,17 +61,20 @@ def test_guard_rejects_future_major() -> None:
def test_guard_rejects_too_old_minor() -> None: def test_guard_rejects_too_old_minor() -> None:
"""T-2.5d / F15: the PREVIOUS floor (``1.9.0``) now trips the guard — the pin is two-sided, and """T-2.5d / F15 / F16: every PREVIOUS floor now trips the guard — the pin is two-sided, and this
this is the arm that makes the F15 lift measurable rather than asserted. ``1.15.0`` is rejected is the arm that makes each lift measurable rather than asserted. ``1.15.0`` (the
too: ``agent-framework-orchestrations`` 1.1.1 requires ``core>=1.15.0``, but 1.16.0 is the ``agent-framework-orchestrations`` 1.1.1 requirement ``core>=1.15.0``) and ``1.16.0`` (F15's
version whose private-API premises were actually re-verified.""" floor) are rejected too, and so is ``1.17.0``, even though ``agent-framework-foundry`` 1.13.0
for stale in ("1.8.0", "1.9.0", "1.15.0"): and ``agent-framework-openai`` 1.14.3 only require ``core>=1.17.0``: a dependency's own floor is
not our floor. 1.18.0 is the version whose private-API premises were actually re-verified
(F16, docs/2026-09-12-f16-maf-1180.md)."""
for stale in ("1.8.0", "1.9.0", "1.15.0", "1.16.0", "1.17.0"):
with pytest.raises(ValueError, match="private-API premises"): with pytest.raises(ValueError, match="private-API premises"):
assert_supported_maf_version(stale) assert_supported_maf_version(stale)
def test_pyproject_pins_agent_framework_core_below_2() -> None: def test_pyproject_pins_agent_framework_core_below_2() -> None:
"""T-2.5d: ``pyproject.toml`` pins ``agent-framework-core>=1.16.0,<2`` — the install-time half of """T-2.5d: ``pyproject.toml`` pins ``agent-framework-core>=1.18.0,<2`` — the install-time half of
the guard (the test above is the test-time half). The expected string is DERIVED from the guard (the test above is the test-time half). The expected string is DERIVED from
``_MIN_VERSION`` so the two halves cannot drift apart.""" ``_MIN_VERSION`` so the two halves cannot drift apart."""
pyproject = (Path(__file__).resolve().parents[1] / "pyproject.toml").read_text(encoding="utf-8") pyproject = (Path(__file__).resolve().parents[1] / "pyproject.toml").read_text(encoding="utf-8")