mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-06-27 13:51:44 +00:00
653d47e03c
## Summary Partial fix for #1670 — **Phase 1 only** (CI completeness gate). Phase 2 (backfilling the 18 currently-undocumented routes into `openapi.go`) is deferred to a separate issue per the triage on #1670 and is explicitly out of scope here. ## What this adds - `cmd/server/openapi_completeness_test.go` — AST-walks every non-`_test.go` file in `cmd/server/`, finds string-literal first args to `*.HandleFunc(...)` calls beginning with `/api/`, and diffs against the paths declared in `routeDescriptions()` in `cmd/server/openapi.go`. - `cmd/server/openapi_known_gaps.json` — seeded allowlist of the **18** `/api/` routes currently registered via `HandleFunc` but not yet documented in `openapi.go`. ## Ratchet pattern From this branch forward, `TestOpenAPICompleteness` fails when: 1. A new `HandleFunc("/api/...")` is added without a matching entry in `openapi.go` **or** the allowlist (regression gate — the main goal of Phase 1). 2. A route in the allowlist is *also* documented in `openapi.go` — the allowlist must shrink as Phase 2 backfills land, never go stale. The two-commit history (red → green) demonstrates the gate works: - **Red commit**: adds only the test. Fails on master with the 18 missing routes listed. - **Green commit**: adds the allowlist seeded with that exact 18-route set. Test passes at the current baseline. ## Local verification - `go test ./cmd/server/ -run TestOpenAPICompleteness -v` → PASS at baseline (`44/62 covered; 18 in allowlist; 18 gaps remain`). - Ratchet validation: temporarily inserted `r.HandleFunc("/api/ratchet-test-route", ...)` into `routes.go` → test FAILED with that exact route name; reverted → test PASSES again. ## Files changed - `cmd/server/openapi_completeness_test.go` (+203 / new) - `cmd/server/openapi_known_gaps.json` (+24 / new) ## Preflight `bash ~/.openclaw/skills/pr-preflight/scripts/run-all.sh origin/master` → all hard gates pass; no warnings. ## Out of scope - Backfilling the 18 allowlisted routes into `openapi.go` (Phase 2 — tracked separately). - Schema validation of the spec against OpenAPI 3.0 (Phase 3 per the issue). - PR template checkbox update (Phase 2 follow-up). Issue #1670 stays open for Phase 2. --------- Co-authored-by: clawbot <bot@corescope.local>
28 lines
1.3 KiB
JSON
28 lines
1.3 KiB
JSON
{
|
|
"_comment": "Allowlist of /api/ routes registered via HandleFunc in cmd/server/ that are NOT yet documented in cmd/server/openapi.go. This is the 'ratchet' baseline for issue #1670 Phase 1: the TestOpenAPICompleteness gate fails when a NEW handler is added without either documenting it in openapi.go OR appending it here. Phase 2 (the actual backfill of these routes into openapi.go) is tracked in a separate issue per the #1670 triage. Entries should be REMOVED as Phase 2 lands docs for each route — the gate also fails if an entry here is already covered by openapi.go (stale allowlist).",
|
|
"_issue": "https://github.com/Kpa-clawbot/CoreScope/issues/1670",
|
|
"routes": [
|
|
"/api/admin/prune-geo-filter",
|
|
"/api/admin/prune-geo-filter/status",
|
|
"/api/analytics/relay-airtime-share",
|
|
"/api/analytics/roles",
|
|
"/api/config/areas",
|
|
"/api/config/areas/polygons",
|
|
"/api/docs",
|
|
"/api/dropped-packets",
|
|
"/api/healthz",
|
|
"/api/known-channels",
|
|
"/api/nodes/clock-skew",
|
|
"/api/nodes/{pubkey}/battery",
|
|
"/api/nodes/{pubkey}/clock-skew",
|
|
"/api/nodes/{pubkey}/reach",
|
|
"/api/observers/clock-skew",
|
|
"/api/paths/inspect",
|
|
"/api/perf/io",
|
|
"/api/perf/sqlite",
|
|
"/api/perf/write-sources",
|
|
"/api/scope-stats",
|
|
"/api/spec"
|
|
]
|
|
}
|