Repository navigation
Description
This was generated by AI during a consumer-repo exercise of the skill.
Context
audit-type-debt runs mypy with --explicit-package-bases so that a file vendored into several plugins (sanctioned replication) is named by its path and measured once per copy. mypy's module walk (find_sources.py, crawl_up, read at 1.19.1) stops at the first directory whose name is not a Python identifier, so two same-named files under two hyphenated directories (my-pkg/mod.py and other-pkg/mod.py) still both derive the bare name mod and collide. mypy exits 2 with Duplicate module named "mod", and the collector turns that into the adapter contract's exit 4: the Python run row reads unavailable with mypy's message, no percentage is reported, and the run continues. The Gotchas in the skill body say so.
That is honest, but it measures nothing for the whole lane because of two files. This repository does not hit the case today (its replicated files sit under identifier-named lib/ and hooks/ directories inside hyphenated plugin directories, which mypy names by their path), so the cost is borne by consumers whose layout puts same-named modules directly under hyphenated directories, for example a monorepo of service-a/main.py, service-b/main.py.
Options the interview surfaced, none chosen yet:
- Detect the collision before running mypy (derive each scope file's mypy name with the collector's own
module_name, which already re-derivescrawl_up), then run mypy once per collision-free partition and sum the file rows. Per-file rows exist since 0.3.0, so attribution is by file, not by module name. - Run mypy once per colliding group with the group's parent as
MYPYPATHor with--explicit-package-basesplus a synthetic base, so each copy is named by a distinct path. Needs verification that mypy accepts a non-identifier base component in that mode. - Report the collision as a partial: measure the non-colliding files, list the colliding ones in the run row's reason, and label the lane row
partial. Cheapest, and still never a false percentage.
Proposed work
- Decide between the three options above (a
/planning:interviewround; the third is the recommended floor because it keeps the never-a-false-number rule with the least new machinery). - Implement the chosen option in
scripts/collectors/mypy-report.py, keeping the exit-4unavailablepath for any other mypy fatal error. - Add a fixture that reproduces the collision with the real mypy (two hyphenated directories, one same-named module each) and a test for the chosen behaviour.
- Update the
audit-type-debtGotchas so the hyphenated-directory bullet states the new behaviour instead of the collision.
Acceptance criteria
- A scope containing
a-dir/mod.pyandb-dir/mod.pyproduces a Python lane row withexpressions_total > 0rather than anunavailablerow. - Every file the run measured has its own file row; any file the run could not measure is named in the run row's reason and the lane row is labelled
partial. - Any other mypy exit 2 (a usage or config error) still reaches the exit-4
unavailablerow with mypy's message. - The fixture is a real mypy capture and the test runs against it;
scripts/affected-tests.sh --runselects and passes the suite. - The skill body's Gotchas describe the shipped behaviour and carry no reference to the earlier collision.
References
plugins/code-metrics/scripts/collectors/mypy-report.py(module_name,_crawl_dir, theFATAL_EXITbranch, the namespace-packages rerun)plugins/code-metrics/scripts/collectors/test_mypy_report.pyplugins/code-metrics/skills/audit-type-debt/SKILL.md(Gotchas, the--explicit-package-basesbullet)- mypy
mypy/find_sources.pycrawl_up/_crawl_up_helperat v1.19.1 (the identifier check that stops the walk) - feat(code-metrics): measure type debt per file and stop reporting an aborted mypy run as 100% typed #4064 (shipped the exit-4
unavailablebehaviour and per-file rows), code-metrics: exercise every skill through the Skill tool in a consumer repo before trusting the 0.1.0 surfaces #3848 (consumer-repo exercise pass)
Metadata
| Field | Value |
|---|---|
| Category | enhancement |
| Area | code-metrics / audit-type-debt / mypy-report collector |
| Ecosystem | python |
Activity
kyle-sexton commentedon Sep 23, 2026
This was generated by AI during triage.
Decision defaulted: option 3 (report partial, list colliding files, keep never-a-false-number rule; issue's own "recommended floor") — veto before merge
kyle-sexton commentedon Sep 23, 2026
This was generated by AI during triage.
Agent Brief
Type: Bug
Summary: Report a partial result instead of an unavailable lane when two same-named Python modules under different hyphenated directories collide during type-debt measurement.
Current behavior:
The type-debt audit's Python lane runs mypy with a package-bases mode so a file vendored into multiple plugins (sanctioned replication) is named by its path and measured once per copy. mypy's own module-naming walk stops at the first directory whose name is not a valid identifier, so two files sharing a base name under two different hyphenated directories still resolve to the same bare module name and collide. When that happens, mypy exits with a duplicate-module error, and the whole Python lane's row is reported as unavailable with mypy's message: no coverage percentage and no file rows for anything measured in that run, even files that never collided.
Desired behavior:
Defaulted decision: report a partial result (recommended as the cheapest option that keeps the never-report-a-false-number rule with no new machinery). Maintainer-vetoable alternative: detect the collision before running the tool and measure each collision-free group in a separate run, or run the tool once per colliding group with a synthetic path-based base so each copy resolves to a distinct name.
When a name collision is detected, the Python lane reports every non-colliding file's own measured row, names the colliding files in the run row's reason, and labels the lane row
partialrather thanunavailable. A coverage percentage is never fabricated for a colliding file; only files the tool could actually measure get one. Any other tool fatal error unrelated to a name collision (a usage or configuration error) still produces the existingunavailablelane row with the tool's message, unchanged.Key interfaces:
unavailablemapping — extended with apartialoutcome for the collision case specifically, not a replacement of the existing pathpartiallabel and its reason field, which must name every file the run could not measureAcceptance criteria:
partial.Out of scope:
fix(code-metrics): partial type-debt run on hyphenated same-named mod…
fix(code-metrics): label the mypy lane-total row partial when files a…
kyle-sexton commentedon Sep 29, 2026
From the 2026-09-29 audit of the Cursor run. This issue stays closed; recording a gap in what closed it.
AC3 asked for the lane row to be labelled
partial. PR #4765 marked only the run row partial (dispatch.sh:686-687) and left the lane-total row unlabeled.Fix: #5308 adds the
partiallabel to the lane-total row whenheld_outis non-empty (mypy-report.py,report-schema.md, audit-type-debtSKILL.md, tests). With that, all five ACs are met on the branch. #5308 usesRefs #4123because the issue is already closed.fix(code-metrics): partial-label the type-debt lane row and dedupe th…