All docs

Project

Changelog

Source: CHANGELOG.md on GitHub · edit this page · Plain Markdown

What changed in each release of the server stack — the four images ghcr.io/pulshealth/{ingest,api,mcp,web}, which share one version that PULS_VERSION in .env selects. Before upgrading, back up the database and read the target release's operator notes below. Keep the checkout and image version together: Compose files and migrations come from the checkout. Follow the upgrade procedure, or Server setup for a new installation.

Two things are versioned separately and are not in this file:

  • The iOS app, which ships on its own schedule through the App Store. Its record is docs/appstore/README.md § Release record.
  • The Puls Sync Protocol, whose schemaVersion (and X-Puls-Protocol header) moves only for a change a v1 receiver would reject. A server release that adds an optional field or a new read endpoint keeps the protocol number where it is; docs/protocol/README.md is the contract.

The format follows Keep a Changelog, and releases are semver over the stack: a major for a change that needs operator action (a breaking config or schema change), a minor for features, a patch for fixes. While the stack is on 0.x that promise is weaker by convention — a minor may carry a change that needs operator action, and when it does this file says so at the top of the entry.

Compatibility#

Every server release so far speaks protocol v1 and every app release since self-hosted sync (1.4) sends v1, so any app version syncs to any server version. This means the basic v1 upload format is accepted, not that every new app feature is available on an older server. Features that need both sides say so here; entries under Unreleased are not published image releases.

App ↓ / Server →0.1.x0.2.x0.3.x
1.4syncssyncs; per-device tokens work (the app just sends the token)syncs
1.5, 1.6syncs; pairing links and QR codessyncssyncs; the viewer's "Connect this iPhone" code pairs through a link or the camera
Web sign-in pairingsyncssyncssyncs; the sign-in needs a 0.3 viewer in accounts mode with WEB_INGEST_URL set

