Skip to content

test: tier guard misses capture reads via a module-level CAPTURES tuple #2426

Closed

Description

@JarryShaw

Describe the bug

tests/test_tier_guard.py claims to stop a unit-tier module from reading a generated sample capture, but doesn't catch this shape: tests/foundation/reassembly/test_datagram_deferred_pickle_2417_unit.py's SampleCaptureDatagramPickleTests.test_every_capture_with_tcp_flows_round_trips reads generated captures (http.pcap, stream.pcap, tcp.pcap, http6.cap, via a module-level CAPTURES tuple feeding a SAMPLE_ROOT import) from a _unit.py file, and the guard's AST analysis apparently doesn't follow that indirection — it ran green (135 passed/2505 subtests) on a tree carrying the violation. Found via PR #2421's CI going red on Python 3.11–3.15 (AssertionError: .../examples/captures/http.pcap is missing), since the unit-tests CI leg only runs make_samples.py for... actually doesn't run it at all for _unit.py modules — see #2417/#2421's fix-up PR for the immediate fix (moving the sample-dependent test class to a _runtime.py file).

Expected behavior

The guard should flag a unit-tier module whose tests read a path under examples/captures/ reached indirectly through a module-level tuple/constant, not just a literal path string inline in the test body.

Additional context

Found and reported by an agent during PR #2421 review (2026-10-29). Not urgent — the immediate CI break is being fixed directly — but the guard itself needs strengthening so this class of mistake is caught before merge next time.

Activity

  1. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    testPull requests that add or correct tests (test: subject prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 29, 2026
  2. moved this to Pending in PyPCAPKiton Oct 29, 2026
  3. added this to the PyPCAPKit v1.5 milestone on Oct 29, 2026
  4. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 29, 2026
  5. moved this from Pending to WIP in PyPCAPKiton Oct 29, 2026
  6. added a commit that references this issue on Oct 29, 2026
    cb573a1
  7. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 29, 2026
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

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)testPull requests that add or correct tests (test: subject prefix)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions