Skip to content

fix(tests): assert the packaging manifest, not whatever is in dist/ - #35

Merged
offendingcommit merged 1 commit into
mainfrom
fix/stale-wheel-assertion
Sep 21, 2026
Merged

offendingcommit merged 1 commit into
mainfrom
fix/stale-wheel-assertion

Conversation

@offendingcommit

Copy link
Copy Markdown
Owner

Fixes a test I added in #30 that reintroduced the exact bug this work set out to remove.

The flaw

The wheel-membership assertion read dist/ and so depended on ambient state. dist/ is gitignored, so CI has none and the test skips, while a stale local artifact fails it. Local/CI asymmetry — in the test meant to guard against exactly that.

main is red locally right now because of it.

Why mtime wouldn't have fixed it

The artifact that exposed this was newer than the source and still wrong — built during a mutation test from a deliberately broken tree. Freshness and correctness are different questions, and only one is visible from a timestamp. Any staleness heuristic here would have been a second guess dressed as a check.

The fix

Assert the trap where it's deterministic. pyproject.toml lists packages explicitly, so a new package directory is dropped from the wheel silently. Comparing that list against the package directories on disk catches it from source — no build, nothing ambient, and it now runs everywhere instead of skipping in the one environment that matters.

End-to-end proof stays in just check-install, which builds, installs and imports every __all__ name, and already runs in the package job.

Mutation-tested

undeclared subpackage -> this test FAILS   (guard works)
same tree, twine check -> PASSES           (blind, as documented)

Suite goes from 43 tests with 1 skip to 44 with none.

The wheel-membership assertion read dist/ and so depended on ambient
state. dist/ is gitignored, so CI had none and the test skipped, while
a stale local artifact failed it -- the precise local/CI asymmetry this
work set out to remove, reintroduced by the test meant to guard it.

mtime cannot fix it either. The artifact that exposed this was *newer*
than the source and still wrong: it was built during a mutation test
from a deliberately broken tree. Freshness and correctness are
different questions, and only one of them is visible from a timestamp.

So assert the actual trap where it is deterministic. pyproject lists
packages explicitly, so a new package directory is dropped from the
wheel silently; comparing that list against the package directories on
disk catches it from source, with no build and nothing ambient. The
test now runs everywhere instead of skipping in the one environment
that matters.

End-to-end proof stays in just check-install, which builds, installs
and imports, and already runs in the package job.

Mutation-tested against the real trap: an undeclared subpackage fails
this test, and twine check passes on the same tree -- confirming again
that metadata validation cannot see archive contents.
@offendingcommit
offendingcommit merged commit 7b6b416 into main Sep 21, 2026
6 checks passed
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