| id | 2606211907 |
|---|---|
| title | arch-fix: split internal/engine/runner.go |
| status | ✅ |
| summary | Split runner.go (1 290 lines) into sibling files along its logical groups to restore the 1 000-line guideline and satisfy SRP for the engine package. |
| model | |
| depends-on |
Closes audit entry 2026-06-21.
internal/engine/runner.go
reached 1 290 lines.
Go arch doc §"Common violations to flag" names engine as a place that grows unbounded when it becomes a dumping ground. The audit checklist calls out the 1 000-line threshold explicitly.
The file mixes seven concerns:
- File dispatch (
Run,runFiles,lintFile,filterIgnored, …) - Layer-0 parse-skip gate
(
layer0SkipEnabled,layer0SkipEligible,allEnabledRulesSkipSafe,computeFlatLayer0Active, …) - Config-resolution cache
(
effectiveCache,runResolve,configuredRules,effectiveCached,runCacheForCall, …) - Source-mode lint path (
RunSource,runSource,parseForSource,populateFileFields, …) - Front-matter parsing
(
parseFrontMatterKinds,parseFrontMatter, …) - Config-target rules
(
runConfigTargetRules,runConfigRule,anyRepoScopedEnabled) - Logging and sorting (
log,logRules,ruleCategoryLookup,sortDiagnostics)
Split runner.go into sibling files within
the same package. Each sibling answers one
question. The primary file stays under
1 000 lines.
- Create
internal/engine/runner_layer0.go: move Layer-0 gate functions andcomputeFlatLayer0Active. - Create
internal/engine/runner_cache.go: move cache types and their methods. - Create
internal/engine/runner_log.go: move logging helpers andsortDiagnostics. - Remove the moved blocks from
runner.goand trim now-unused imports. - Run
go build ./...— confirm no errors. - Run
go test ./...— confirm no regressions. - Confirm
wc -l runner.gois under 1 000 lines.
-
internal/engine/runner.gois under 1 000 lines. -
go build ./...passes. -
go test ./...passes. -
go tool golangci-lint runreports no new issues. - No logic changed — pure file
reorganisation within the
enginepackage.