Skip to content

code-metrics: audit-size measures a third of the tree in 35 seconds, and the report hides how to widen it #4062

Closed

Description

@kyle-sexton

Summary

A post-use audit of /code-metrics:audit-size (plugin 0.1.8) on this repository, interviewed and locked in a Brief that is pasted into the fixing pull request's body, found one performance defect, one coverage gap, and a handful of report and positioning issues. All are in the plugin; none need a schema change.

Findings

  1. The dispatcher spends 34 of 35 seconds not measuring. A whole-tree audit-size.sh --all on this repo (3,854 files) takes 35.6s wall. The bundled line counter accounts for 0.1s. The rest is per-file bash scaffolding shared by every audit skill: the binary sniff in scripts/dispatch.sh runs two head | wc | tr pipelines per file (21.8s), and scripts/detect-lanes.sh spawns a tr subshell per file to lowercase the extension (12.0s). A Python pass over the same list sniffs every file in 0.06s.
  2. Two thirds of the tree is invisible to audit-size. 2,547 of 3,854 files belong to no lane (1,507 markdown, 769 JSON, 113 PowerShell, 39 YAML, 13 SVG) and are counted in scope.files but never measured. Lines per file has no language dependency; both scc and the bundled counter count any text file.
  3. An empty change scope is a dead end. A branch with no diff prints "Measured nothing" with no hint that explicit paths or --all widen the scope; the hint lives only in the skill body.
  4. The description disowns --all. It says "for a repo-wide dashboard this is the wrong tool (it measures a change)" while --all is documented in the README and covered by the test suite.
  5. The Measures table is not ordered by size. Rows sort by over-reference count, then filename, so an --all run here shows the 77 files over 1000 lines and then 123 alphabetical ones under the 200-row cap, and the cap line does not say what it kept.
  6. Functions: 0 appears in every file-lines summary, where no function rows can exist.
  7. The 1000-line provenance sentence differs across three surfaces (the report string in config-defaults.json, the SKILL.md body, and the description). The three agree in substance and drift in wording.

Agreed fix (one PR, 0.1.9)

  • Binary sniff moves to one Python invocation over the scoped file list; lane detection uses ${ext,,}. Target: --all on this repo under 5s.
  • A catch-all other lane served by file_lines only; every other measure reports n/a for it; lanes.other.enabled: false opts out.
  • --all positioned as a first-class scope; change stays the default; the "wrong tool" clause leaves the description.
  • The renderer sorts by the primary measure's value in its threshold direction and the cap line names the key.
  • Empty change scope names the base and says how to widen; Functions: is omitted when no function rows exist; one provenance sentence for size.file_lines, cited in the same words everywhere.

Out of scope, on purpose: the 1000 default and the 500 alternative, iso-8.2.115 mode, installing scc, a Python rewrite of scope resolution, named lanes per text format, and any finding or gate (ADR 0003).

Verification

The acceptance criteria and their results are in the Brief pasted into the fixing pull request's body. The existing suites (audit-size.test.sh, dispatch.test.sh, detect-lanes.test.sh, the collector Python tests) stay green and gain cases for the new behaviour.

Activity

  1. added
    needs-triage
    on Sep 11, 2026
  2. added a commit that references this issue on Sep 11, 2026
    09b8edd
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