Skip to content

Flaky Java entrypoint tests can fail the release gate, which deletes the tag #344

Description

@rahlk

Problem

tests/analysis/java/test_jcodeanalyzer.py::test_get_all_entrypoint_methods_in_application failed on assert len(entrypoint_methods) > 0 during one full release-gate run, while the runs either side of it were green and the file passes 44/44 in isolation.

This matters more than an ordinary flake: .github/workflows/release.yml deletes the tag when the gate fails (#306), so a spurious red does not merely annoy, it kills a release that was otherwise fine. The first v2.0.0-rc.2 tag was already lost once to a genuine failure; a flake costs the same tag.

What is established

  • Not reproducible by repetition. Three consecutive tests/analysis/java runs: 129 passed, 14 skipped each time. So the Java suite alone does not poison itself.
  • Not an ordering effect. pytest-randomly is not installed, so collection order is stable between runs.
  • Seen only inside a full-suite gate run, which is what makes a shared-state trigger the leading hypothesis rather than the test's own logic.
  • The shape fits. The test constructs a real JCodeanalyzer over the unzipped daytrader8 fixture with eager_analysis=False, so it reuses whatever analysis.json is already cached rather than re-running the analyzer. An empty entrypoint map is exactly what reading a stale, partial or foreign cache would produce. Three tests in the file share that shape.

Not yet established: which other test leaves the cache in that state, and whether an interrupted analyzer run can leave a partial analysis.json behind that the level check still accepts.

Scope boundary

In scope: making these tests independent of cache state — a per-test cache directory, or a mocked analyzer where the test is about the accessor rather than the analyzer.

Out of scope: the check_exisiting_analysis_file_level reuse logic itself, unless the investigation shows a partial file passes it.

Already fixed on an unmerged branch, but not where it currently ships

Leg 3a (#310) rewrites this file: every test drives a mocked analyzer with analysis_json_path=tmp_path, so no test touches a shared cache and the shape is gone. But the TypeScript release (rc.3) lands before Java 3a, so the branch that ships next still carries the flaky version. Either land a minimal fix on release/2.0 first, or accept a re-tag risk on rc.3 knowingly.

Definition of done

  • The three real-analyzer tests in test_jcodeanalyzer.py no longer depend on cache state left by any other test
  • The full gate run ten times without a spurious failure, or the trigger identified and named

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions