Skip to content

Seven components/offload tests fail on main at -count=2: extract_econ global state leaks between runs #246

Description

@amiddavid

Seven tests in components/offload fail on origin/main at -count=2 and pass at -count=1:

  • TestGatePermitsHighReuseContent
  • TestBreakEvenSizesMatchTheDocumentedVerdict
  • and five more in the same file

The cause is global state in extract_econ leaking between runs. A review reproduced it independently on origin/main, so it is not a regression from any open branch.

Why it is worth its own issue rather than a note

It makes a claim several PRs have made unfalsifiable. "go test -race ./... is clean" is a normal line in a PR description here, and it is true — at -count=1, which is the default. A test that only passes on a fresh process is a test that has not been shown to be independent of the ones before it, and this package's tests are exactly where the economics of an expensive component are pinned. A leak that changes a gate's verdict between runs could equally change it between an ordering the CI happens to use and one a developer happens to use.

-count=2 is also the cheapest available check for this class of defect: it needs no new infrastructure, and it is how the leak was found.

Suggested shape

  1. Find the package-level state. extract_econ's pricing/aggressiveness tables are the named suspect; confirm rather than assume, because a second leaking variable would be masked by fixing the first.
  2. Reset it per test, or make it an instance field. Instance is better where it is reachable — a reset hook is another thing to remember.
  3. Add -count=2 to the test target, or at least to CI, so the property is checked rather than known. Without that step this recurs the next time a table is hoisted for convenience.

Not attributable to any branch

Reproduced on origin/main at e66f255. Per the repo rule for a defect in main unrelated to the change under test: its own issue, its own worktree branched from origin/main, its own PR — a fix riding a long-lived feature branch cannot ship until that branch merges.

Found by the review on #234, which ran the suite at -count=2 and then checked main before attributing it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions