Skip to content

The report-completeness "parity test" could not detect the drift it guarded - #1564

Merged
ryanbr merged 1 commit into
mainfrom
fix/1531-completeness-parity-claim
Aug 23, 2026
Merged

ryanbr merged 1 commit into
mainfrom
fix/1531-completeness-parity-claim

Conversation

@ryanbr

@ryanbr ryanbr commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1531. @bhelm corrected the Swift side's false claim that the two completeness guards are kept aligned by a parity test. The same falsehood was mirrored on the Android side, which that PR did not touch — so the two files were left openly contradicting each other.

What was wrong

ReportCompleteness.kt claimed its token map was "byte-identical to the Swift twin", and named a Swift type — ReportCompleteness — that does not exist. Swift's is CaptureCompleteness.

Measured against the ten tokens the test pins:

Count Examples
Match Swift exactly 4 sleep, workouts, recovery, hrv
Differ by a trailing fragment 3 universal, connection, display
No counterpart in Swift at all 3 import parser= vs import stage=, stepsEst vs stepsRaw, battery series= vs bank soc=

The divergence is not a bug

Each side must key on the tokens its own emitters write, and the two platforms word several of those lines differently. Aligning the maps would break the guard on whichever platform lost. The header now says so explicitly, with the three cases named, so nobody "corrects" them into alignment later.

The test was the worse half

ReportCompletenessParityTest asserted "Byte-identical to the Swift ReportCompleteness.killerTokens" — and then pinned literals held in the test file itself. It never read the Swift side, so it could not fail when the platforms drifted, and it stayed green throughout the divergence above.

A test that names a guarantee it cannot check is worse than no test, because it invites a reader to stop looking. That is exactly what happened here: the claim survived long enough for three tokens to lose their counterparts entirely.

Renamed to ReportCompletenessContractTest, with its doc rewritten to state what it actually guarantees — which is still worth having: Android's own map, section ordering and present/MISSING wording cannot change by accident. The cross-platform contract that does matter (the section a maintainer reads being identically shaped) is now called out as the real one.

Verification

  • Comments and the class rename only — no assertion, token or logic changed. Verified mechanically: the sole non-comment diff line is class ReportCompletenessParityTest → class ReportCompletenessContractTest.
  • All 17 tests pass under the new name; no stale references to the old class remain.
  • Android 4,241 tests, 0 failures, matching main. Doc lint clean.
  • No Swift touched, so app-build does not apply.

…uarded

Follow-up to #1531. @bhelm corrected the Swift side's false claim that the two
completeness guards are kept aligned by a parity test. The same falsehood was
mirrored on the Android side, which that PR did not touch, so the two files were
left openly contradicting each other.

ReportCompleteness.kt claimed its token map was "byte-identical to the Swift
twin", and named a Swift type -- ReportCompleteness -- that does not exist;
Swift's is CaptureCompleteness. Measured against the ten tokens the test pins:
four match Swift exactly, three differ only by a trailing fragment, and three
have no counterpart in the Swift map at all -- import ("import parser=" vs
"import stage="), steps ("stepsEst " vs "stepsRaw") and battery ("battery
series=" vs "bank soc=").

That divergence is not a bug to fix. Each side must key on the tokens ITS OWN
emitters write, and the two platforms word several of those lines differently, so
aligning the maps would break the guard on whichever platform lost. The header
now says so explicitly, with the three cases named, so nobody "corrects" them
into alignment later.

The test was the worse half. ReportCompletenessParityTest asserted
"Byte-identical to the Swift ReportCompleteness.killerTokens" and then pinned
literals held in the test file itself. It never read the Swift side, so it could
not fail when the platforms drifted -- and it stayed green throughout the
divergence above. A test that names a guarantee it cannot check is worse than no
test, because it invites a reader to stop looking.

Renamed to ReportCompletenessContractTest and its doc rewritten to say what it
actually guarantees, which is still worth having: Android's own map, section
ordering and present/MISSING wording cannot change by accident. The cross-
platform contract that DOES matter -- the section a maintainer reads being
identically shaped -- is called out as the real one.

Comments and the class rename only; no assertion, token or logic changed. All 17
tests still pass under the new name, Android 4241 tests / 0 failures matching
main, doc lint clean.
@ryanbr
ryanbr merged commit 16b4952 into main Aug 23, 2026
3 checks passed
@ryanbr
ryanbr deleted the fix/1531-completeness-parity-claim branch August 23, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant