Skip to content

Commit fc4f20c

Browse files
1.6.44 item 2 fix: the HEAD guard must not fail on a version the floor permits
A DEFECT I SHIPPED, found by the ops seat mirroring this tree the way the standard actually requires. `test_the_package_has_not_yet_taken_over_the_head_fix` asserted `resolved < (2, 9, 4)` as a HARD FAILURE, so that it would "go red by itself when the package catches up". It does. But this fork's requirements line is a `>=2.8.0` FLOOR, and a fresh venv resolves 2.10.0 TODAY — so the assertion fails on every CI leg from the first run. A reminder that turns a permitted dependency resolution into a red build is not a reminder; it is an outage with a helpful message. WHY MY OWN CLEAN-CLONE RUN COULD NOT SEE IT, which is the more useful half. I cloned the tree but reused this seat's .venv, which holds 2.8.0 from an earlier install. The clone tests the CODE; only a FRESH venv from requirements.txt tests the RESOLUTION, and CI does both. A `>=` floor makes those two different questions — item 10 says exactly that about reporting, and I did not apply it to my own verification. REPRODUCED AND FIXED ON A FRESH 3.12 VENV RESOLVING dimll 2.10.0: before: 1 failed, 18 passed (exit 1) <- ops' finding, reproduced after: 20 passed, 1 xfailed (exit 0) TWO REGIMES, ONE POSTURE. Below 2.9.4 the shim is LOAD-BEARING; at or above it the package answers HEAD at the router and the shim is REDUNDANT — not wrong, not broken, and the parity table is 15/15 either way. The shim stays INSTALLED in both, because it is retired by the PIN ROUND (1.6.45) on a re-measured parity table, never by whichever version a resolver happened to pick. The "shim still required" clause is now an xfail rather than an assert, so the day the package takes over is VISIBLE in CI as an XFAIL transition instead of a red build; the resolved version and which mechanism answered HEAD are recorded as test properties and printed, so somebody reads it when the pin round comes. DIVERGENCES 17 carries the same two-regime sentence. ONE PROCESS NOTE: my first attempt to verify this ran pytest in a venv where I had installed it under `--no-deps`, so both the before and after runs exited 1 on a missing `pluggy`. Read carelessly, that would have "confirmed" the bug and then "confirmed" the fix failing, from a packaging error of my own. Exit codes were re-taken after installing pytest properly. Seat venv (dimll 2.8.0): 578 passed, 3 skipped, exit 0 — gated. Fresh venv (dimll 2.10.0), this file: 20 passed, 1 xfailed, exit 0. flake8 on CI exact line: exit 0, 0 lines. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014QRqmPVfHxJQC41PaYDnqb
1 parent 2808e92 commit fc4f20c

2 files changed

Lines changed: 131 additions & 29 deletions

File tree

‎DIVERGENCES.md‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,30 @@ pannellum. Production is Flask, where Werkzeug derives HEAD from every
428428
GET rule, so the wire was never affected; `lib/backend.py` puts the
429429
ASGI lane one env var away, which is what makes it worth fixing.
430430

431-
RETIRE IT AT 1.6.45, on a re-measurement and not on the date — same
432-
trigger as run.py's `_openapi_kwargs` guard.
433-
`tests/test_head_get_parity.py` fails on its own when the resolved
434-
package reaches 2.9.4, so the prompt fires without anyone remembering.
431+
TWO VERSION REGIMES, ONE POSTURE — and the distinction is what a
432+
`>=` floor makes unavoidable. The floor permits any version from
433+
2.8.0 up, and a fresh venv resolves **2.10.0 today**, so both of
434+
these are normal states of this repo:
435+
436+
* **below 2.9.4** — the package does not walk the router, the shim is
437+
LOAD-BEARING, and its absence is a defect;
438+
* **at or above 2.9.4** — the package adds HEAD wherever GET is
439+
allowed, so the shim is REDUNDANT. Not wrong, not broken: the
440+
parity table is 15/15 either way. It stays INSTALLED.
441+
442+
The shim is retired by the PIN ROUND (1.6.45), never by whichever
443+
version a resolver happened to pick, and never on a date — a
444+
re-measured parity table without it is the trigger, the same rule as
445+
run.py's `_openapi_kwargs` guard.
446+
447+
`tests/test_head_get_parity.py` records which regime it ran in and
448+
xfails the "shim still required" clause above 2.9.4, so the day the
449+
package takes over is VISIBLE in CI output as an XFAIL transition
450+
without being a red build. It asserted that clause as a hard failure
451+
until the ops seat mirrored this tree on a FRESH venv: our `>=2.8.0`
452+
floor resolved 2.10.0 and the guard failed on every leg. A reminder
453+
that turns a permitted dependency resolution into a red build is not
454+
a reminder.
435455

436456
---
437457

‎tests/test_head_get_parity.py‎

Lines changed: 107 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -90,35 +90,117 @@ def test_the_shim_is_present_and_registered_outermost():
9090
)
9191

9292

