fix(hosts): Avg compliance KPI now matches /dashboard (shared fleet/score)#676
Merged
Conversation
… /dashboard
The /dashboard and /hosts 'Avg compliance' tiles showed different numbers
because they used different denominators over the same host_rule_state data:
- /dashboard (GET /api/v1/fleet/score): passing / (passing + failing)
- /hosts (kpisFromHosts): passing / total, where total = COUNT(*) including
skipped + error rows.
Kensa marks many rules not-applicable (skipped) per host, so the /hosts figure
read materially lower. passing/(passing+failing) is the canonical metric (it
also drives the scheduler bands via drift.ComplianceScore).
Source the /hosts headline KPI from the same /api/v1/fleet/score endpoint the
dashboard uses (shared queryKey ['fleet','score'], same round(passing_fraction
*100)) so the two surfaces are literally the same number and cannot drift. The
client-side kpisFromHosts aggregate remains a fallback until the score loads.
Spec frontend-hosts-list v1.8.0: new C-13 + AC-26 + source-inspection test.
remyluslosius
added a commit
that referenced
this pull request
Jun 25, 2026
… flake It hard-asserts 2s and gated #676's CI under -race (passed on rerun); it missed the 2026-06-21 perftest.Budgetf() migration the other perf tests got.
remyluslosius
added a commit
that referenced
this pull request
Jun 25, 2026
* docs: session meta — CHANGELOG, SESSION_LOG (2026-06-25), STATUS.md Document the 2026-06-25 session's in-flight work (PKG-3 #673, AUTH-1 #675/#678, notifications Slice 1 #679, avg-compliance #676): CHANGELOG [Unreleased] entries, a SESSION_LOG handoff entry, and a new STATUS.md one-page snapshot. BACKLOG findings from the security review land in a follow-up commit. * docs(guides): truthfulness fixes from the 2026-06-25 audit + BACKLOG DOC-3 High-impact, verified guide defects fixed: - UPGRADE/QUICKSTART/ENVIRONMENT/MONITORING: --config is a GLOBAL flag (Go flag parsing stops at the first non-flag arg), so 'openwatch migrate --config X' silently ignored --config. Moved --config before the subcommand everywhere. - COMPLIANCE_CONTROLS: removed the invented 'analyst' role + 'three-tier role model' (real: 5 roles — viewer/auditor/ops_lead/security_admin/admin) and the fabricated '100/min per user, 1000/min per IP' rate-limit (real: per-IP sliding window on the auth endpoints). - API_GUIDE: the 'not yet in the API' section was almost entirely false (scans, remediation, exceptions, posture/drift, audit export, rule browser all ship); rewrote it to list the live surface + only the genuinely-absent /metrics and /security-info. Added the missing ops_lead role to the role table. - Version sweep rc.13 -> rc.14; bumped Last Updated to 2026-06-25 on edited guides. BACKLOG DOC-3 captures the remaining audit items (SCANNING dead-endpoint appendix, USER_ROLES matrix, INSTALLATION PG-dep, DATABASE_MIGRATIONS fake output, style sweep) and flags the audit's '538->539' suggestion as a FALSE POSITIVE — rc.14 bundles Kensa v0.6.0 = 538 (the guides correctly say 538). * docs(backlog): note the gating TestApply_1000Rules_Under2Seconds perf flake It hard-asserts 2s and gated #676's CI under -race (passed on rerun); it missed the 2026-06-21 perftest.Budgetf() migration the other perf tests got.
remyluslosius
added a commit
that referenced
this pull request
Jun 25, 2026
Bump version.env to 0.2.0-rc.15 and cut the CHANGELOG [Unreleased] accumulator into a dated [0.2.0-rc.15] section covering everything landed since rc.14: - PKG-3 remediation store-path fix (production-breaking) (#673) - AUTH-1: client idle timer (#675) + absolute-timeout ceiling + slide-on-user-activity (#678) - Notifications Slice 1: durable change-driven bell (#679) - Avg-compliance parity /hosts <-> /dashboard (#676) Local: changelog + version-consistency + fips + package-build tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/dashboardand/hostsboth show an "Avg compliance" tile, but the numbers differed. Both readhost_rule_state, with different denominators:GET /api/v1/fleet/score)kpisFromHosts)Kensa marks a large share of the corpus not-applicable (skipped) per host, so the /hosts figure read materially lower.
passing/(passing+failing)is the canonical metric — it's also whatdrift.ComplianceScoreuses to drive the scheduler bands.Fix
Source the /hosts headline KPI from the same
/api/v1/fleet/scoreendpoint the dashboard uses (sharedqueryKey ['fleet','score'], sameMath.round(passing_fraction*100)). The two tiles are now literally the same number and can't drift. The client-sidekpisFromHostsaggregate stays as a fallback until the fleet score resolves.frontend-hosts-listv1.8.0: new C-13 + AC-26 + source-inspection test.specter check113 specs, coverage 100%.Related (not in this PR)
The per-host card compliance % (the donut on each host card) still uses
passing/total(skipped-inclusive), which differs from the canonical band metric. That's internally consistent on the card but means the cards won't visually average to the headline tile, and a host's card color can differ from its scheduler band. Worth a follow-up to align per-host display topassing/(passing+failing)(touches AC-16 + card wording + sort/tier). Also:fleet/scorehas nodeleted_atfilter, so residualhost_rule_staterows for soft-deleted hosts count toward the fleet number — a small backend correctness fix. Happy to file/do both.