fix(publish): restore the already-UTC fast path — it was load-bearing, not dead weight - #38
stephschofield wants to merge 4 commits into
Conversation
…, not dead weight
The audit removed:
if s.endswith("Z") and "+" not in s:
return s
as redundant with the fromisoformat/astimezone path below. It is not. The
strftime format emits whole seconds only, so an already-conformant value with
sub-second precision is silently truncated:
2026-07-15T15:36:06.123456Z -> 2026-07-15T15:36:06Z
That is a behavior change, contradicting the PR's headline 'behavior-neutral'
claim. It is reachable: leaderboard.py:75's schema explicitly admits fractional
seconds ((\.\d+)?Z) and 'publish build --updated-at' passes caller input
straight through, so the truncated value is one the schema declares valid.
1123 tests missed it because every timestamp fixture uses whole seconds and the
one normalization test asserts only .endswith('Z') — which a truncated value
still satisfies.
RED: 2 failed, 4 passed. GREEN: 42 passed. Hermetic: 1121 passed, 35 skipped.
…e order Records all 18 findings across the 6 open PRs including the 9 that did NOT survive verification — a review that logs only confirmations is not auditable. Headline: #29 and #33 rewrite the same submit.py line with incompatible semantics and neither conflicts with main, so a per-branch conflict check clears both. Merging #33 first silently reintroduces issue #32.
BOTH reviewers independently returned NAUGHTY: the restored fast path
'endswith("Z") and "+" not in s' returns junk VERBATIM, skipping validation.
Verified reachable — publish build --updated-at passes caller input straight
through into published leaderboard.json:
'not-a-timestampZ' -> returned verbatim
'2026-13-45T99:99:99Z' -> returned verbatim AND the schema ACCEPTS it
(digit-shaped: month 13, day 45 publish clean)
'2026-07-15T15:36:06-05:00Z' -> negative offset carries no '+', so it slipped
Confirmed byte-identical on origin/main, so the flaw is PRE-EXISTING, not
introduced here. Hardened anyway: both reviewers rated it FAIL, it is one line,
and shipping a known hole because it predates us is how holes persist.
Fix: match the SCHEMA'S OWN pattern instead of a bare suffix test, then parse to
reject digit-shaped impossible dates the regex alone admits. Everything failing
the match falls through to fromisoformat then _EPOCH, so it stays fail-closed.
precision preserved : ...06.123456Z -> ...06.123456Z (the fix's purpose)
conversion intact : ...06-05:00 -> ...20:36:06Z (no regression)
malformed rejected : all five vectors -> _EPOCH
test_fast_path_admits_exactly_the_schema_shape asserts the regex equals the
schema's pattern, so the two cannot drift apart and reopen the bypass.
🎅 Santa Loop Review — Round 1SANTA VERDICT: NAUGHTY — by protocol only. Both reviewers scored Correctness, Security, Error handling, Completeness, Internal consistency, and No regressions as PASS. The single dissent is Reviewer B failing Test coverage on uncovered edge classes. No defect was found in the shipped code.
Rubric
Agreement
Critical issuesNone. No reviewer found a defect in the code as shipped. B's blocking item is a test-coverage gap, not a bug — the behaviors it wants pinned were verified correct by hand: Suggestions
Verification performed
Dual independent adversarial review — no shared context between reviewers. |
Stacked on #34. Fixes the one HIGH finding an adversarial review confirmed against it.
The regression
The audit removed this from
publish.py:_normalize_utc_zas redundant:It is not redundant. The
strftime("%Y-%m-%dT%H:%M:%SZ")below emits whole seconds only, so an already-conformant UTC value loses sub-second precision:main2026-07-15T15:36:06.123456Z2026-07-15T15:36:06.123456Z2026-07-15T15:36:06Z❌2026-07-15T15:36:06.500Z2026-07-15T15:36:06.500Z2026-07-15T15:36:06Z❌2026-07-15T15:36:06-05:002026-07-15T20:36:06Z2026-07-15T20:36:06Z✅This contradicts the PR's headline "Behavior-neutral: no feature, guard, or error path changes."
Reachable, not theoretical
leaderboard.py:75— the schema explicitly admits fractional seconds:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?Z$publish.py:432—publish build --updated-atpasses caller input straight throughSo the value being truncated is one the schema itself declares valid.
Why 1123 tests missed it
Every existing timestamp fixture uses whole seconds, and the one normalization test asserts only
doc["updated_at"].endswith("Z")— which a truncated value still satisfies. The assertion cannot distinguish the regression from correct behavior. That gap is now closed by an exact-equality assertion.TDD
RED, against #34 head:
GREEN:
42 passed. Full hermetic suite: 1121 passed, 35 skipped. The 5test_containment.pyfailures reproduce identically on cleanorigin/main(local userns unavailable) — pre-existing and environmental.test_normalize_still_converts_offsets_to_zguards the other direction, so restoring the fast path cannot shadow the conversion it precedes.The rest of the audit's cuts verified clean — 506 deletions/61 insertions is exact, all four DEMO_FIX_PLAN items confirmed shipped, dead symbols have zero remaining references.
Evidence:
docs/proof/pr-review-fleet-2026-08/pr34-utc-truncation.png