Skip to content

feat(biometrics): add prospective shadow runtime, coordinator host and calibration API - #830

Merged
ng merged 4 commits into
devfrom
feat/bio-cal-3-shadow-api
Oct 14, 2026
Merged

ng merged 4 commits into
devfrom
feat/bio-cal-3-shadow-api

Conversation

@ng

@ng ng commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Part 3 of 4 splitting #824 (reference snapshot 7b9ac5d3) into reviewable stacked PRs. #824 stays open as the umbrella and is not merged; the four parts reproduce its tree exactly (the tree of feat/bio-cal-4-ui is identical to the tree of 7b9ac5d3).

Stack, merge in order:

  1. feat/bio-cal-1-foundation → dev: versioned calibration profiles, references, DB schema and migrations, shared Python runtime
  2. feat/bio-cal-2-backtest → part 1: retained backtest replay engine and isolated package experiments
  3. feat/bio-cal-3-shadow-api → part 2: prospective shadow runtime, isolated coordinator host, calibration API and MCP, demo handlers
  4. feat/bio-cal-4-ui → part 3: calibration UI, i18n catalogs, browser tests and docs

This part

  • Prospective shadow runtime (src/biometrics/shadow): bounded storage, worker transport and supervision, kernel budgets, admission bound to installed qualification and observed hardware, scheduling on pod boot, cancellation and recovery.
  • Isolated coordinator host for replay and shadow work (src/biometrics/backtest/coordinator*, host*) and Node-only instrumentation startup.
  • Calibration API surface (plus the profile diff, status, overview and reference comparison helpers that only the routers consume): tRPC routers (tuning, datasets, backtests, references, shadow), OpenAPI additions, RAW route changes and MCP tools, resources and prompts.
  • Demo handlers and the simulated browser evaluator that implement the new router contract, with the demo worker build identity and prebuild hook.
  • Pod benchmark runners for replay, waveform and shadow measurements.
  • Review follow-ups on this slice: an in-window shadow frame already dequeued at collection end is forwarded instead of silently dropped, and profile diffs report keys present on either side.
  • Rebase on dev: the app router, MCP tool and prompt lists, and the MCP README count now include both the saved-curve additions from feat(mcp): build and save a sleep curve from pod data #825/feat(curves): save named curves on the pod #827 and the biometric additions from this stack.
  • Coverage pass: tests for the shadow API and store, demo biometrics handlers, MCP biometric tools, waveform publication and Node instrumentation shutdown lift this slice's estimated patch coverage from 82% to about 93%.

Test plan

  • tsc --noEmit clean at this slice
  • eslint on the changed TS/TSX files clean
  • Full vitest run green at this slice (474 files, 6,959 tests) (the only failure under full-suite load was the pre-existing, unrelated scripts/tests/diagnosticCli.test.ts timing test, which passes in isolation)
  • CI: Typecheck, Lint, Unit Tests, Python modules, Build & Package
  • CodeRabbit review via the mirror proxy addressed

🤖 Generated with Claude Code

🛏️ 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 feat/bio-cal-3-shadow-api

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

curl -fsSL https://raw.githubusercontent.com/sleepypod/core/feat/bio-cal-3-shadow-api/scripts/install \
  | sudo bash -s -- --branch feat/bio-cal-3-shadow-api

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

curl -fsSL https://raw.githubusercontent.com/sleepypod/core/338aabe8f6e790dcee6c1e088ce23a6159c304e6/scripts/install \
  | sudo bash -s -- \
      --branch feat/bio-cal-3-shadow-api \
      --artifact-url 'https://nightly.link/sleepypod/core/actions/runs/38520827460/sleepypod-core.zip'

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

@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sleepypod-demo Ignored Ignored Preview Oct 14, 2026 6:12am UTC

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 148 files, which is 48 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4fff2e78-f132-468a-a8a9-bc5738b375db
📥 Commits

Reviewing files that changed from the base of the PR and between 35e6141 and 338aabe.

