Skip to content

feat(testing): add a Ruby adapter to the cannot-fail scanner (RSpec, minitest) #6238

Closed as not planned

Description

@kyle-sexton

Summary

The testing plugin's cannot-fail scanner (/testing:audit, and the test-scan and test-weaken hooks that run the same engine) covers JS/TS, Python, C#, Bash, PowerShell and Go. Ruby test files are never enumerated, so an RSpec or minitest test with no assertion, or one that can only pass, goes unreported and the hooks never fire on a Ruby test edit. Add a Ruby adapter for RSpec and minitest.

Assertion forms to recognize:

Ruby assertions often have no call parenthesis (assert_equal a, b, expect(a).to eq b), so a parenthesis-anchored token match misses them, and statements end at a newline, so two assertions on one line need a ;.

Scope

  • plugins/testing/skills/audit/adapters/ruby-rspec.yaml and ruby-minitest.yaml: files: globs (for example *_spec.rb, *_test.rb, test_*.rb; confirm against each framework's conventions), test_start for it/specify/example blocks and def test_*, test_skip (skip, xit, pending), and the assertion, weak, inert (expect(true).to be true, assert true), count, fail (flunk, fail) and mock (receive, have_received, Minitest::Mock#verify) token sets, written for paren-less calls.
  • Block model: Ruby tests are do ... end and def ... end blocks, which neither the brace nor the indent model in cant-fail-scan.awk tracks. Add a keyword block model (openers do, def, class, module, begin, if/unless/while/case at statement start, closer end) or show the existing models suffice.
  • Masker: add mask_rb to plugins/testing/skills/audit/scripts/cant-fail-scan.awk: # comments, =begin/=end block comments, ' and " strings with #{...} interpolation (code inside, with its own quotes), heredocs (<<~TAG, <<-TAG, <<TAG, quoted tags) masked to their terminator line, and percent literals (%w(), %i[], %q{}, %Q<> and other delimiters). Register it in mask_open and route language: ruby to it.
  • Corpus fixtures under plugins/testing/skills/audit/evals/fixtures/corpus/<adapter-id>/{bad,good}/ (stored as .fixture), each listed in corpus_files in cant-fail-scan.test.sh.
  • Regenerate plugins/testing/hooks/hooks.json with plugins/testing/scripts/gen-hook-filters.sh so the hooks' if rows include the new globs.
  • Add Ruby to the language lists in plugins/testing/skills/audit/SKILL.md (description and ecosystems paragraph) and plugins/testing/README.md.
  • Version bump and CHANGELOG entry for testing.

Acceptance criteria

  • An RSpec it ... do ... end block and a minitest def test_* method with no assertion each report rule-zero-assertion.
  • A test with one real assertion in each framework, including a paren-less assert_equal a, b and expect(a).to eq b, reports nothing.
  • Two assertions on one line separated by ; are classified per statement: an inert second statement is reported.
  • An assertion token inside a # comment, a heredoc, a %w() literal or a string reports nothing, while an assertion inside #{...} interpolation is still code.
  • A test's end closes the right block when the body holds nested do ... end and if ... end blocks, shown by a fixture with an assertion only in a nested block.
  • A skipped test (xit, skip) is not reported as zero-assertion.
  • Every new fixture is in corpus_files, and cant-fail-scan.test.sh and check-corpus-grid.sh pass.
  • gen-hook-filters.sh --check passes after regeneration, and gen-hook-filters.test.sh passes.

Dependencies

Land after the in-flight scanner PR for #6211, #6218 and #6040, since all of them edit cant-fail-scan.awk, the corpus list and hooks.json. Run the four language adapters (Kotlin, C++, PHP, Ruby) one at a time for the same reason.

Rough size

Largest of the four: a new masker with heredoc, percent-literal and interpolation state, a keyword block model the engine does not have yet, and token sets for paren-less assertions.

Activity

  1. github-actions commented on Oct 4, 2026

    @github-actions
    Contributor

    Thanks for the detailed writeup. Understood: add a Ruby adapter (RSpec + minitest) to the cannot-fail scanner, including paren-less assertion token sets, a new do...end/def...end keyword block model for cant-fail-scan.awk, a mask_rb masker (comments, heredocs, percent literals, string interpolation), corpus fixtures, hook filter regeneration, and docs/CHANGELOG updates.

    The scope, acceptance criteria, and dependencies (sequencing after #6211, #6218, #6040, and after the other in-flight language adapters #6235 Kotlin, #6236 C++, #6237 PHP since they all touch the same shared files) are already clearly laid out, so nothing appears missing here.

    No duplicates found — #6235, #6236, and #6237 are the related sibling adapter issues this one explicitly sequences after, not overlapping reports.

    Automated triage. A maintainer reviews it.

  2. kyle-sexton commented on Oct 13, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-10-13): approved the recommendation.

    Next: nobody acts now. Pick it up when a repository with Ruby tests appears or an outside user asks.

    This was generated by AI.

  3. added
    needs-human
    on Oct 19, 2026
  4. kyle-sexton commented on Oct 19, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Held for a person: Parked by owner decision (2026-10-13) until a repository the owner works in has Ruby tests or an outside user asks; no such repository exists yet.

  5. kyle-sexton commented on Oct 24, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded. Owner, Backlog HITL session, 2026-10-24. Q99: "Should the six issues parked until demand appears close as not planned, each with a reopen note?" Answer: "yes, go w/ recomended". To reopen: reopen this issue when a repo uses this or a user asks for it; the body and decisions above stay as the spec.

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-human

    Fields

    No fields configured for Feature.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions