Skip to content

feat(greenfield): add system metrics overview - #406

Open
mira-2026 wants to merge 1 commit into
mira/greenfield-rewrite-phase-three-metricsfrom
mira/greenfield-rewrite-phase-three-system-metrics
Open

feat(greenfield): add system metrics overview#406
mira-2026 wants to merge 1 commit into
mira/greenfield-rewrite-phase-three-metricsfrom
mira/greenfield-rewrite-phase-three-system-metrics

Conversation

@mira-2026

@mira-2026 mira-2026 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a strict session-only system.metrics query for bounded CPU, memory, root-disk, aggregate network, uptime, sample-time, and freshness gauges
  • collect metrics without shell execution or host/interface identity, coalesce concurrent reads, and serve an explicitly stale last-known-good sample for at most 30 seconds
  • render an accessible five-second overview above the cache browser with shared measurement formatting, reusable metric cards, and Storybook coverage
  • register generated contract documentation while keeping legacy GET /api/metrics and full / parity planned until their remaining projections are implemented

Behavior and regression coverage

  • anonymous and automation principals are rejected before sampler access; the procedure has no automation capability and exposes only fixed safe outage text
  • Linux network sampling warms across its first sample, counter resets, and clock regressions; unsafe counters, rates, capacity, and output shapes fail closed
  • concurrent reads share one in-flight collection; failed refreshes may return a validated stale snapshot only inside the inclusive 30-second window
  • TanStack Query forwards cancellation, polls every five seconds, retains validated data during refresh failures, and labels stale and warming states explicitly
  • focused contract, procedure, collector, service, runtime, formatter, query, component, route, parity, and Storybook tests cover the slice

Verification

  • bun run test:bun — 1594 passed
  • bun run test:browser — 287 passed
  • bun run storybook:test — 50 files / 170 tests passed
  • bun run test:coverage — 91.77% (52657/57377 lines; required 85%)
  • bun run typecheck
  • bun run lint
  • bun run format:check
  • bun run check:boundaries
  • bun run docs:check
  • bun run db:check
  • bun audit --production — no vulnerabilities
  • bun run storybook:build
  • bun run build:release — exact clean commit 12bca596d0a876cd418d852906e8db166f85c909
  • independent read-only security/contract/runtime/UI audit — no blockers

Risk checklist

  • No secrets, tokens, .env files, database dumps, runtime state, hostname, CPU model, or interface identity committed
  • The new API query enforces browser-session authentication and strict Valibot input/output validation
  • Raw collector failures remain internal and map only through the typed fixed-text SERVICE_UNAVAILABLE boundary
  • No migration, dependency, configuration, realtime-topic, or control-authority change
  • UI behavior is described above and covered by component, route, accessibility, cancellation, and Storybook tests

Deployment / operations

  • No deploy, restart, migration, or configuration change needed for review
  • Rollback is the ordinary revert of this isolated stacked commit

Notes for reviewers

  • Base is frozen PR feat(greenfield): add Storybook and refresh test tooling #405 at 6eb53d8c09b2611f9d03d127f6ac0759f8653ce0.
  • effect@4.0.0-beta.106 is the intentional audited parent version; this PR does not change it.
  • Review the browser-session-only boundary, network baseline recovery, last-known-good age calculation, and retained-data UI states.

@mira-2026
mira-2026 requested a review from rajohan as a code owner August 9, 2026 00:54
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mira-2026, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 seconds

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b7614a3-4e54-4537-bfa6-5e07e0bba436

📥 Commits

Reviewing files that changed from the base of the PR and between 6eb53d8 and 12bca59.

⛔ Files ignored due to path filters (3)
  • greenfield/docs/generated/procedures.md is excluded by !**/generated/** and included by **/*
  • greenfield/docs/generated/schemas/system.metrics.input.schema.json is excluded by !**/generated/** and included by **/*
  • greenfield/docs/generated/schemas/system.metrics.output.schema.json is excluded by !**/generated/** and included by **/*
📒 Files selected for processing (33)
  • greenfield/.bun-browser-test-timings.json
  • greenfield/.bun-test-timings.json
  • greenfield/docs/architecture/greenfield-rewrite/progress.md
  • greenfield/scripts/documentation/jsonSchema.ts
  • greenfield/src/browser/cache/cachePresentation.ts
  • greenfield/src/browser/lib/formatMeasurements.test.ts
  • greenfield/src/browser/lib/formatMeasurements.ts
  • greenfield/src/browser/overview/OverviewRoute.test.tsx
  • greenfield/src/browser/overview/OverviewRoute.tsx
  • greenfield/src/browser/overview/SystemMetricsCards.test.tsx
  • greenfield/src/browser/overview/SystemMetricsCards.tsx
  • greenfield/src/browser/overview/SystemMetricsSection.tsx
  • greenfield/src/browser/overview/stories/SystemMetricsCards.stories.tsx
  • greenfield/src/browser/overview/systemMetricsPresentation.test.ts
  • greenfield/src/browser/overview/systemMetricsPresentation.ts
  • greenfield/src/browser/overview/systemMetricsQueries.test.ts
  • greenfield/src/browser/overview/systemMetricsQueries.ts
  • greenfield/src/browser/ui/MetricCard.test.tsx
  • greenfield/src/browser/ui/MetricCard.tsx
  • greenfield/src/browser/ui/stories/MetricCard.stories.tsx
  • greenfield/src/contracts/system.test.ts
  • greenfield/src/contracts/system.ts
  • greenfield/src/server/domains/system/procedures.test.ts
  • greenfield/src/server/domains/system/procedures.ts
  • greenfield/src/server/domains/system/systemMetricsCollector.test.ts
  • greenfield/src/server/domains/system/systemMetricsCollector.ts
  • greenfield/src/server/domains/system/systemMetricsService.test.ts
  • greenfield/src/server/domains/system/systemMetricsService.ts
  • greenfield/src/server/platform/runtime/applicationRuntime.test.ts
  • greenfield/src/server/platform/runtime/applicationRuntime.ts
  • greenfield/src/server/test/support/requestContext.ts
  • greenfield/src/server/trpc/procedureErrorPolicy.ts
  • greenfield/src/test/parity/fixtures/greenfield-contracts.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mira-2026 mira-2026 changed the title mira/greenfield rewrite phase three system metrics feat(greenfield): add system metrics overview Aug 9, 2026
@mira-2026 mira-2026 added status: needs-review Ready for human or agent review type: feature Adds user-visible functionality type: tests Adds or updates automated tests/coverage type: documentation Documentation, README, comments, and operational notes area: backend Backend API, server routes, services, and integrations area: frontend Frontend UI, client state, routing, and browser behavior area: ops Operational actions, deploys, services, backups, and health labels Aug 9, 2026
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: backend Backend API, server routes, services, and integrations area: frontend Frontend UI, client state, routing, and browser behavior area: ops Operational actions, deploys, services, backups, and health status: needs-review Ready for human or agent review type: documentation Documentation, README, comments, and operational notes type: feature Adds user-visible functionality type: tests Adds or updates automated tests/coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant