Initial commit: pygenium as git submodule
This commit is contained in:
42
tasks/11-check-defensive-guards.md
Normal file
42
tasks/11-check-defensive-guards.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# 11. Redundant defensive guarding check
|
||||
|
||||
meta:
|
||||
id: pygienium-11
|
||||
feature: pygienium
|
||||
priority: P2
|
||||
depends_on: [pygienium-06]
|
||||
tags: [check]
|
||||
|
||||
objective:
|
||||
|
||||
- Implement the redundant-defensive-guarding check: remove excessive null checks, unnecessary try/catch, fallback paths that mask bugs, defensive code guarding invariants the type system already guarantees.
|
||||
|
||||
deliverables:
|
||||
|
||||
- `src/checks/defensive-guards.ts`: `CheckDefinition` with scan + fix tasks
|
||||
- Rubric: redundant null/undefined checks where types are non-nullable, try/catch that only rethrows or swallows, fallback values that hide errors, defensive guards on already-validated input, compatibility fallbacks (engineering rule: remove, don't layer)
|
||||
- `/pygienium-defensive-guards` runs E2E
|
||||
|
||||
steps:
|
||||
|
||||
- Author `buildScanTask`: agent identifies defensive smells, writes `pygienium/checks/defensive-guards/findings.md`
|
||||
- Author `buildFixTask`: remove redundant guards; preserve guards that protect real external boundaries (user input, IO, parsing); write changes.md distinguishing removed vs kept-with-reason
|
||||
- Register the check
|
||||
|
||||
tests:
|
||||
|
||||
- Integration: temp file with a null check on a typed-non-null param + a try/catch that swallows; run `--fix`; assert removed; assert a JSON.parse guard is preserved
|
||||
|
||||
acceptance_criteria:
|
||||
|
||||
- findings.md separates redundant guards from legitimate boundary guards
|
||||
- `--fix` removes redundant guards and keeps boundary guards (IO, parsing, untrusted input)
|
||||
|
||||
validation:
|
||||
|
||||
- Inspect `pygienium/checks/defensive-guards/{findings.md,changes.md}`
|
||||
|
||||
notes:
|
||||
|
||||
- Key judgment: guarding external boundaries (IO, untrusted input, parsing) is correct; guarding internal invariants the type system guarantees is noise
|
||||
- Engineering rule: no compatibility layers or fallbacks meant to be replaced later
|
||||
Reference in New Issue
Block a user