Skip to content

test(automation): cover BiometricsSignalReader and #664 codecov gaps#666

Open
ng wants to merge 1 commit into
devfrom
test/664-codecov-followup
Open

test(automation): cover BiometricsSignalReader and #664 codecov gaps#666
ng wants to merge 1 commit into
devfrom
test/664-codecov-followup

Conversation

@ng

@ng ng commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Why

The #664 release report flagged 93.04% patch coverage with 72 missing lines. The dominant gap was src/automation/signals.biometrics.ts at 10.20%BiometricsSignalReader.read() (lines 45–115) had no tests at all; the existing test file only covered reduceCap.

What

Test-only changes, no production code touched:

  • signals.biometrics.test.ts — new BiometricsSignalReader suite using the project's hoisted drizzle-chain mock pattern (same as ambientSensor.test.ts). Covers: fresh vitals/movement per side with null-column omission, bed-surface zone mean/spread/gradient (full vs single-zone side), centidegree→°F and centipercent→% conversion, water temp, ambient light, cap matrix reducers for both capSense2 array and Pod 3 scalar shapes, per-source staleness windows (5 min vitals, 15 min env, 30 s cap), and the warn-and-degrade path when the DB throws. 10.20% → 100% lines.
  • signals.test.tsCompositeSignalReader merge/override semantics (was uncovered, lines 107–112) and the binary expression case in collectWindowKeysFromExpr.
  • scheduleTime.test.ts — flagged branch partials: NaN clock / unparseable window bounds in isInWindow, end-side NaN in calcDuration, missing-minute and NaN-hour fallbacks in formatTime12h, and the ≥4 am same-day branch of getCurrentDayForTimezone.

Coverage after (files touched by this PR):

File Lines before Lines after
signals.biometrics.ts 10.2% 100%
signals.ts 93.4% 100%
scheduleTime.ts 100% (81% branch) 100% (90.7% branch)

Not addressed: the report's remaining 1–4-line partials in backtest.ts, engine.ts, builderModel.ts, instance.ts, dacTransport.ts, ThermalTrendChart.tsx, and db/schema.ts — each is a single guard or JSX branch; diminishing returns versus the 50+ lines closed here. Remaining partials in scheduleTime.ts are the ?? '0' Intl fallbacks, unreachable with real formatToParts output.

Test plan

  • vitest run on the three test files: 36 tests, all passing.
  • Coverage verified locally with --coverage.include on the three source files (table above).
  • Pre-push gate (tsc, eslint, drizzle validation, changed-file tests) passed.
🛏️ Beam this PR onto a sleepypod

Pick the snippet that matches your pod. Already-installed pods can't use the curl bootstraps below — sleepypod's egress firewall DROPs github.com, and the script that knows how to unblock WAN is the very file curl is trying to fetch. Use sp-update instead; it's on disk and opens WAN as its first step.

🔄 Already on a sleepypod (most common — review a PR on a running pod):

sudo sp-update test/664-codecov-followup

🚀 Fresh pod / first install — bootstraps from GitHub, rebuilds every push:

curl -fsSL https://raw.githubusercontent.com/sleepypod/core/test/664-codecov-followup/scripts/install \
  | sudo bash -s -- --branch test/664-codecov-followup

🎯 Pin to this exact build (run 29175257915 · 407a04c) — fresh-pod path, locked to one CI artifact for reproducible review:

curl -fsSL https://raw.githubusercontent.com/sleepypod/core/407a04cb33e0bf4dc7ff3ec1cf4dabe91bfe2139/scripts/install \
  | sudo bash -s -- \
      --branch test/664-codecov-followup \
      --artifact-url 'https://nightly.link/sleepypod/core/actions/runs/29175257915/sleepypod-core.zip'

🧊 Artifact: sleepypod-core · self-destructs in 30 days 💥

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: fe56a907-fb5d-4c30-b969-f4c9c568af78

📥 Commits

Reviewing files that changed from the base of the PR and between a3d885f and 407a04c.

📒 Files selected for processing (3)
  • src/automation/tests/signals.biometrics.test.ts
  • src/automation/tests/signals.test.ts
  • src/lib/tests/scheduleTime.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/664-codecov-followup

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.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant