mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-25 13:10:03 +00:00
55b6e5145e
Stacked on #2686 (which is stacked on #2682). It lands after them. ## Problem Patrol > Activity > Finding options and history > Open work showed **Check needed: Run Patrol to check everything and refresh open work.** whenever `overall_health.factors` held any `coverage` factor. After a clean full run, the backend keeps its `Recent Patrol errors` coverage factor if an earlier run in its 24-hour window errored (`summarizeRecentPatrolCoverage`). It drops the factor only when three clean full runs lead that window or the errored runs age out. At the default 6-hour interval that left about 12 hours of "Check needed" after a clean check of every resource, while the header read `Last check: 4m ago · checked 1377 resources`. One press of Check now did not clear it. At impact 20 or 30 the factor lowers the grade to B or C, so the same stale signal showed **Patrol needs review** instead. ## Change - `getPatrolFindingsEmptyState` reads run history first, through the new `getPatrolRunCoverage`: - **complete**: the latest completed full run ended cleanly, checked resources, finished within the last 24 hours (the backend's window), and no run after it failed. A coverage factor no longer withholds the all-clear, and a grade lowered only by coverage factors no longer counts as degraded health. - **incomplete**: the latest full run, or a run after it, ended with errors, or only targeted or follow-up runs have completed. Shows "Check needed". A failed targeted run after the last clean full run is new here: it used to read green whenever the backend had dropped its factor. - **unproven**: no completed run, or a clean full run that checked nothing or finished more than 24 hours ago. The coverage factor decides, as before. - `getPatrolVerificationPresentation` was read only for its warning tone. `getPatrolRunCoverage` replaces it. The activity-mix label had no reader, so it goes, along with `getPatrolActivityBreakdown` / `formatPatrolActivityBreakdown`, whose only caller it was. - The backend factor and its three-run rule (documented in ai-runtime) are unchanged. - patrol-intelligence, api-contracts and frontend-primitives now describe the reconciliation. ## Verification - Vitest over `src/utils src/features src/components/AI src/components/patrol src/components/shared src/pages src/hooks src/__tests__`: all pass except `agentInstallCommand.test.ts`, which fails on the Mac regardless of this change, and one `DockerHostsTable` case that timed out under load and passes on its own. The new empty-state cases fail against the parent tree. - Browser: embedded builds of the parent (#2686) and this tree on private DEMO_MODE stacks, with run history and overall health stubbed, at desktop 1440x1000 and phone 390x844. Eleven scenarios per width, including Check now while the factor is present. Results are in the receipt.