New HealthKit type identifiers (iOS 27's Recovery HRV, for one) reach any server: ingest registers types on first sight. What a receiver must accept within v1 is in docs/protocol/README.md, "Additive changes in v1". A future protocol v2 would be a server-first upgrade: an old server answers batches it cannot read with 400, which the app does not retry, so syncing pauses (nothing is lost) until the server is updated.

Unreleased#

Added#

  • Product API documentation on pulshealth.com: a guide (docs/api.md, at /docs/api/) and an endpoint-by-endpoint reference with examples (/docs/api-reference/), rendered from the service's own OpenAPI document. That document now lives in server/api/openapi.json (embedded in the api binary, served at /openapi.json as before) and gains tags, a shared Error schema, every error status each route can return (400, 401, 403, 429, 500, 503, 504), field descriptions with units, and examples. Routes and response bodies are unchanged.
  • A public demo for the viewer (accounts mode, WEB_DEMO_USER, opt-in). /demo signs anyone into one shared, view-only account holding sample data, for two hours, recording no IP address or browser; make web-demo creates the account. Every route that changes an account refuses it, and /demo never replaces a session the browser already holds. No schema change. See web/README.md, "Demo account".

Changed#

  • Sign-ups are a waitlist (accounts mode, WEB_SIGNUPS). /signup reads as ordinary sign-up ("Create your PulsHealth account", Sign up) and then tells the person they are on the waitlist; nothing is created and no one but the operator is emailed, as before. /admin lists the waitlist oldest first. Undecided requests are no longer deleted after 30 days: 020_waitlist_retention.sql replaces auth.prune_signups, which still deletes approved requests 30 days after the decision, never-used approvals and expired sessions. The 500-pending ceiling becomes 500 new sign-ups per 24 hours and 10,000 waiting.

Fixed#

  • The viewer is fast in accounts mode. As web_app it reads through security-barrier views, which take a caller's filter only when it is leakproof; several reads joined or compared in ways that stayed outside the view and scanned every chunk: one dashboard load spent ~9.5 s in the database on a household's history. On a copy of it, on one machine, a dashboard load went from 2.4 s to ~60 ms, a type page from 2.2 s to 15–55 ms and the largest category from 4.6 s to under 0.2 s. The per-user sample counts are cached stale-while-revalidate and stream in after the page instead of holding it.
  • Today's totals covered the right day. Their bounds were read in the database session's zone (UTC), so Today ran from 10:00 the day before to 10:00 in California.
  • Sample counts include quantity samples. In accounts mode the Browse cards, the Data page and "All-time samples" left out every quantity sample: the stats query's UNION ALL ran as a parallel plan that TimescaleDB 2.29 answers without that half.
  • metric_daily takes its readers' filters. It used to build every day of every type on each read (~1 s); a read by type and day range now touches only that type (/v1/metrics/daily, Grafana and the viewer alike). Same rows; 009_metric_daily.sql is re-applied by migrate on the next docker compose up -d, no operator action.
  • Batches with many deletions are fast. Ingest deleted quantity samples one statement per row, through cached generic plans that open every chunk and skip the uuid bloom filters: on production a batch of 500+ deletions took 1.7 s at the median and up to 11.7 s, long enough for iOS to end the background wake and the app to send it again. It now deletes in a few range-bounded statements planned for their values, which decompress no more columnstore batches than before. On a test database, 1000 deletions went from ~2 s to ~0.2 s (recent or clustered samples) and from ~3.3 s to ~1.7 s (spread over three compressed years).

[0.3.0] - 2026-10-04#

Upgrading: take make backup, check out v0.3.0, set PULS_VERSION=0.3.0, then make pull up.

No operator action is required beyond the cases below, but there are schema migrations: take make backup before upgrading, as for any. 015_web_accounts.sql and 016_web_signups.sql add two schemas (auth, web), functions and views, and alter no existing table outside them, so Grafana, the product API and ingest read and write exactly as before. ingest gains a subcommand and one Go dependency; web gains an opt-in accounts mode. Nothing new is required in .env; WEB_DB_PASSWORD (which scripts/bootstrap.sh now generates) creates the web_app role that accounts mode connects as. 017_prune_ingest_rejections.sql adds a daily job that deletes rejected-batch records older than 90 days; 018_web_accounts_hardening.sql replaces four auth functions and adds one. 099_read_roles.sh now gives the ingest role an exact grant list instead of DML on every table.

Four cases do need action (each stops a service with a log line that says so, rather than misbehaving):

  • An .env still holding the change-me placeholder from .env.example for a token or a database role password (see Security below). Generate real values (openssl rand -hex 32); an install made by scripts/bootstrap.sh already has them.
  • TRUST_PROXY_HEADERS, PULS_ALLOW_SHARED_TOKEN or PULS_MULTI_USER set to anything but true/false/1/0/yes/no/on/off (or empty).
  • A table you added to the database yourself and have ingest write to: give it a row in 099_read_roles.sh's ingest list.
  • An api service given a PULS_TIME_ZONE other than the one the migrate service stored on the database (puls_time_zone()). Compose hands every service the same .env, so this only happens to an api run outside it; give both the same zone.

Added#

  • Accounts mode for the web viewer (WEB_ACCOUNTS=true): invite-only accounts (make web-invite), each person signing in with their own email and password and seeing only their own records. The database enforces it: the viewer connects as the new web_app role, which reads health data only through per-user security-barrier views (schema web), filtered on the user that every health query's transaction now sets. Sessions in a __Host- cookie with only a hash stored, scrypt passwords, an Origin check on every state change, failed sign-ins throttled like ingest's, an account page to change the password and sign browsers out, and plain HTTP refused. Needs HTTPS in front, WEB_DATABASE_URL and TRUST_PROXY_HEADERS=true; see web/README.md, "Access control". Basic and open mode are unchanged.

  • Access requests with approval (WEB_SIGNUPS=true, accounts mode): anyone can ask for an account at /signup; nothing is created — no user, no account, no sync token — until an administrator approves on the new /admin page, which emails the person an invite. Signed-in people connect their own iPhone from their account page (a pairing code shown once, from WEB_INGEST_URL), disconnect it, and delete their account; administrators disable accounts (which disconnects their phones) and purge a disabled user's data. All of it applies only to users an approved request created: the operator's household is never given a sync token, cut off from its phones or purged through the viewer, even by SQL run as its database role. Email through Amazon SES (WEB_SES_*, WEB_MAIL_FROM, WEB_ADMIN_EMAIL), off unless configured. Migration 016_web_signups.sql adds the request table, the SECURITY DEFINER functions behind every privileged step, and an hourly TimescaleDB job that deletes approved requests and never-used approvals after 30 days.

  • In accounts mode, a request that reached the viewer over plain HTTP through the trusted proxy is redirected to HTTPS instead of refused.

  • Healthchecks for ingest, the API, the MCP server and the viewer (docker compose ps shows them; the Go images answer their own healthcheck subcommand, having no shell). The MCP server waits for a healthy API.

  • GET /v1/users reports the API's timeZone, and the MCP server takes its zone from there when PULS_TIME_ZONE is unset (Compose no longer passes it).

  • /admin shows how many requests wait, with Decline selected and Decline all shown.

  • An optional tunnel Compose profile: a Cloudflare Tunnel that serves the viewer on a domain of yours with no open port (CLOUDFLARE_TUNNEL_TOKEN, COMPOSE_PROFILES=tunnel); server/README.md, "Exposing the server".

  • Every viewer response, in every mode, carries a Content-Security-Policy with a per-request script nonce, and HSTS, Referrer-Policy: same-origin, X-Content-Type-Options, X-Frame-Options: DENY and a Permissions-Policy; pages are noindex.

  • Every pairing path ends in a QR code, and none needs qrencode. ingest qr renders a terminal QR code in pure Go from a payload on stdin (never argv — the payload carries the token). scripts/bootstrap.sh falls back to it through the running ingest container when the host has no qrencode, and still never fails a bootstrap over a QR code.

  • devices issue prints the Server URL, the pairing QR code and the puls://pair?… payload for the token it minted, where it used to print a token and a user ID and nothing to scan. The URL comes from the new --url, else from PULS_PUBLIC_URL, which Compose now passes to the ingest service; a URL the app would refuse stops the command before a token is minted. --no-qr prints the text alone.

  • scripts/bootstrap.sh --issue-device <label> [--user <uuid>] [--url <URL>], wrapped as make issue-device NAME='My iPhone': one command that mints a per-device token, derives the URL by the pairing block's own rules (--lan included) and ends in a scannable code. --print-url prints just that URL.

  • One new Go module in server/ingest: github.com/skip2/go-qrcode (stdlib only). The other three images and both CLIs are unchanged.

Changed#

  • With the shared token disabled (PULS_ALLOW_SHARED_TOKEN=false, or an empty PULS_TOKEN) the pairing block names the --issue-device command to run instead of printing no code at all.
  • The host qrencode call gets its payload on stdin too, so the token no longer appears in the process list while the code is drawn.

Fixed#

  • The product API refuses to start when its PULS_TIME_ZONE differs from the database's puls_time_zone(), rather than answering every daily query on the wrong calendar.

  • Stopping the API with an export in flight aborts the export (never a cleanly closed, truncated file) instead of waiting for SIGKILL.

  • /v1/catalog/types is served from cache while one background refresh runs, so a cache miss no longer scans every hypertable on the request.

  • A ring day from a client older than localDate is dated by its own time-zone offset when the line carries one.

  • migrate holds an advisory lock for the whole run: make migrate during docker compose up -d waits instead of applying a file twice.

  • A viewer read that fails shows "Database unavailable" on that page instead of empty charts.

  • On a release checkout scripts/bootstrap.sh pins PULS_VERSION to it, and on any other it warns that the latest images may not match the checkout's schema.

  • make devices ARGS='issue --name "My iPhone"' no longer dies in test on the quoted label.

  • make restore drops the viewer's auth and web schemas along with public: left in place, pg_restore stopped at schema "auth" already exists with public already gone.

  • The viewer's return-path check refuses control characters and backslashes. Browsers strip tabs and newlines from a URL, so the user switcher's next field could be pointed off-site as /<tab>/example.com.

  • restore.sh stops the scheduled backup service while it runs (a dump taken mid-restore could become the newest backup), refuses a dump name missing from the store, and no longer suggests docker compose down -v, which deletes the backups volume holding the dump.

  • A client that stops reading an export no longer holds its slot forever: each export has a 60 s write deadline and a 30-minute ceiling.

  • A product-API query that runs out of time is a 504 asking for a narrower range, not a 500.

  • Restarting ingest with a batch in flight no longer ends in SIGKILL (stop_grace_period: 30s, inserts cancelled after shutdown).

  • The database container gets shm_size: 1g; Docker's 64 MB default fails parallel queries over a few years of samples.

Security#

  • Rate limiting behind a proxy keys on the last X-Forwarded-For entry, in ingest, the product API and the viewer. Cloudflare, nginx and Caddy append to the header, so the first entry was the client's own choice and a fresh failure bucket per request was possible.
  • Ingest, the API and the MCP server (HTTP mode) refuse a token of change-me, and the migrate service refuses it as a role password.
  • An MCP server pinned with PULS_USER_ID lists only its own user; it listed every user's name and email.
  • Ingest decodes at most PULS_MAX_INFLIGHT_BATCHES (default 4) batches at once and answers 503 with Retry-After beyond it, which the app retries.
  • Viewer passwords use scrypt N=2^16, r=8, p=2, rehashed on next sign-in, and a session ends 90 days after sign-in however often it is used. WEB_DB_POOL_SIZE sets the viewer's connection pool (default 4).
  • Releases: only a v* tag on main is published as a release, and latest moves only after all four images are published.
  • The MCP server's HTTP mode throttles failed bearer tokens like ingest and the API.
  • In accounts mode an administrator cannot disable another administrator or themselves, the database's privileged functions enforce the 90-day session cap too, undecided sign-up requests are deleted after 30 days, and at 500 waiting the form stores nothing more.
  • A stranger can no longer keep an account owner locked out by failing sign-ins as their email: a failure from an address one of the account's sessions came from is charged only to that address.
  • The viewer warns when accounts mode trusts X-Forwarded-For (behind Cloudflare, use cf-connecting-ip).
  • The ingest role holds an exact, asserted grant list: nothing on schema_migrations, the views or the viewer's schemas, no DELETE on device_tokens, no default privileges.

[0.2.0] - 2026-09-18#

Upgrading: move the checkout to v0.2.0 (git pull, or git checkout v0.2.0), set PULS_VERSION=0.2.0 (or track latest), then make pull up; migrate applies 014_device_tokens.sql and re-runs 099_read_roles.sh. No .env changes are required — the shared PULS_TOKEN keeps working exactly as before, and PULS_MULTI_USER defaults to off. The checkout step is not optional: 0.2.0's ingest records device_token_id on every batch, a column only 014 adds, so the new images on a 0.1.0 checkout answer every upload with a 500 (the app keeps its anchors and retries, so nothing is lost, but nothing syncs either).

Added#

  • Per-device tokens (make devices ARGS='issue --user <uuid> --name <label>', list, rename, revoke; SRV-8). Each is stored only as its SHA-256, bound to one user, revocable on its own and stamped with its last use. A request that presents one acts as that user: X-User-ID may be absent or equal, anything else is 403 before the body is read. Every batches row now records which device wrote it (device_token_id, NULL for the shared token) and the per-batch log line carries token_id. Migration 014_device_tokens.sql.
  • Per-request user scoping on the product API (SRV-11, the API side; the web viewer's switcher and the MCP server's user argument below ride on it). Every /v1 route takes an optional user=<uuid> query parameter; absent, the request is answered for PULS_USER_ID exactly as before. GET /v1/users lists the users the deployment answers for — name, e-mail, createdAt, lastSync, batches, uploadedSamples from the batches log — plus default and multiUser. /openapi.json describes the parameter on every scoped operation.
  • PULS_MULTI_USER (.env, default false) decides whether user= may name anyone but the default. Off, another user is 403 multi-user reads are disabled, never a quiet answer for the default user; a value that is not a UUID is 400; neither charges the auth-failure limiter. Turning it on means the one static PULS_API_TOKEN — the token docs/ai.md says to hand to a ChatGPT Action — reads every user on the server, so it stays off until you want that.
  • puls-export --user <uuid> (default $PULS_USER_ID, else none) picks whose data to export, and a 403 is explained the way a 401 is.
  • web: a user switcher when the database holds more than one user; ?user=<uuid> picks one (SRV-11).
  • MCP: list_users, and a user argument on every tool; PULS_USER_ID pins an instance to one person (PULS_MCP_USER_ID for the Compose service). Needs the product API's user parameter and /v1/users (SRV-11).
  • GET /v1/summary?range=7d|14d|30d|90d on the product API: the last N calendar days as one short markdown page (activity, heart, sleep, workouts, body, coverage) for pasting into a chat that has no MCP connection; format=json for the numbers. The MCP server exposes it as get_summary (AI-6).

Changed#

  • PULS_TOKEN is optional. PULS_ALLOW_SHARED_TOKEN (default true) turns the shared token off once every phone has its own; empty PULS_TOKEN does the same. Ingest logs its auth mode at startup and warns when nothing at all could authenticate. scripts/bootstrap.sh and make pairing accept that mode instead of dying on an empty token.
  • A device-token lookup that fails because the database is unreachable is 503 authentication unavailable, never 401, and is not charged to the auth-failure limiter; neither is a 403 user mismatch.
  • The grafana role loses SELECT on device_tokens (revoked by 099_read_roles.sh on every run).
  • The api_reader role gains SELECT on batches (for /v1/users; the table holds no credential). No operator action: 099_read_roles.sh re-runs on the next docker compose up -d.
  • web: Next.js 16.3.5 (from 16.3.4).

[0.1.0] - 2026-09-14#

The first tagged release, and the one that first publishes ghcr.io/pulshealth/{ingest,api,mcp,web} — before it, a compose install had nothing to pull and had to build from the checkout. Everything below shipped together; there is no earlier release to diff against.

Added#

  • The Puls Sync Protocol, v1. One gzipped NDJSON POST plus optional read endpoints, specified in docs/protocol/ with JSON Schemas, a fixture corpus with expected outcomes, an offline schema checker (tools/protocol-check) and a Python reference receiver. The receiver's smoke test doubles as a conformance runner against any implementation: smoke_test.py --url <url> --token <token>.
  • The reference backend. Go ingest and product API over PostgreSQL 17 / TimescaleDB, with Grafana dashboards for the data and for ingest health. Ingest is idempotent per sample UUID, upserts aggregates and activity rings, and connects as a scoped DML-only role rather than the superuser.
  • Schema migrations that apply themselves. The migrate service runs before every app service on docker compose up -d, records each file in schema_migrations with a checksum, refuses an edited or missing applied file, and requires an explicit baseline for a database that predates it.
  • A one-command quickstart. scripts/bootstrap.sh generates the secrets, starts the stack and prints the pairing QR; make wraps the rest. --lan trades TLS for a phone on the same Wi-Fi, on request only.
  • Read-only MCP server (server/mcp), 11 tools over the product API in stdio and streamable-HTTP modes, so Claude Desktop, Claude Code, Cursor and ChatGPT can answer questions from the data. It never touches Postgres.
  • Export. GET /v1/export streams CSV or JSONL; tools/puls-export is a dependency-free CLI over it.
  • Product API endpoints an analyst asks for first: daily sleep, bounded raw samples, workout series, state of mind, activity rings, daily metrics that resolve the iPhone/Watch double-count.
  • One type vocabulary. docs/protocol/catalog.json is rendered from the Swift HealthTypeCatalog, and the web catalog is generated from the JSON, so the two published lists cannot drift.
  • Self-hosting safety rails. Auth-failure rate limiting on both ingest and the product API (failed attempts only, never successful ones), a /healthz on each that answers from a two-second cache rather than the pool, an optional password on the web viewer, loopback binds by default, and an opt-in backup service with a documented restore drill.
  • Open-source hygiene. Apache-2.0 with NOTICE and TRADEMARK.md, SECURITY.md, CONTRIBUTING.md with DCO sign-off, a code of conduct, issue and PR templates, AGENTS.md, llms.txt, and a CI gate that fails on owner-specific content in tracked files.