fix(skills): correct the diagnostics scripts and rebuild the baseline
Three defects made every archie-diagnostics-and-tooling measurement wrong:
- source-metrics.go and config-use-candidates.go walked .worktrees/, the
live git worktrees nested inside the repo root. Each is a near-complete
copy of the module, so counts were multiplied by the number of checkout
worktrees: production_go_files read 1234 against 422 tracked, and 248 of
421 PACKAGE/HOTSPOT rows were duplicates. Selector counts were inflated
~3x, which hid Repo.TestGlob behind a real candidate and buried the rest.
- delivery-snapshot.sh scanned .gitea/workflows, deleted in e539048. Under
`set -eu` that aborted the run at rc=2 after 10 of 26 rows, silently
dropping every HYGIENE and MODULE row.
- Its composition-root anchors pointed at cmd/archied/main.go, now a ~30
line dispatcher, so all five rows reported a misleading 0. Repointed at
internal/app/archied, where the wiring actually lives.
Both filesystem walkers now skip .worktrees (package-shape.sh reads
`go list` and was already immune), the CI scan covers the surviving GitHub
workflow including docker/build-push-action, and the MODULE find prunes
.worktrees.
Refresh SKILL.md to HEAD 0b3dc6c: the dated snapshot, the delivery and
coverage claims, and notes on why only one candidate status is a signal
and why a composition-root zero is evidence about the anchor.
source-metrics.go now reconciles exactly with git ls-files: 408 + 9
production and 397 test files, plus the tools module's 5 / 2 / 0, against
422 non-test and 398 test tracked files.
This commit is contained in:
1 parent
0b3dc6c01f
commit
6abc1ba6e5
4 files changed
+82
-29
No files matched your search
@@ -8,7 +8,8 @@ description: "Measure Archie codebase maintainability, Go package dependency sha
|
||||
Collect evidence before judging quality. Keep collection read-only, save raw
|
||||
output, state what each metric cannot prove.
|
||||
|
||||
Volatile facts and numeric snapshots below were verified on **2026-07-28**.
|
||||
Volatile facts and numeric snapshots below were verified on **2026-09-16**
|
||||
(HEAD `d565fb8`).
|
||||
|
||||
Route to `archie-codebase-discovery` for semantic traces,
|
||||
`archie-config-and-flags` for config enumeration,
|
||||
@@ -60,6 +61,14 @@ go run "$skill/scripts/config-use-candidates.go" -root . >"$evidence_dir/config.
|
||||
"$skill/scripts/delivery-snapshot.sh" >"$evidence_dir/delivery.tsv"
|
||||
```
|
||||
|
||||
Both filesystem-walking scripts (`source-metrics.go`,
|
||||
`config-use-candidates.go`) skip `.worktrees/`, which holds live git worktrees
|
||||
nested inside the repo root. Each is a near-complete copy of the module, so
|
||||
walking them multiplies every count by the number of checkout worktrees. If a
|
||||
new nested-checkout convention appears, extend `excludedDirectory` in both;
|
||||
`.git/info/exclude` does not help, because the scripts walk the filesystem
|
||||
rather than `git ls-files`. `package-shape.sh` reads `go list`, so it is immune.
|
||||
|
||||
## Use the bundled reports
|
||||
|
||||
### Measure source shape
|
||||
@@ -116,6 +125,15 @@ finds named fields with `toml`/`yaml`/`json` tags in `internal/config`, then
|
||||
counts selectors with the same **spelling**. It is deliberately fast and not
|
||||
type-aware.
|
||||
|
||||
Only `candidate-no-selector-outside-config` is a signal.
|
||||
`candidate-no-entrypoint-selector` fires for ~180 of 196 rows because the
|
||||
script looks for selectors only in `cmd/`, and most fields are read from the
|
||||
composition root under `internal/app/archied`. Even the signal row has false
|
||||
positives: a field consumed by **spelling** rather than by a Go selector
|
||||
(`LegacyEnabled` via the reload allowlist map, `ReloadStatus.*` via JSON
|
||||
marshalling) reports zero. Confirm each candidate by hand before calling a
|
||||
field dead.
|
||||
|
||||
For every candidate: run `gopls references -d` on the exact field identifier;
|
||||
trace decode → default → validation → normalization/copy → composition-root read
|
||||
→ concrete component → observable behavior.
|
||||
@@ -128,8 +146,14 @@ trace decode → default → validation → normalization/copy → composition-r
|
||||
|
||||
Read: `SURFACE axis scope literal_count` as literal text evidence;
|
||||
`HYGIENE metric count` as tracked-path candidates; `MODULE path` as discovered
|
||||
Go module boundaries. The snapshot compares Task, GitHub docs CI, Gitea deploy
|
||||
CI, and selected composition-root anchors.
|
||||
Go module boundaries. The snapshot compares Task, GitHub CI, and
|
||||
composition-root anchors under `internal/app/archied`.
|
||||
|
||||
Composition-root anchors must name the file that actually does the wiring.
|
||||
`cmd/archied/main.go` is a thin dispatcher that routes to
|
||||
`internal/app/archied`; anchoring on it yields a silent `0` for every row,
|
||||
which reads as "no composition root" rather than "wrong file". A zero here is
|
||||
evidence about the anchor, not about production.
|
||||
|
||||
Inspect hygiene candidates directly:
|
||||
|
||||
@@ -149,7 +173,7 @@ golangci-lint run --enable-only=dupl ./internal/...
|
||||
staticcheck -checks=U1000 ./internal/...
|
||||
```
|
||||
|
||||
On 2026-07-28, the focused `dupl` command reported zero issues. Two code paths
|
||||
On 2026-09-16, the focused `dupl` command reported zero issues. Two code paths
|
||||
can implement the same responsibility with different syntax.
|
||||
|
||||
For every candidate: name the externally visible operation; search all
|
||||
@@ -159,7 +183,7 @@ OS files, and wire names; identify what a new feature supersedes; record
|
||||
production-only, test-only, compatibility, generated, and unreachable paths
|
||||
separately.
|
||||
|
||||
As of 2026-07-28, `Taskfile.yml` defines no `deadcode` task and `go tool` lists
|
||||
As of 2026-09-16, `Taskfile.yml` defines no `deadcode` task and `go tool` lists
|
||||
no dead-code analyzer.
|
||||
|
||||
## Collect test, race, coverage, and runtime evidence
|
||||
@@ -170,7 +194,7 @@ go tool cover -func=/tmp/archie-store.cover
|
||||
go test -race ./internal/store -count=1
|
||||
```
|
||||
|
||||
As of 2026-07-28, the package reported 65.2% statement coverage and passed its
|
||||
As of 2026-09-16, the package reported 78.6% statement coverage and passed its
|
||||
race run.
|
||||
|
||||
```sh
|
||||
@@ -207,23 +231,35 @@ duplication, hid a path, or weakened a gate.
|
||||
|
||||
## Dated current snapshot
|
||||
|
||||
The bundled scripts measured this checkout on 2026-07-28:
|
||||
The bundled scripts measured this checkout on 2026-09-16 (HEAD `d565fb8`).
|
||||
These are post-fix numbers: earlier runs of the same scripts reported roughly
|
||||
3x these file and line counts because they walked `.worktrees/`.
|
||||
|
||||
| Observation | Unstable value |
|
||||
|---|---:|
|
||||
| Root production/test/generated Go files | 123 / 111 / 4 |
|
||||
| Root production/test/generated physical lines | 25,952 / 31,675 / 157 |
|
||||
| `cmd/archied.run` body span / approximate complexity | 668 / 96 |
|
||||
| `internal/config.finalize` body span / approximate complexity | 177 / 64 |
|
||||
| Root internal packages / direct internal edges | 51 / 129 |
|
||||
| Tagged config field rows | 110 |
|
||||
| Tracked paths / tracked `node_modules` paths / tracked symlinks | 558 / 237 / 238 |
|
||||
| `.dockerignore` present | 0 |
|
||||
| Root production/test/generated Go files | 408 / 397 / 9 |
|
||||
| Root production/test/generated physical lines | 73,729 / 93,572 / 12,237 |
|
||||
| `internal/app/archied.Run` body span / approximate complexity | 97 / 19 |
|
||||
| Root internal packages / direct internal edges | 110 / 306 |
|
||||
| Tagged config field rows | 196 |
|
||||
| Tracked paths / tracked `node_modules` paths / tracked symlinks | 1,081 / 0 / 1 |
|
||||
| `.dockerignore` present | 1 |
|
||||
|
||||
The delivery snapshot found no Taskfile literals for race, the `tools` module,
|
||||
or docs; no Go-gate literals in either workflow; docs build in GitHub CI;
|
||||
container build/push in Gitea CI.
|
||||
`source-metrics.go` and `git ls-files` reconcile exactly here: 408 + 9
|
||||
generated production files and 397 test files, plus the `tools` module's
|
||||
5 / 2 / 0, against 422 non-test and 398 test tracked files. The single extra
|
||||
file is an untracked probe under `.local/`.
|
||||
|
||||
The scripts count themselves: the skill's own Go files contribute 816 of those
|
||||
production lines. Editing a bundled script therefore moves
|
||||
`production_physical_lines` on its own, so re-baseline after any script change
|
||||
rather than reading the delta as a change in the product code.
|
||||
|
||||
The delivery snapshot found no Taskfile literals for race or docs, but four
|
||||
for the `tools` module; GitHub `go gate` 4 and container publish 3; and
|
||||
non-zero literals for all five composition-root anchors under
|
||||
`internal/app/archied`.
|
||||
|
||||
The focused test
|
||||
`go test ./internal/skillscript -run '^TestRunWrapsExternalCommand$' -count=1 -v`
|
||||
failed on 2026-07-28 with `Run() = "\n"`.
|
||||
failed on 2026-07-28 with `Run() = "\n"` and **passes** as of 2026-09-16.
|
||||
@@ -264,9 +264,14 @@ func countSelectors(root string, fset *token.FileSet, references map[string]*ref
|
||||
})
|
||||
}
|
||||
|
||||
// excludedDirectory reports whether a walked directory is outside the module.
|
||||
//
|
||||
// ".worktrees" holds live git worktrees of this same repository, nested inside
|
||||
// the root. countSelectors walks the whole root, so without this every selector
|
||||
// count is multiplied by the number of checkout worktrees.
|
||||
func excludedDirectory(_, name string) bool {
|
||||
switch name {
|
||||
case ".git", ".claude", ".references", "node_modules", "vendor", ".gotmp":
|
||||
case ".git", ".claude", ".references", "node_modules", "vendor", ".gotmp", ".worktrees":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -54,15 +54,21 @@ scan_literal task_race taskfile 'go test[^#\n]*-race|-race[^#\n]*go test' Taskfi
|
||||
scan_literal task_tools_module taskfile 'go -C tools|cd tools|task:[[:space:]]+tools' Taskfile.yml
|
||||
scan_literal task_docs taskfile 'docsgen|docs:generate|docs:check' Taskfile.yml
|
||||
|
||||
# One CI surface: .github/workflows. The Gitea workflow was dropped in e539048
|
||||
# ("ci: build and push images to GHCR, drop the Gitea workflow"), so scanning
|
||||
# .gitea/workflows aborted the whole snapshot under `set -eu`.
|
||||
scan_literal github_go_gate github-workflows 'go test|go vet|go build|golangci-lint|task[[:space:]]+check' .github/workflows
|
||||
scan_literal gitea_go_gate gitea-workflows 'go test|go vet|go build|golangci-lint|task[[:space:]]+check' .gitea/workflows
|
||||
scan_literal gitea_container_publish gitea-workflows 'docker build|docker push' .gitea/workflows
|
||||
scan_literal github_container_publish github-workflows 'docker build|docker push|docker/build-push-action|docker login' .github/workflows
|
||||
|
||||
scan_literal production_load_overlay composition-root 'config\.LoadOverlay\(' cmd/archied/main.go
|
||||
scan_literal production_load_dir composition-root 'config\.LoadDir\(' cmd/archied/main.go
|
||||
scan_literal production_sqlite_store composition-root 'store\.Open\(' cmd/archied/main.go
|
||||
scan_literal production_daemon composition-root '&daemon\.Daemon\{' cmd/archied/main.go
|
||||
scan_literal production_rpc_servers composition-root 'registerTaskRPCServers\(' cmd/archied/main.go
|
||||
# Composition root. cmd/archied/main.go is now a ~30-line dispatcher that only
|
||||
# routes to internal/app/archied, so anchoring on it reported a silent zero for
|
||||
# every row below -- which reads as "no composition root" rather than "wrong
|
||||
# file". The wiring lives in internal/app/archied.
|
||||
scan_literal production_config_resolve composition-root 'configuration\.New\(' internal/app/archied
|
||||
scan_literal production_config_overlay composition-root 'ApplyOverlayValues\(|loadConfig\(' internal/app/archied
|
||||
scan_literal production_sqlite_store composition-root 'openProductionTaskStore\(|openStateStore\(' internal/app/archied
|
||||
scan_literal production_daemon composition-root '&daemon\.Daemon\{' internal/app/archied
|
||||
scan_literal production_rpc_servers composition-root 'registerTaskRPCServers\(' internal/app/archied
|
||||
|
||||
git ls-files >"$temporary/tracked"
|
||||
tracked_total=$(wc -l <"$temporary/tracked" | sed 's/[[:space:]]//g')
|
||||
@@ -81,7 +87,7 @@ else
|
||||
fi
|
||||
|
||||
find . \
|
||||
\( -path './.git' -o -path './.claude' -o -path './.references' -o -name node_modules \) -prune -o \
|
||||
\( -path './.git' -o -path './.claude' -o -path './.references' -o -name node_modules -o -name .worktrees \) -prune -o \
|
||||
-name go.mod -print |
|
||||
LC_ALL=C sort |
|
||||
while IFS= read -r module; do
|
||||
|
||||
@@ -247,9 +247,15 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// excludedDirectory reports whether a walked directory is outside the module.
|
||||
//
|
||||
// ".worktrees" holds live git worktrees of this same repository, nested inside
|
||||
// the root. Each is a near-complete copy of the module, so walking them
|
||||
// multiplies every count by the number of checkout worktrees and floods the
|
||||
// HOTSPOT and PACKAGE rows with duplicates of the same declarations.
|
||||
func excludedDirectory(_, name string) bool {
|
||||
switch name {
|
||||
case ".git", ".claude", ".references", "node_modules", "vendor", ".gotmp":
|
||||
case ".git", ".claude", ".references", "node_modules", "vendor", ".gotmp", ".worktrees":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user