Skip to content

audit-dead-code: account for every source file; a report is clean only when none is uncovered #4521

Description

@kyle-sexton

Summary

code-tidying:audit-dead-code 0.23.2 can report a clean result when some source files were covered
by no lane. A run over melodic-software/.github (3 .sh files, 2 standalone .mjs files, no
package.json) ended with Summary total: files=0 T1=0 T2=0 T3=0 and the Note "no candidates from
the lanes that ran". The playbooks:repo-sweep consumer recorded that as "no findings". The two
.mjs files appear on no output line, not even as a count. That breaks SKILL.md:70-71 (Lane lines
make a clean report "a claim rather than an absence") and SKILL.md:86 (a scan of nothing is labeled
as one).

Goal: every tracked source file is accounted for on every run, either covered by a lane that ran or
listed as uncovered with the reason. A report reads clean only when nothing is uncovered.

scan: is scripts/dead-code-scan.sh, lib: is scripts/lib/dead-code-shapes.sh.

Fix

  • Files routed to a skipped lane are not counted. lib:64 classifies .js/.mjs/.cjs as
    ts, and scan:222 queues them for knip. With no package.json root, scan:351-354 emits
    state=skipped with a hard-coded files=0. The gopls lane does the same at scan:513-515. Files
    in the other class are dropped without a count (lib:69, scan:226). The grep lane's skip path
    already reports its real input count (scan:616). Report real input counts on every lane line.
  • The "scan of nothing" Note depends only on whether any lane ran (scan:778-783,
    lanes_ran == 0). One lane running on 3 .sh files hid the 2 uncovered .mjs files, while
    --lane knip .github/scripts over the same files printed "a scan of nothing". Choose the Note
    from the uncovered count too.
  • Add Summary coverage: covered=N uncovered=M and a Note: listing each uncovered source file
    with its reason: no lane for the language, no manifest root, or tool not installed.
  • files= means files scanned on Lane lines and files with findings on Summary total:
    (scan:751). Rename the summary key to files-with-findings=.
  • SKILL.md:82 defines skipped as a binary problem, but the no-manifest paths (scan:353,
    scan:514) also use it. Either widen the definition or add a distinct state.
  • Test: add a dead-code-scan.test.sh case with .sh + .mjs and no package.json. Every
    existing knip fixture ships a package.json. Add a second case with a package.json root plus a
    standalone .mjs outside it. That case was read from scan:272-312 and scan:356-366, not
    reproduced.

Verification

  • The scan re-ran read-only on the same worktree and printed byte-identical output.
  • Two separate readers checked every citation above against the 0.23.2 source, and all matched.
  • Done when the no-package.json fixture reports uncovered=2, lists both files, and does not
    print the clean-result Note.

Related

Activity

  1. added
    needs-triage
    on Sep 26, 2026
  2. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    This comes from the 2026-09-29 audit of the Cursor agent run.

    The follow-up that PR #5072 disclosed is delivered in PR #5327 (draft, not yet merged; Closes #4521). A degraded lane's files are now listed uncovered with the reason lane degraded, and the clean-result note cannot print while any lane degraded or uncovered is above zero. The fixture "degraded-mixed" has a degraded knip root beside a grep lane that ran: it prints Summary coverage: covered=1 uncovered=1, Note: uncovered ts-orphan.ts — lane degraded, and no Note: no candidates from the lanes that ran. This issue is already closed; no reopen needed.

  3. added a commit that references this issue on Sep 29, 2026
    37e91ea
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-triage

    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