Skip to content

Commit 04f3033

Browse files
committed
♻️ refactor(import-follow): deduplicate cleanup/audit hygiene option layer
- Extract shared followImportsHygieneOptions struct for common paths, filters, retention profiles, fail-if-matched, and age-gating - Unify flag parsing, retention-profile application, and validation for both cleanup-follow-imports and audit-follow-imports commands - Add audit-side tests for invalid pattern and retention-profile parsing - Rename follow_examples_test.go to follow_import_example_fixtures_test.go
1 parent 9650974 commit 04f3033

7 files changed

Lines changed: 217 additions & 233 deletions

File tree

docs/go/maintainer/development-tracker.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ Immediate next tasks:
151151

152152
### 2026-03-17 Session Update
153153

154-
- Completed: Removed the maintainer-only `--list-examples` / `--refresh-examples` execution path from the production `cleanup-follow-imports` and `audit-follow-imports` commands. Hygiene example catalogs now live only in `internal/app/follow_examples_test.go`, checked-in fixture rewrites happen through env-gated test helpers, and the operator/maintainer docs now describe that test-driven maintenance flow instead of advertising unsupported runtime flags.
154+
- Completed: Deduplicated the shared cleanup/audit hygiene option layer in `internal/app/import_follow.go`. `cleanup-follow-imports` and `audit-follow-imports` now embed one common option struct for shared paths, filters, retention profiles, fail-if-matched, and age-gating; they reuse the same common flag parser, retention-profile application, and pattern/age/target-binding validation while keeping command-specific prune/check flags separate. App tests now also cover audit-side invalid pattern and retention-profile parsing so both command families stay aligned under one helper path.
155+
- In progress: none.
156+
- Blockers: none.
157+
- Next step: pivot from this follow/import parser cleanup back to a new operator-facing capability, unless another small cleanup slice around report/renderer sharing is clearly higher value.
158+
159+
### 2026-03-17 Session Update
160+
161+
- Completed: Removed the maintainer-only `--list-examples` / `--refresh-examples` execution path from the production `cleanup-follow-imports` and `audit-follow-imports` commands. Hygiene example catalogs now live only in `internal/app/follow_import_example_fixtures_test.go`, checked-in fixture rewrites happen through env-gated test helpers, and the operator/maintainer docs now describe that test-driven maintenance flow instead of advertising unsupported runtime flags.
155162
- In progress: none.
156163
- Blockers: none.
157164
- Next step: decide whether the remaining cleanup/audit flag parsing should also move behind a smaller shared helper, or whether the next slice should return to a new operator-facing capability.

docs/go/maintainer/mcp-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ go test ./internal/app -run TestRefreshAuditFollowImportsExampleFixtures
251251
Remove-Item Env:CODEX_MEM_REFRESH_AUDIT_EXAMPLES
252252
```
253253

254-
If you only need a subset while iterating, pass the exact fixture names through the matching environment variable. The canonical names live in [../../../internal/app/follow_examples_test.go](../../../internal/app/follow_examples_test.go):
254+
If you only need a subset while iterating, pass the exact fixture names through the matching environment variable. The canonical names live in [../../../internal/app/follow_import_example_fixtures_test.go](../../../internal/app/follow_import_example_fixtures_test.go):
255255

256256
```powershell
257257
$env:CODEX_MEM_REFRESH_CLEANUP_EXAMPLES = "filtered-cleanup-json"

docs/go/operator/import-ingestion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ go test ./internal/app -run TestRefreshAuditFollowImportsExampleFixtures
297297
Remove-Item Env:CODEX_MEM_REFRESH_AUDIT_EXAMPLES
298298
```
299299

300-
The fixture names live in [follow_examples_test.go](../../../internal/app/follow_examples_test.go), and the ordinary read-only guard remains:
300+
The fixture names live in [follow_import_example_fixtures_test.go](../../../internal/app/follow_import_example_fixtures_test.go), and the ordinary read-only guard remains:
301301

302302
```powershell
303303
go test ./internal/app -run "Test(Audit|Cleanup)FollowImportsExampleOutputsStayInSync"
File renamed without changes.

0 commit comments

Comments
 (0)