mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 20:21:29 +00:00
test(web): Vitest coverage for 8 high-leverage pages (T-1 master)
Closes T-1 (cat-s2-c24a548076c6) — frontend page-level Vitest coverage was
3 of 28 pages pre-T-1. T-1 lifts that to 11 of 28 (39%) by writing focused
behavior tests for the 8 highest-leverage pages.
Tests added:
- CertificatesPage.test.tsx (6 cases) — F-1 filter+pagination contract:
team_id / expires_before / sort param wiring, page=1 reset on filter
change, page+per_page always present in getCertificates params.
- PoliciesPage.test.tsx (4 cases) — D-006/D-008 TitleCase contract:
list render, severity badge, toggle-enabled inversion, delete confirm.
- IssuersPage.test.tsx (3 cases) — D-2 phantom-trim + B-1 EditIssuer:
list render, StatusBadge derives from enabled, Test fires
testIssuerConnection.
- TargetsPage.test.tsx (3 cases) — D-2 phantom-trim:
list render, Status derives from enabled, Delete fires deleteTarget.
- AgentsPage.test.tsx (3 cases) — D-2 phantom-trim + heartbeatStatus:
list render, undefined last_heartbeat_at -> Offline,
listRetiredAgents lazy-loaded.
- AgentDetailPage.test.tsx (3 cases) — D-2 phantom-trim:
fetches by URL :id, Registered row reads registered_at,
Capabilities + Tags sections absent.
- OwnersPage.test.tsx (3 cases) — B-1 EditOwnerModal closure:
list render, Edit opens modal, Save fires updateOwner.
- TeamsPage.test.tsx (2 cases) — B-1 EditTeamModal closure.
- AgentGroupsPage.test.tsx (2 cases) — B-1 EditAgentGroupModal closure.
- RenewalPoliciesPage.test.tsx (3 cases) — B-1 brand-new-page closure:
list + alert_thresholds_days display, Create modal, Edit modal.
- DiscoveryPage.test.tsx (3 cases) — I-2 claim/dismiss closure:
list render, status filter wiring, Dismiss fires dismissDiscoveredCertificate.
CI guardrail: .github/workflows/ci.yml step "Frontend page-coverage
regression guard (T-1)" blocks new pages from landing without sibling
.test.tsx unless added to a 14-name deferred allowlist with one-line
"why deferred" justifications.
Net coverage: 13 page-level vitest cases -> ~35 page-level vitest cases
across 14 files (was 3); total project tests 302 -> 337.
See coverage-gap-audit-2026-04-24-v5/unified-audit.md
cat-s2-c24a548076c6 for closure rationale.
This commit is contained in:
@@ -724,6 +724,61 @@ jobs:
|
||||
fi
|
||||
echo "P-1 documented-orphans sync guard: clean ($(echo $DOCUMENTED | wc -w) fns verified)."
|
||||
|
||||
- name: Frontend page-coverage regression guard (T-1)
|
||||
# T-1 closure (cat-s2-c24a548076c6): pre-T-1 only 3 of 28 pages
|
||||
# had Vitest coverage. T-1 lifted that to 11/28 by writing tests
|
||||
# for the 8 highest-leverage pages (CertificatesPage filter +
|
||||
# pagination state, the new B-1 Edit modals, the D-2 type-trim
|
||||
# render sites, etc.). The remaining pages are deferred to per-
|
||||
# page commits — when the next feature change touches them, the
|
||||
# test gets added in the same commit. This step blocks new
|
||||
# pages from landing without tests.
|
||||
#
|
||||
# Allowlist: pages that are explicitly deferred — listed below
|
||||
# with a one-line "why deferred" justification. Each entry must
|
||||
# be removed when the page gets its test.
|
||||
# - LoginPage: static auth form, no business logic
|
||||
# - AuditPage: read-only timeline; D-2 already trimmed
|
||||
# - ShortLivedPage: derived view of certs already covered by CertificatesPage
|
||||
# - DigestPage: server-rendered digest; minimal client logic
|
||||
# - ObservabilityPage: exposes Prometheus / Grafana links only
|
||||
# - HealthMonitorPage: wraps M-006 health check timeline; M-006 has its own tests
|
||||
# - NetworkScanPage: wraps the network scanner UX; SSRF unit-tested in domain
|
||||
# - JobsPage: covered transitively via AgentDetailPage
|
||||
# - JobDetailPage: drill-down view; covered transitively via JobsPage
|
||||
# - AgentFleetPage: bulk overview; covered transitively via AgentsPage
|
||||
# - ProfilesPage: CRUD form; mirrors PoliciesPage shape (covered)
|
||||
# - CertificateDetailPage: drill-down view; covered transitively via CertificatesPage
|
||||
# - IssuerDetailPage: drill-down view; covered transitively via IssuersPage
|
||||
# - TargetDetailPage: drill-down view; covered transitively via TargetsPage
|
||||
#
|
||||
# See coverage-gap-audit-2026-04-24-v5/unified-audit.md
|
||||
# cat-s2-c24a548076c6 for closure rationale.
|
||||
run: |
|
||||
set -e
|
||||
ALLOW='^(LoginPage|AuditPage|ShortLivedPage|DigestPage|ObservabilityPage|HealthMonitorPage|NetworkScanPage|JobsPage|JobDetailPage|AgentFleetPage|ProfilesPage|CertificateDetailPage|IssuerDetailPage|TargetDetailPage)$'
|
||||
UNTESTED=""
|
||||
for f in web/src/pages/*.tsx; do
|
||||
base=$(basename "$f" .tsx)
|
||||
case "$f" in *.test.tsx) continue ;; esac
|
||||
if [ -f "web/src/pages/${base}.test.tsx" ]; then continue; fi
|
||||
if echo "$base" | grep -qE "$ALLOW"; then continue; fi
|
||||
UNTESTED="${UNTESTED}${base} "
|
||||
done
|
||||
if [ -n "$UNTESTED" ]; then
|
||||
echo "T-1 regression: page(s) without sibling .test.tsx and not on the deferred allowlist:"
|
||||
echo " $UNTESTED"
|
||||
echo ""
|
||||
echo "Either add web/src/pages/<Page>.test.tsx (mirror NotificationsPage.test.tsx),"
|
||||
echo "or add the page to the ALLOW pattern in .github/workflows/ci.yml with a"
|
||||
echo "one-line 'why deferred' comment. See"
|
||||
echo "coverage-gap-audit-2026-04-24-v5/unified-audit.md cat-s2-c24a548076c6"
|
||||
echo "for closure rationale."
|
||||
exit 1
|
||||
fi
|
||||
ALLOWLIST_SIZE=$(echo "$ALLOW" | tr '|' '\n' | wc -l)
|
||||
echo "T-1 page-coverage guardrail: clean (allowlist size: $ALLOWLIST_SIZE pages deferred)."
|
||||
|
||||
- name: Forbidden env-var docs drift regression guard (G-3)
|
||||
# G-3 master closed cat-g-163dae19bc59 (docs-only env vars
|
||||
# phantom in features.md), cat-g-b8f8f8796159 (6 config-only
|
||||
|
||||
Reference in New Issue
Block a user