93-
def test_the_package_has_not_yet_taken_over_the_head_fix():
94-
"""The removal trigger, pinned so it fires on its own.
95-
96-
When the resolved dash-improve-my-llms reaches 2.9.4 this goes RED, which
97-
is the prompt to re-measure the parity table without the middleware and
98-
retire it as the template did. Without this, the shim outlives its reason
99-
and silently masks a regression in the package's own fix — the template's
100-
stated motive for removing rather than leaving it harmless.
93+
def _resolved_dimll() -> tuple:
94+
"""The RESOLVED package version as a tuple, e.g. (2, 10, 0).
95+
96+
Imported, not read from requirements.txt — this fork's line is a `>=`
97+
FLOOR, so the file states an intention and the import states the fact, and
98+
on this item they are routinely different numbers.
10199
"""
102100
import dash_improve_my_llms as pkg
103101

104-
def _v(text):
105-
parts = []
106-
for chunk in str(text).split(".")[:3]:
107-
digits = ""
108-
for ch in chunk:
109-
if not ch.isdigit():
110-
break
111-
digits += ch
112-
if not digits:
102+
parts = []
103+
for chunk in str(pkg.__version__).split(".")[:3]:
104+
digits = ""
105+
for ch in chunk:
106+
if not ch.isdigit():
113107
break
114-
parts.append(int(digits))
115-
return tuple(parts)
116-
117-
assert _v(pkg.__version__) < (2, 9, 4), (
118-
f"dash-improve-my-llms resolved {pkg.__version__} >= 2.9.4: the "
119-
"package now adds HEAD wherever GET is allowed. Re-run the parity "
120-
"table WITHOUT HeadAsGetMiddleware, confirm 15/15, then delete the "
121-
"class, its registration and these two tests (1.6.45)."
108+
digits += ch
109+
if not digits:
110+
break
111+
parts.append(int(digits))
112+
return tuple(parts)
113+
114+
115+
PACKAGE_ANSWERS_HEAD = _resolved_dimll() >= (2, 9, 4)
116+
117+
118+
def test_the_shim_stays_installed_in_both_version_regimes():
119+
"""The shim is KEPT until the pin round retires it, whichever version
120+
resolves — and this test says which regime it is running in.
121+
122+
THE BUG THIS REPLACES, because it is the more useful half of the record.
123+
The first version asserted `resolved < (2, 9, 4)` as a hard failure, so
124+
that it would "go red by itself when the package catches up". It does —
125+
but our requirements line is a `>=2.8.0` FLOOR, so a fresh venv resolves
126+
2.10.0 TODAY and the assertion fails on every CI leg from the first run.
127+
A reminder that turns a permitted dependency resolution into a red build
128+
is not a reminder, it is an outage with a helpful message.
129+
130+
My own clean-clone verification could not see it: I cloned the tree but
131+
reused this seat's `.venv`, which holds 2.8.0 from an earlier install. The
132+
clone standard means a FRESH venv from requirements.txt — the clone tests
133+
the code, the venv tests the resolution, and only the pair tests what CI
134+
runs. Found by the ops seat on 3.14 with dimll 2.10.0.
135+
"""
136+
import lib.asgi_middleware as mod
137+
138+
assert hasattr(mod, "HeadAsGetMiddleware"), (
139+
"HeadAsGetMiddleware is gone. It is retired by the PIN round (1.6.45), "
140+
"not by the resolved version — until then it stays installed in both "
141+
"regimes, harmless where the package also answers HEAD."
142+
)
143+
144+
145+
def test_the_head_fix_is_provided_by_someone_in_this_regime(record_property):
146+
"""WHICH mechanism answers HEAD here, recorded rather than asserted away.
147+
148+
Two regimes, one requirement — the parity table above must be 15/15
149+
either way:
150+
151+
* below 2.9.4 the package does NOT walk the router, so the shim is
152+
LOAD-BEARING and its absence is a defect;
153+
* at or above 2.9.4 the package adds HEAD wherever GET is allowed, so the
154+
shim is REDUNDANT — a note, never a failure, because the floor permits
155+
this version and nothing is broken by it.
156+
157+
The note is emitted as a test property so it lands in CI's output, which
158+
is where somebody will read it when the pin round comes.
159+
"""
160+
version = _resolved_dimll()
161+
regime = "package" if PACKAGE_ANSWERS_HEAD else "shim"
162+
record_property("dimll_resolved", ".".join(str(n) for n in version))
163+
record_property("head_fix_provided_by", regime)
164+
165+
import lib.asgi_middleware as mod
166+
167+
assert hasattr(mod, "HeadAsGetMiddleware")
168+
169+
if PACKAGE_ANSWERS_HEAD:
170+
print(
171+
f"\n[1.6.44 item 2] dash-improve-my-llms {'.'.join(map(str, version))} "
172+
">= 2.9.4: the package now answers HEAD at the router, so "
173+
"HeadAsGetMiddleware is REDUNDANT here. It stays installed until "
174+
"the pin round (1.6.45) retires it deliberately, on a re-measured "
175+
"parity table — see DIVERGENCES 17."
176+
)
177+
else:
178+
print(
179+
f"\n[1.6.44 item 2] dash-improve-my-llms {'.'.join(map(str, version))} "
180+
"< 2.9.4: HeadAsGetMiddleware is LOAD-BEARING here."
181+
)
182+
183+
184+
@pytest.mark.xfail(
185+
PACKAGE_ANSWERS_HEAD,
186+
reason=(
187+
"the resolved dash-improve-my-llms is >= 2.9.4, so the package answers "
188+
"HEAD itself and the shim is no longer required. XFAIL rather than a "
189+
"hard failure: the floor permits this version and the parity table is "
190+
"still 15/15. Retire the shim in the pin round (1.6.45), not here."
191+
),
192+
strict=False,
193+
)
194+
def test_the_shim_is_still_required():
195+
"""The 'still required' clause, xfailed in the regime where it is false.
196+
197+
This is the clause that used to be a hard assert. As an xfail it still
198+
FLIPS visibly the day the package takes over — an XPASS/XFAIL transition
199+
in CI's output — without turning that day into a red build.
200+
"""
201+
assert not PACKAGE_ANSWERS_HEAD, (
202+
"the package answers HEAD itself now; the shim is redundant (not "
203+
"broken) and is retired by the pin round"
122204
)
123205

124206

0 commit comments

Comments
 (0)