Repository navigation
fix(audit-script): catch dynamic import() / require() / .d.ts FP classes (#6872 part 2) - #7330
Merged
Merged
Conversation
…ses (#6872 part 2) Real audit count post-#7244 was 105 (not the masked-0 from the closure proof on #7128 — see #7244 for the postmortem). Sampling the 105 surfaced two more FP classes: 1. **Dynamic ES-module imports** in TS/Vue routers: `() => import('@/views/CustomDashboard.vue')`. The audit's regex required a literal space after `import`, missing the `(` form. `CustomDashboard.vue` was flagged with 0 callers despite being wired in `router/index.ts:554`. 2. **TypeScript ambient declaration files** (`.d.ts`). These are wired via `tsconfig.json` `include` paths, never via `import` — so 0-caller reports are by design, not unwired. Fixes: - Widen `grep_count_production_callers` regex to also match: - `import('…/X')` — JS/TS dynamic ES-module - `require('./X')` — CommonJS / Vite - `importlib.import_module("X")` / `importlib.<other>("X")` — Python dynamic - `__import__("X")` — Python dynamic - New `is_ambient_type_declaration(path)` helper skips `*.d.ts` files in `scan()`. Tests: +4 cases for `is_ambient_type_declaration`, +9 parametrized cases for the regex (each new shape has positive + negative coverage). 76/76 audit-script tests pass. Real audit count drop: pre-#7244 : ???? (silently masked by worktree-skip bug) post-#7244 : 165 → was real but had 60+ FPs from worktree paths post-rebase : 105 (post-#7128b on the latest Dev_new_gui) this PR adds : -13 dynamic-import FPs + ~7 .d.ts FPs current count : 85 Refs #6872 (parent), #7109 (lazy-import gap explicitly noted in body), #7244 (companion FP fix that exposed the real count).
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Real audit count post-#7244 was 105 (not the masked-0 from the closure proof on #7128 — see #7244 for the postmortem). Sampling those 105 surfaced two more FP classes:
Dynamic ES-module imports in TS/Vue routers: `() => import('@/views/CustomDashboard.vue')`. The audit's regex required a literal space after `import` — missing the `(` form. `CustomDashboard.vue` was flagged with 0 callers despite being wired in `router/index.ts:554`.
TypeScript ambient declaration files (`.d.ts`). These are wired via `tsconfig.json` `include` paths, never via `import` — 0-caller reports are by design.
Fixes
`grep_count_production_callers` regex widened to also match:
New `is_ambient_type_declaration(path)` helper
Skips `*.d.ts` files in `scan()` — same pattern as #7128b's `is_entry_point_script`.
Test deltas
Audit count drop
The remaining 85 are increasingly likely to be genuine wire-in candidates rather than FPs. Bulk-filing per #6872's original intent is now closer to safe.
Acceptance criteria
Refs #6872 (parent), #7109 (the gap was explicitly listed in this issue's body), #7244 (companion fix that exposed the real count)
🤖 Generated with Claude Code