Skip to content

Commit b7a8e89

Browse files
authored
feat(openspec): softwarecatalog-legacy-quality-cleanup tracking change (#214)
Drafts the openspec change capturing softwarecatalog's legacy quality-debt cleanup as a tracked initiative. Spec-only, markdown-only. Per the 2026-05-03 OR-abstraction audit, stream 3 (repo hygiene).
1 parent dc51033 commit b7a8e89

2 files changed

Lines changed: 140 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# SoftwareCatalog Legacy Quality Cleanup
2+
3+
## Why
4+
5+
The OR-abstraction audit (2026-05-03, stream 3 + the quality-gates
6+
cleanup at session start) flagged that softwarecatalog's quality
7+
gates have a small amount of legacy debt absorbed via exclude
8+
patterns. Burning these down keeps PR diffs honest — gates catch
9+
real regressions rather than silently absorbing already-broken code.
10+
11+
SoftwareCatalog has 4 phpcs.xml exclude-patterns and no PHPMD or
12+
PHPStan baseline. The bulk of the work here is running PHPMD/PHPStan
13+
as a unified gate for the first time and either fixing surfacing
14+
errors outright or capturing them in a fresh baseline.
15+
16+
This is a tracking change so the burn-down can be picked up later.
17+
It is spec-only; no code changes are proposed in this change.
18+
19+
## What Changes
20+
21+
- Inventory and clear the 4 phpcs.xml exclude-patterns. For each:
22+
add proper docblocks + named-parameter call audits, then drop
23+
the exclude.
24+
- Run PHPMD for the first time as a unified gate (phpmd.xml is
25+
configured but no baseline exists). Capture surfacing violations
26+
as a baseline OR fix outright depending on volume.
27+
- Run PHPStan for the first time as a unified gate. Same trade-off:
28+
baseline vs fix-outright.
29+
- Wire phpcs/phpmd/phpstan into CI as the unified quality gate.
30+
31+
## Problem
32+
33+
Exclude-patterns exist because the audit captured legacy files that
34+
predated the current quality conventions. The 4-pattern count is
35+
near-zero — the work in this change is mostly about hardening the
36+
gate so it doesn't drift back into having larger exclude lists.
37+
38+
PHPMD/PHPStan baselines don't exist yet because the gates haven't
39+
been run as a unified `check:strict` block. The audit recommended
40+
running them and capturing the result before adoption work.
41+
42+
Note: this proposal covers the Conduction-side `softwarecatalog/`
43+
app only. The VNG client repo (`Softwarecatalogus/`) is governed
44+
by its own quality rules and is explicitly out of scope here.
45+
46+
## Proposed Solution
47+
48+
File-by-file cleanup. Because the exclude-pattern count is 4,
49+
Phase 2 is four checkboxes. Phases 3-4 are contingent on what
50+
surfaces when PHPMD / PHPStan run unified.
51+
52+
Estimated effort: 1-2 PRs over 1 sprint.
53+
54+
## Out of scope
55+
56+
- Refactoring beyond what the sniff requires
57+
- New features (separate adoption-spec changes own those)
58+
- The VNG client repo `Softwarecatalogus/` — different governance
59+
- Test additions (separate test-coverage spec change if needed)
60+
61+
## See also
62+
63+
- The canonical audit lives in openregister at
64+
`.claude/audit-2026-05-03/03-repo-hygiene.md`. SoftwareCatalog
65+
references it from there.
66+
- `phpcs.xml` (the legacy-debt baseline section)
67+
- Hydra ADR-022 (apps consume OR abstractions) — quality conventions
68+
- `composer.json` `check:strict` script (the unified gate target)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Tasks: SoftwareCatalog Legacy Quality Cleanup
2+
3+
## Phase 1 — Inventory + planning
4+
5+
- [ ] Run `composer phpcs` and capture current baseline error count
6+
(target: starting from 4 exclude-patterns in phpcs.xml)
7+
- [ ] Run `composer phpmd` for the first time as a unified gate
8+
and capture violation count + categories
9+
- [ ] Run `composer phpstan` for the first time as a unified gate
10+
and capture error count + categories
11+
- [ ] Decide per gate: fix-outright (if <50 violations) or capture
12+
a fresh baseline (if larger)
13+
- [ ] Confirm CI runs `composer check:strict` on every PR before
14+
starting burn-down work
15+
16+
## Phase 2 — PHPCS burn-down (per excluded file)
17+
18+
For each file: fix errors, remove the phpcs.xml `<exclude-pattern>`
19+
entry, verify gate stays green.
20+
21+
- [ ] Excluded file 1 — fix sniffs + drop exclude
22+
- [ ] Excluded file 2 — fix sniffs + drop exclude
23+
- [ ] Excluded file 3 — fix sniffs + drop exclude
24+
- [ ] Excluded file 4 — fix sniffs + drop exclude
25+
- [ ] Once all excludes are gone, drop the legacy-debt block from
26+
phpcs.xml entirely
27+
28+
## Phase 3 — PHPMD burn-down
29+
30+
Contingent on Phase 1's first-run output. If volume is small, this
31+
phase collapses to a single fix-outright PR.
32+
33+
- [ ] If baseline captured: ElseExpression — re-shape `if/else` to
34+
early-return
35+
- [ ] If baseline captured: CyclomaticComplexity / NPathComplexity —
36+
extract methods
37+
- [ ] If baseline captured: MissingImport — add `use` statements
38+
- [ ] If baseline captured: StaticAccess — replace with DI
39+
- [ ] If baseline captured: variable-naming sniffs (Long/Short/
40+
Undefined/UnusedFormalParameter)
41+
- [ ] Once baseline reaches 0 lines: delete phpmd.baseline.xml and
42+
drop `--baseline-file` from composer.json's phpmd script
43+
44+
## Phase 4 — PHPStan burn-down
45+
46+
Contingent on Phase 1's first-run output. If volume is small, this
47+
phase collapses to a single fix-outright PR.
48+
49+
- [ ] Inventory phpstan errors by file/type
50+
- [ ] Common patterns to fix:
51+
- [ ] Missing return-type / param-type declarations
52+
- [ ] Mixed types (specify generic / union)
53+
- [ ] Possibly-null dereferences
54+
- [ ] Once baseline reaches 0 lines (or never created): confirm
55+
gate runs clean against current code
56+
57+
## Phase 5 — CI integration
58+
59+
- [ ] Verify `composer check:strict` runs in CI on every PR
60+
- [ ] Once all baselines are empty:
61+
- [ ] Delete `phpmd.baseline.xml` (if it was created)
62+
- [ ] Delete `phpstan-baseline.neon` (if it was created)
63+
- [ ] Drop the legacy-debt section from `phpcs.xml`
64+
- [ ] Add a smoke-test cron that runs `composer check:strict`
65+
weekly on `development`
66+
67+
## Phase 6 — Documentation
68+
69+
- [ ] Update README quality-gates section
70+
- [ ] Note in `app-config.json` that legacy quality cleanup is done
71+
- [ ] Close the burn-down tracking issue once the last baseline
72+
line is removed

0 commit comments

Comments
 (0)