📒 Files selected for processing: 148
  • app/api/raw/[filename]/route.ts
  • app/api/raw/[filename]/tests/route.test.ts
  • instrumentation.ts
  • package.json
  • scripts/benchmarks/biometrics-live-shadow-runner.ts
  • scripts/benchmarks/biometrics-probe.py
  • scripts/benchmarks/biometrics-runner.ts
  • scripts/benchmarks/biometrics-shadow-runner.ts
  • scripts/benchmarks/biometrics-waveform-fixture.py
  • scripts/benchmarks/biometrics-waveform-runner.ts
  • scripts/build/biometrics-worker.mjs
  • scripts/build/demo-biometric-worker.mjs
  • scripts/tests/eslintConfig.test.ts
  • src/biometrics/backtest/coordinator-entry.ts
  • src/biometrics/backtest/coordinator-lanes.ts
  • src/biometrics/backtest/coordinator-queue.ts
  • src/biometrics/backtest/coordinator-service.ts
  • src/biometrics/backtest/coordinator-tasks.ts
  • src/biometrics/backtest/coordinator.ts
  • src/biometrics/backtest/descriptors.ts
  • src/biometrics/backtest/host-startup.ts
  • src/biometrics/backtest/host.ts
  • src/biometrics/backtest/tests/coordinator-entry.test.ts
  • src/biometrics/backtest/tests/coordinator-queue.test.ts
  • src/biometrics/backtest/tests/coordinator-tasks.test.ts
  • src/biometrics/backtest/tests/coordinator.test.ts
  • src/biometrics/backtest/tests/host-startup.test.ts
  • src/biometrics/backtest/tests/host.test.ts
  • src/biometrics/backtest/tests/waveform-publication.integration.test.ts
  • src/biometrics/backtest/tests/waveform-publication.test.ts
  • src/biometrics/backtest/waveform-publication.ts
  • src/biometrics/profiles/diff.ts
  • src/biometrics/profiles/overview.ts
  • src/biometrics/profiles/status.ts
  • src/biometrics/profiles/tests/diff.test.ts
  • src/biometrics/profiles/tests/runtime-integration.test.ts
  • src/biometrics/references/comparison.ts
  • src/biometrics/shadow/README.md
  • src/biometrics/shadow/active-database.ts
  • src/biometrics/shadow/active-reader.ts
  • src/biometrics/shadow/admission.ts
  • src/biometrics/shadow/attempt.ts
  • src/biometrics/shadow/build.ts
  • src/biometrics/shadow/cleanup-error.ts
  • src/biometrics/shadow/context.ts
  • src/biometrics/shadow/descriptors.ts
  • src/biometrics/shadow/device-identity.ts
  • src/biometrics/shadow/execution-policy.ts
  • src/biometrics/shadow/frame-source.ts
  • src/biometrics/shadow/health-monitor.ts
  • src/biometrics/shadow/host-entry.ts
  • src/biometrics/shadow/host.ts
  • src/biometrics/shadow/installed-attempt.ts
  • src/biometrics/shadow/installed-host.ts
  • src/biometrics/shadow/installed-preparation.ts
  • src/biometrics/shadow/live-sources.ts
  • src/biometrics/shadow/plan-contracts.ts
  • src/biometrics/shadow/planned-sources.ts
  • src/biometrics/shadow/preparation-contracts.ts
  • src/biometrics/shadow/preparation.ts
  • src/biometrics/shadow/process-cleanup.ts
  • src/biometrics/shadow/profiles.ts
  • src/biometrics/shadow/python-installation.ts
  • src/biometrics/shadow/receipt.ts
  • src/biometrics/shadow/report-contracts.ts
  • src/biometrics/shadow/report-core.ts
  • src/biometrics/shadow/report-operation.ts
  • src/biometrics/shadow/report.ts
  • src/biometrics/shadow/runtime-binding.ts
  • src/biometrics/shadow/service-host.ts
  • src/biometrics/shadow/service.ts
  • src/biometrics/shadow/startup.ts
  • src/biometrics/shadow/store.ts
  • src/biometrics/shadow/stream-join.ts
  • src/biometrics/shadow/submission-contracts.ts
  • src/biometrics/shadow/submission.ts
  • src/biometrics/shadow/tests/active-reader.test.ts
  • src/biometrics/shadow/tests/admission.test.ts
  • src/biometrics/shadow/tests/attempt.test.ts
  • src/biometrics/shadow/tests/build.test.ts
  • src/biometrics/shadow/tests/context.test.ts
  • src/biometrics/shadow/tests/device-identity.test.ts
  • src/biometrics/shadow/tests/fixtures/submission.ts
  • src/biometrics/shadow/tests/frame-source.test.ts
  • src/biometrics/shadow/tests/health-monitor.test.ts
  • src/biometrics/shadow/tests/host.test.ts
  • src/biometrics/shadow/tests/installed-attempt.test.ts
  • src/biometrics/shadow/tests/installed-host.test.ts
  • src/biometrics/shadow/tests/preparation.test.ts
  • src/biometrics/shadow/tests/process-cleanup.test.ts
  • src/biometrics/shadow/tests/python-installation.test.ts
  • src/biometrics/shadow/tests/runtime-binding.test.ts
  • src/biometrics/shadow/tests/service-host.test.ts
  • src/biometrics/shadow/tests/service.test.ts
  • src/biometrics/shadow/tests/startup.test.ts
  • src/biometrics/shadow/tests/store.test.ts
  • src/biometrics/shadow/tests/submission.test.ts
  • src/biometrics/shadow/tests/worker-child.test.ts
  • src/biometrics/shadow/tests/worker-protocol.test.ts
  • src/biometrics/shadow/worker-child.ts
  • src/biometrics/shadow/worker-protocol.ts
  • src/biometrics/shadow/worker-sink.ts
  • src/demo/biometrics/evaluator.ts
  • src/demo/biometrics/run.ts
  • src/demo/biometrics/stages.ts
  • src/demo/biometrics/worker-build.json
  • src/demo/biometrics/worker.ts
  • src/demo/handlers/biometric-backtests.ts
  • src/demo/handlers/biometric-datasets.ts
  • src/demo/handlers/biometric-references.ts
  • src/demo/handlers/biometric-utils.ts
  • src/demo/handlers/biometricShadow.ts
  • src/demo/handlers/biometricTuning.ts
  • src/demo/handlers/biometrics.ts
  • src/demo/handlers/index.ts
  • src/demo/handlers/sleepStages.ts
  • src/demo/tests/biometric-backtests.test.ts
  • src/demo/tests/biometric-datasets.test.ts
  • src/demo/tests/biometric-evaluator.test.ts
  • src/demo/tests/biometric-references.test.ts
  • src/demo/tests/biometric-shadow.test.ts
  • src/demo/tests/biometric-worker.test.ts
  • src/demo/tests/biometricTuning.test.ts
  • src/demo/tests/sleepStages.test.ts
  • src/mcp/README.md
  • src/mcp/server.ts
  • src/mcp/tests/server.test.ts
  • src/mcp/tools/biometrics.ts
  • src/server/instrumentation-node.ts
  • src/server/openapi.ts
  • src/server/routers/app.ts
  • src/server/routers/archivePush.ts
  • src/server/routers/biometricShadow.ts
  • src/server/routers/biometricTuning.ts
  • src/server/routers/biometrics.ts
  • src/server/routers/raw.ts
  • src/server/routers/sleepStages.ts
  • src/server/routers/tests/app.test.ts
  • src/server/routers/tests/biometricShadow.test.ts
  • src/server/routers/tests/biometricTuning.test.ts
  • src/server/routers/tests/biometrics.provenance.test.ts
  • src/server/routers/tests/biometrics.referenceStages.test.ts
  • src/server/routers/tests/biometrics.referenceVitals.test.ts
  • src/server/routers/tests/biometrics.test.ts
  • src/server/routers/tests/sleepStages.test.ts
  • src/server/tests/openapi.test.ts
  • tests/instrumentation.initialize.test.ts
  • tests/instrumentation.runtime-boundary.test.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@ng
