CI coverage gate failing: internal/server at 93.6% vs the 95% floor — blocks GHCR publish on the GitHub mirror #289
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#289
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's wrong
The GitHub mirror CI (run 34484949364, job
test→ step "coverage gate") is failing on the 95% per-package coverage floor, which blocks the GHCR docker publish for every push to main.Root cause (reproduced locally)
make coverfails on exactly one package:Every other package passes (api 95.2, bundle 95.7, checks 96.4, repoimport 95.8, mirror 96.9, …). 64 functions in
internal/serversit below 95% individually; the meaningful gaps:auth.gowgtPrincipalauth_oidc.goverifyStateTickethealth.gosdkReposJShealth.goexplorePageauth.goAuthenticatebind_ssh.goadoptPlaceholderauth_oidc.goauthTokensMintbind_wal.goPublishSettingsinstall_sh.go79.4%,listener.go88.9%,router.go90.5%,setup_api.go92.1%(Local run note:
go test ./internal/server/needsweb/distto exist for the embed — an emptyweb/dist/.keepis enough to compile; CI builds the real dist first, so the CI failure is genuine coverage, not the embed.)The coverage dropped across the recent feature wave that touched
internal/serverwithout adding matching tests —git log -- internal/servershows #247 (last-commit tracking,sizecatalogwiring), #240 (mirror endpoints), #215 (external SSH port) landed on the auth/bind/health surfaces.Fix
Raise
internal/serverback over the floor by testing the uncovered paths — in rough order of value:health.gosdkReposJS(26.7%) andexplorePage(38.5%) — likely large simple-branch functions, cheapest wins.verifyStateTicket(76.9%),authTokensMint(88.2%),exchangeCode(89.3%) — these are security-relevant error branches (bad state tickets, failed exchanges) that deserve tests regardless of the gate.auth.gowgtPrincipal(75.0%) andAuthenticate(80.0%) — same security rationale.bind_wal.goPublishSettings(77.8%) andbind_ssh.goadoptPlaceholder(81.8%).install_sh.go,listener.go,setup_api.go) — whatever remains to clear 95%.Test style follows the package's existing table-driven fixtures (
fakes_test.gopatterns); no production-code changes should be needed. If a block is genuinely unreachable dead code, that's a separate deletion commit with its own justification — don't exclude files from the gate.Acceptance criteria
make coverpasses locally (server ≥ 95.0%, all other packages unchanged).testworkflow completes green and thepublishjob runs again (GHCR image publishes on push to main).Fix ready for review: #291 (branch
fix/issue-289).Note on scope drift vs the issue body: the per-function table in the issue matches a no-dist local run (sdkReposJS 26.7%/explorePage 38.5% happen with an empty
web/dist, where the UI tests 500). With the CI-order build (make webfirst) origin/main measures server 95.6% — but the margin was one bad day from red, and the listed OIDC/auth/bind gaps were real, so I tested them all anyway: server → 98.5%. The actual local gate failure wasinternal/storeat 94.97% (#234'sStatsKey/OwnerProfileKeylanded uncovered — one statement short of the floor), fixed with layout pins in the existing key table → 95.1%.make coverfully green;-racegreen.Two real bugs came out of the tests (fixed + declared in the PR):
equalFoldLastpanics on short input, andserveStaticmapped store outages to 404 instead of 503. The leftover sub-95% functions are defensive-dead branches (verifyStateTicket re-checks, mint error returns, template errors, etc.) — catalogued in the PR description for a separate deletion pass, not excluded from the gate. Not merging; review requested.Review of PR #291 (fix/issue-289) — verified in scratch worktrees, main untouched.
TEST GENUINENESS (law 11): PASS. Sampled TestEqualFoldLastTable (x_gaps10_test.go:111 — includes {"a","abc"} which panics pre-fix), TestServeStaticHeadError (:609 — asserts 404 miss vs 503 outage), TestErrorsAsTable (:589 — direct/wrapped/nil error identity), TestRegistryStoreFaults (:986 — torn k-doc, dead-store add, k-doc rollback verified gone, blind list), TestVerifyTokenWireNegatives + TestConfigCoerceNegatives + TestWGTPrincipalRoundTripAndReject (x_gaps9_test.go — forged/tampered/expired tokens assert ErrInvalid kind + Why strings; coerce asserts per-branch error substrings). All assert error codes/kinds/state changes, not mere execution.
PROD FIX 1 — equalFoldLast length guard (health.go:336): CORRECT + IN-SCOPE. Only caller is hasSuffixFold (:332) which already guards len, so the fix only converts a latent direct-call panic into false. New table test pins it. No behavior change for existing callers.
PROD FIX 2 — serveStatic 404-vs-503 ordering (static.go:21-34): CORRECT + IN-SCOPE. Old code returned 404 when a non-NotFound store error coincided with nil meta (outage masquerading as not-found); new code returns 503. All other paths identical. Pinned by TestServeStaticHeadError. No doc update needed (no doc pins the old ordering; fix aligns with fail-closed law 9).
STORE 94.97->95.1: LEGITIMATE. keys_test.go:33-36 adds exact-equality rows for previously untested StatsKey/StatsKeySuffix/OwnerProfileKey/OwnerProfileKeySuffix, values match keys.go definitions.
RESULTS (scratch /tmp/pr291, origin/fix/issue-289 @
fd76be8): gofmt clean; go vet clean (exit 0; note: scratch worktree needs web/dist present for the embed — copied from main's build output, read-only); go test -race ./internal/store/... PASS (store 95.1%); go test -race ./internal/server/... PASS, 98.5%. One env note: TestUIAssetConcepts fails on a stale dist (missing concepts/*.gif) — reproduced identically on pristine origin/main, so pre-existing/environmental, not a PR regression; after 'make web' in scratch the full suite is green. Did NOT run full 'make cover' (expensive); only server+store ran, which are the only packages the PR touches, both above the 95% gate. No browser (backend-only change). No production behavior change beyond the 2 fixes (diff prod files = health.go + static.go only).No fixes pushed — nothing found needing correction.
Fixed by PR #291 (review: genuine behavioral pins, 2 real bugs fixed; server 98.5%, store 95.1%), merged. Closing.