| id | 155 |
|---|---|
| title | arch-fix: relocate convention types out of markdownflavor |
| status | ✅ |
| summary | Hoist Convention, RulePreset and ParseFlavor out of the markdownflavor rule into a layer internal/config can own, so config stops importing a rule package. |
| model | sonnet |
| depends-on |
Reverse the dependency inversion. Today
internal/config (a mid-layer) imports
internal/rules/markdownflavor (the
lowest layer). Convention and flavor
metadata is a config concept. It lives
inside a rule today and config reaches
down to fetch it.
Closes the second blocker in Audit 2026-05-13.
internal/config/convention.go
imports
internal/rules/markdownflavor to use
Convention, RulePreset,
ParseFlavor, Lookup, and
ConventionNames. The
project layering map
puts rules at the lowest layer. Config
sits between cmd/engine and the
helpers. The current direction is
config → rules/.... That is
inverted.
- Create
internal/convention/and move:
- The
Convention,RulePreset, andFlavorvalue types. ParseFlavor,Lookup,ConventionNames, and the built-in convention registry.
- Re-export from
internal/rules/markdownflavoronly the adapter that translates aconvention.Conventioninto rule behavior. The rule consumes the data; it does not own it. - Update
internal/config/convention.goto importinternal/conventioninstead ofinternal/rules/markdownflavor. - Update any other consumer (search for the import) to import from the new location when the reference is to the data type, not the rule.
- Add a regression test under
internal/config/convention_test.goasserting the package compile-time imports contain nointernal/rules/...paths.
-
internal/convention/exists. Its package comment states it owns convention and flavor data shapes independent of any rule. (SRP) - Search reports no
internal/rules/imports underinternal/config/. (DIP / dependency direction) -
internal/rules/markdownflavorstill compiles. It continues to expose itsrule.Ruleimpl. It consumes the new package for data, not the other way round. - All tests pass:
go test ./.... -
go tool golangci-lint runreports no issues. -
mdsmith check .passes after the refactor. - The audit entry for this blocker moves to a "Resolved by plan/155" section in the audit log.