| id | 2607051918 |
|---|---|
| title | Export wordlist.Dedup and remove the identical dedupStrings copy in internal/config |
| status | ✅ |
| model | sonnet |
| summary | internal/wordlist.dedup and internal/config/wordlist_files.go's dedupStrings are byte-for-byte identical, and config already imports wordlist. Export one copy and delete the other. Flagged by the 2026-07-05 audit. |
- Remove the duplicated
dedup/dedupStringshelper betweeninternal/wordlistandinternal/config. - Export one copy from
internal/wordlistand delete the other. internal/configalready importsinternal/wordlist.
The 2026-07-05 audit (range: 0ededb3..528ce4c) found two identical helpers:
internal/wordlist/wordlist.go'sdedup(ss []string) []stringinternal/config/wordlist_files.go'sdedupStrings(ss []string) []string
Both bodies are byte-for-byte identical. Each
de-duplicates, keeping first-occurrence order, and
returns nil for empty input. internal/config already
imports internal/wordlist (for wordlist.Lookup/
Resolve). There is no layering reason for the second
copy — it is plain copy-paste.
While in this area, also fold in a second, lower-priority duplicate pair the same audit flagged:
internal/config/wordlist_files.go'sstringsToAny(ss []string) []anyinternal/convention/nollmtells.go'stoAnySlice(ss []string) []any
These have identical bodies too, but no import
relationship exists yet between
internal/convention and
internal/config/internal/wordlist.
Export wordlist.ToAnySlice alongside
wordlist.Dedup and point both call sites at it.
Do this instead of adding a new cross-package
import just for internal/config's copy.
- In
internal/wordlist/wordlist.go, exportdedupasDedupandstringsToAny-equivalent asToAnySlice(addToAnySlicefresh — it does not exist ininternal/wordlistyet). - Update
internal/wordlist's internal callers (Resolve) to useDedup. - Add or update tests in
internal/wordlist/wordlist_test.goforDedupandToAnySlice. - In
internal/config/wordlist_files.go, deletededupStringsandstringsToAny; replace call sites withwordlist.Dedupandwordlist.ToAnySlice. - In
internal/convention/nollmtells.go, deletetoAnySlice; replace call sites withwordlist.ToAnySlice(add theinternal/wordlistimport — confirm this does not create an import cycle;internal/wordlistmust not importinternal/convention). go build ./...passes.go test ./internal/wordlist/... ./internal/config/... ./internal/convention/...passes.
-
internal/wordlistexportsDedupandToAnySlice, each with a dedicated test. -
internal/config/wordlist_files.gohas no privatededupStringsorstringsToAny. -
internal/convention/nollmtells.gohas no privatetoAnySlice. -
go test ./...is green. -
mdsmith check .is green.