feat(freshness): surface seed health in risk panel#3493
Conversation
|
@lspassos1 is attempting to deploy a commit to the World Monitor Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR surfaces backend seed-health metadata from Confidence Score: 4/5Safe to merge; only P2 findings present, both isolated to StrategicRiskPanel.refreshHealthFreshness(). All findings are P2. The dead src/components/StrategicRiskPanel.ts — refreshHealthFreshness throttle stamping and dead catch handler. Important Files Changed
Sequence DiagramsequenceDiagram
participant Panel as StrategicRiskPanel
participant HF as health-freshness.ts
participant API as /api/health
participant DF as dataFreshness (singleton)
participant UI as render()
Panel->>Panel: refresh()
Panel-->>HF: void refreshHealthFreshness() [non-blocking]
Panel->>DF: getSummary()
Panel->>UI: render() → renderFreshnessSurface()
UI->>DF: getAllSources()
DF-->>UI: sources (status recalculated)
Note over HF,API: runs concurrently
HF->>API: GET /api/health
API-->>HF: { checkedAt, checks: { ... } }
HF->>HF: map check names → DataSourceId[]
HF->>HF: deduplicate (worst-status wins per source)
HF->>DF: recordSeedHealth(updates)
DF->>DF: calculateStatus() with maxStaleMin cadence
DF-->>Panel: notifyListeners() → triggers next refresh
Reviews (1): Last reviewed commit: "fix(freshness): decouple health polling ..." | Re-trigger Greptile |
|
|
||
| public async refresh(): Promise<boolean> { | ||
| void this.refreshHealthFreshness().catch((error) => { |
There was a problem hiding this comment.
Dead
.catch() handler — never fires
refreshHealthFreshness() has its own try/catch that swallows every exception without rethrowing, so the promise it returns can never reject. The .catch() registered here is unreachable dead code and will mislead future readers into thinking errors can surface from this call.
| public async refresh(): Promise<boolean> { | |
| void this.refreshHealthFreshness().catch((error) => { | |
| void this.refreshHealthFreshness(); |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44d6ff7399
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88b32fc05f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Follow-up pushed in Changes:
Validation:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
Surfaces seed-health freshness in the Strategic Risk panel by ingesting
/api/healthcadence metadata into the existingdataFreshnesstracker. Analysts get a compact data freshness signal without blocking the main risk refresh path.cc @koala73
Refs #3296
Type of change
Affected areas
/api/*)Root cause
The frontend freshness tracker was mostly session-local. The backend already knows seed age, cadence, and health state, but that signal was not visible in the Strategic Risk panel, so stale or missing seeded data could be hard to distinguish from genuinely quiet conditions.
Changes
refreshDataFreshnessFromHealth()to fetch/api/health, map health checks to frontend data sources, and record cadence-aware seed health.dataFreshnesswith seed-health metadata, per-sourcemaxStaleMin, and error/no-data handling for health statuses.StrategicRiskPanelwith source state and last-update timing./api/health.Validation
npx tsx --test tests/data-freshness-health.test.mtsnpm run typechecknpx biome lint src/components/StrategicRiskPanel.ts src/locales/en.json tests/data-freshness-health.test.mtsgit diff --checkRisk
Low to moderate. The health fetch is additive and non-blocking; if it fails, existing session-local freshness remains in use. The mapping guard test should catch future drift between frontend source IDs and
/api/healthcheck names.