ng force-pushed the feat/bio-cal-2-backtest branch from 7662a31 to e5d908e Compare October 13, 2026 23:35
@ng
ng force-pushed the feat/bio-cal-3-shadow-api branch 2 times, most recently from 6992227 to 94d2ea9 Compare October 13, 2026 23:56
@ng
ng force-pushed the feat/bio-cal-2-backtest branch 2 times, most recently from 02b6167 to e4eff71 Compare October 14, 2026 00:58
@ng
ng force-pushed the feat/bio-cal-3-shadow-api branch from 94d2ea9 to 2eed4dc Compare October 14, 2026 00:58
@ng
ng force-pushed the feat/bio-cal-2-backtest branch from e4eff71 to 7bc53c7 Compare October 14, 2026 01:04
@ng
ng force-pushed the feat/bio-cal-3-shadow-api branch from 2eed4dc to 95042a8 Compare October 14, 2026 01:04
@ng
ng force-pushed the feat/bio-cal-2-backtest branch from 7bc53c7 to b6088fa Compare October 14, 2026 02:37
@ng
ng force-pushed the feat/bio-cal-3-shadow-api branch 2 times, most recently from a08f64a to f67e89e Compare October 14, 2026 02:51
@ng
ng force-pushed the feat/bio-cal-2-backtest branch 2 times, most recently from c920546 to 54e0381 Compare October 14, 2026 03:34
@ng
ng force-pushed the feat/bio-cal-3-shadow-api branch 2 times, most recently from 1cfde00 to a6fb67c Compare October 14, 2026 05:11
@ng
ng force-pushed the feat/bio-cal-2-backtest branch 2 times, most recently from b86305d to 19e8c1f Compare October 14, 2026 05:45
@ng
ng force-pushed the feat/bio-cal-3-shadow-api branch from a6fb67c to 13d60df Compare October 14, 2026 05:45
@ng
ng force-pushed the feat/bio-cal-2-backtest branch from 19e8c1f to b925d8f Compare October 14, 2026 05:57
@ng
ng force-pushed the feat/bio-cal-3-shadow-api branch from 13d60df to 143a346 Compare October 14, 2026 05:57
Base automatically changed from feat/bio-cal-2-backtest to dev October 14, 2026 06:10
@ng
ng force-pushed the feat/bio-cal-3-shadow-api branch from 143a346 to 338aabe Compare October 14, 2026 06:12
@ng
ng enabled auto-merge October 14, 2026 06:12
@ng
ng added this pull request to the merge queue Oct 14, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 14, 2026
@ng
ng added this pull request to the merge queue Oct 14, 2026
Merged via the queue into dev with commit d5dd2dd Oct 14, 2026
17 of 27 checks passed
@ng
ng deleted the feat/bio-cal-3-shadow-api branch October 14, 2026 06:48
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