Commit c4b2b7e
* feat(ci): dead-code detection gate — knip + no-unused-vars + vulture (#282)
Closes the unused-symbol detection asymmetry (cairn MVG gate #6): Python
already fails on unused imports (ruff F401) but unused TS symbols passed
silently in cdk/. Adds three detection layers plus advisory CI wiring.
- TS lint-level: @typescript-eslint/no-unused-vars (error) in cdk+cli
flat configs with ^_ ignore patterns; cdk tsconfig flips
noUnusedLocals/noUnusedParameters to true (parity with cli).
- TS project-graph: knip v6 with per-workspace knip.json (cdk/cli/docs)
+ a count-only ratchet (scripts/check-deadcode-ratchet.mjs,
knip-baseline.json) that fails only when the count rises — the cairn
"dead-code count should not increase" metric.
- Python module-level: vulture 2.16 (config in pyproject [tool.vulture],
min-confidence 80) with a minimal reviewed .vulture_allowlist.py for
the SDK-mandated hook_context params.
- CI: advisory dead-code job in security-pr.yml (continue-on-error,
emits ::notice::/::warning:: annotations; not blocking yet).
Resolves the three known live instances: drops the dead DEFAULT_MAX_TURNS
import, removes the orphaned cdk/src/bootstrap/index.ts barrel (consumers
import the submodules directly), and removes the unused LINEAR_SECRET_PREFIX
export. Also clears the unused symbols the new rule surfaces across cdk/cli.
The eslint half is blocking via the existing build check; knip+vulture
stay advisory until the knip baseline is driven to zero (deferred AC).
* fix(agent): exclude vulture allowlist from ty typecheck (#282)
The ty typecheck step scanned .vulture_allowlist.py and failed with
unresolved-reference on the bare hook_context names (the allowlist is
bare-name expressions by design, not type-checkable Python). Same
conflict already handled for ruff via extend-exclude; add the matching
[tool.ty.src] exclude so `mise run build` passes.
* chore(ci): ratchet dead-code baseline 79 → 78 after main merge (#282)
Merging main (#505 CLI dedupe) removed a dead symbol, dropping knip's
count to 78. Lock in the gain so the ratchet holds at the lower number.
* fix(cdk): restore exhaustiveness guard + correct knip ratchet keys (#282)
Addresses PR review (ayushtr-aws):
1. validation.ts: the `void (true as _AssertAttachmentExhaustive)` form
silently defeated the AttachmentType exhaustiveness guard — a type
assertion never errors, whereas the original ASSIGNMENT to a `never`
type is the actual compile-time check. Restored the assignment and
consume the binding with `void` so it survives noUnusedLocals and
no-unused-vars without weakening the guard. Verified: tsc errors when
a member is missing from ATTACHMENT_TYPE_LIST, compiles clean when
exhaustive.
2. check-deadcode-ratchet.mjs: COUNTED_KEYS used non-existent knip 6.x
keys (classMembers, nsExports, nsTypes) and counted unused files from
a non-existent top-level report.files. Switched to the real keys
(namespaceMembers, catalog) and count files from issues[].files[] so
unused files actually move the ratchet. Count unchanged at 78.
* chore(ci): harden dead-code ratchet + comment accuracy (#282 review nits)
Non-blocking follow-ups from krokoko's review:
- Pin knip exactly (6.20.0, drop caret) and make the ratchet fail loud
instead of open: if a future knip reshapes its JSON so `issues` is not
an array, countIssues now exits 2 rather than silently counting 0 and
reporting a passing build (which would disable the gate). Needed before
the gate flips to blocking.
- COUNTED_KEYS comment: note the list is complete for the pinned knip and
that nsExports/nsTypes/classMembers are not part of its schema.
- validation.ts: attribute the `void` to tsconfig noUnusedLocals
specifically (no-unused-vars already exempts the ^_ binding).
* refactor(ci): move dead-code job to its own workflow + use uv run for vulture
Address PR #520 review feedback:
- Extract dead-code detection into dead-code-pr.yml (separate concern from security gate)
- Use `uv run vulture` instead of `uvx vulture` for consistency with project conventions
---------
Co-authored-by: bgagent <bgagent@noreply.github.com>
Co-authored-by: Alain Krok <alkrok@amazon.com>
1 parent 37a5c88 commit c4b2b7e
25 files changed
Lines changed: 718 additions & 55 deletions
File tree
- .github/workflows
- agent
- cdk
- src
- bootstrap
- handlers
- test/handlers
- cli
- src
- test/commands
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
| |||
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| 84 | + | |
76 | 85 | | |
77 | 86 | | |
78 | 87 | | |
79 | 88 | | |
80 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
81 | 94 | | |
82 | 95 | | |
83 | 96 | | |
| |||
124 | 137 | | |
125 | 138 | | |
126 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
159 | 172 | | |
160 | 173 | | |
161 | 174 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | | - | |
| 299 | + | |
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| |||
530 | 530 | | |
531 | 531 | | |
532 | 532 | | |
533 | | - | |
| 533 | + | |
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
526 | 525 | | |
527 | 526 | | |
528 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
| |||
0 commit comments