Skip to content

feat(testing): add a Kotlin adapter to the cannot-fail scanner (JUnit 5 in Kotlin, kotlin.test, Kotest) #6235

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. Kotlin test files are never enumerated, so a Kotlin test with no assertion, or one that can only pass, goes unreported and the hooks never fire on a Kotlin test edit. Add a Kotlin adapter for JUnit 5 used from Kotlin, kotlin.test, and Kotest.

Assertion forms to recognize:

Kotlin statements end at a newline, and ; between statements is rare, so two assertions on one line usually come through a chained matcher, assertAll, or assertSoftly, not a second ;-terminated statement.

Scope

  • plugins/testing/skills/audit/adapters/kotlin-*.yaml (one per framework, or one with extends: as the C# adapters do): files: globs (for example *Test.kt, *Tests.kt, *Spec.kt; confirm against each framework's conventions), test_start for @Test fun and Kotest spec styles (test("...") {, "name" {, should("...") {), test_skip (@Disabled, Kotest xtest/! prefixes, enabled = false), and the assertion, weak, inert, count, fail and mock token sets (MockK verify { } and every { }).
  • Masker: reuse mask_cs in plugins/testing/skills/audit/scripts/cant-fail-scan.awk (// and /* */ comments, " and ' literals) if it can take Kotlin's """ raw strings and ${...} templates without breaking C#; otherwise add mask_kt beside it, register the lexer in mask_open, and route language: kotlin 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 Kotlin 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

  • A JUnit, a kotlin.test and a Kotest test with no assertion each report rule-zero-assertion.
  • A test with one real assertion in each framework reports nothing.
  • A Kotest chained-matcher line, an assertSoftly { } block and a JUnit assertAll(...) call are each classified per statement: a block holding a real assertion stays quiet, and one holding only inert assertions is flagged.
  • An assertion token inside a """ raw string or a // comment does not count as an assertion.
  • A skipped test (@Disabled, Kotest xtest) 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

Small to medium if mask_cs can be reused with raw-string and template additions; medium if Kotlin needs its own masker. The Kotest spec-style test starts and the chained-matcher classification are the larger parts.

Activity

  1. github-actions commented on Oct 4, 2026

    @github-actions
    Contributor

    Thanks for the detailed writeup. This asks for a Kotlin adapter (JUnit 5-via-Kotlin, kotlin.test, Kotest) for the cannot-fail scanner, covering test-file globs, test start/skip detection, assertion/weak/inert/mock token sets, a masker decision (reuse or extend mask_cs vs. a new mask_kt), new corpus fixtures, hook-filter regeneration, docs updates, and a version/CHANGELOG bump. The scope, acceptance criteria, and dependency ordering (after #6211, #6218, #6040, and run one-at-a-time with the sibling #6236/#6237/#6238 adapters) are already spelled out, so nothing appears missing. I didn't find any existing duplicate of this specific Kotlin adapter request.

    Automated triage. A maintainer reviews it.

  2. added
    good first issue
    on Oct 4, 2026
  3. 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 one of the triggers above appears.

    This was generated by AI.

  4. removed
    good first issue
    on Oct 15, 2026
  5. added
    needs-human
    on Oct 19, 2026
  6. kyle-sexton commented on Oct 19, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Held by the owner decision of 2026-10-13: build the Kotlin adapter only when a repository the owner works in uses Kotlin or an outside user asks for it. Neither has happened yet.

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