Skip to content

fix(testing): cannot-fail scan counts a Python or Go test's own name as an assertion #6211

Closed

Description

@kyle-sexton

This was generated by AI during work-loop.

Context

PR A of #6040 fixed a C# leak in the testing plugin's cannot-fail scanner (plugins/testing/skills/audit/scripts/cant-fail-scan.awk): the test's own declaration line was counted as an assertion token, so a test named, for example, Check... or taking an expected parameter was treated as asserting even when its body asserted nothing.

While doing it, the implementer reported that the Python and Go lanes have the same leak: the name on the declaration line counts as an assertion token. None of #6040's PRs A to D covers it.

Unverified beyond that report; reproduce first.

Proposed work

Reproduce with a Python and a Go fixture whose test name contains an assertion-shaped token but whose body asserts nothing. Then apply the same declaration-line blanking the C# fix uses.

Acceptance criteria

  • For Python and for Go: a bad fixture with an assertion-shaped name and no assertion fires rule-zero-assertion, and is red on the current engine.
  • A stay-quiet fixture per language: a test with the same kind of name that does assert stays quiet.
  • No finding changes on existing tracked Python and Go tests except the intended ones.

References

Metadata

Filed by the work-loop lane (instance melo-worker-1) per the self-observation contract; not self-triaged.

Activity

  1. added
    needs-triage
    on Oct 4, 2026
  2. github-actions commented on Oct 4, 2026

    @github-actions
    Contributor

    Thanks for the report. This describes a follow-on to #6040's C# fix for cant-fail-scan.awk: the Python and Go lanes reportedly have the same leak, where a test's own declaration line (its name or a parameter like expected) is counted as an assertion token, so a zero-assertion test can pass the cannot-fail scan undetected.

    The acceptance criteria are concrete: a red fixture per language (assertion-shaped name, no real assertion), a stay-quiet fixture per language (same naming, real assertion present), and no regressions on existing tracked tests. The report notes this is unverified beyond the implementer's observation while fixing the C# case, so reproduction is the first step.

    No duplicate open issue found; #6040 and its sibling PRs (A–D) cover C# only and don't touch Python or Go.

    Automated triage. A maintainer reviews it.

  3. added
    good first issue
    on Oct 4, 2026
  4. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Reproduced on the current scanner: a pytest test named test_assert_total_is_computed and a Go test named TestCheckTotal, each with no assertion in its body, are not reported; the same bodies under neutral names (test_plain_total_is_computed, TestPlainTotal) fire rule-zero-assertion.
    Basis: verified, cant-fail-scan.sh --file run this session on two scratch fixtures; the py-pytest adapter's assertion calls include [Aa]ssert and the go-testing adapter's include [Cc]heck, [Vv]erify, [Ee]xpect, [Ee]nsure, [Vv]alidate, matched against the declaration line.

    Agent Brief

    Type: Bug
    Summary: The cannot-fail scanner's Python and Go lanes count the test's own declaration line (its name) as an assertion token, so a zero-assertion test with an assertion-shaped name is never flagged.

    Current behavior:
    For Python (pytest and unittest adapters) and Go (testing adapter), the assertion-token match runs over the test's declaration line as well as its body. A test whose name contains an assertion-shaped token (assert, check, verify, expect, ensure, validate, and similar) is treated as asserting even when its body asserts nothing.

    Desired behavior:

    Key interfaces:

    • The scanner's per-lane test-block assertion counting for the py-pytest, py-unittest and go-testing adapters.
    • The scanner's corpus fixtures (bad and good per adapter, with expect: annotations).

    Acceptance criteria:

    • For Python and for Go: a bad fixture with an assertion-shaped name and no assertion fires rule-zero-assertion, and is red on the current engine.
    • A stay-quiet fixture per language: a test with the same kind of name that does assert stays quiet.
    • No finding changes on existing tracked Python and Go tests except the intended ones.
    • The testing plugin is version-bumped with a CHANGELOG entry.

    Out of scope:

    Routing: delegable. Work class scoped (bug fix). Priority medium (assessed default: a scanner false negative hides cannot-fail tests). Ordering: #6213 edits the same scanner and carries the reference fix, so this work should start after it merges.

  5. added
    agent-ready
    status: ready
    and removed
    good first issue
    needs-triage
    on Oct 4, 2026
  6. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during work-loop.

    Ratify autonomous dispatch of this C3 bug-fix item?

    Classification: work-class: scoped (C3), bug-fix-shaped (confirmed at triage). Intended dispatch: the work-loop worker lane, through /work-items:work, to a draft PR the lane never merges. First drain is not complete and no item-level ratification exists, so it is queued here. Ratify through /work-items:attend-queue.

    Lane: work-loop, instance melo-worker-1, cycle 2.

  7. added
    needs-human
    and removed
    agent-ready
    on Oct 4, 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

    needs-humanstatus: ready

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions