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(andX-Puls-Protocolheader) 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.mdis 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.x | 0.2.x | 0.3.x |
|---|---|---|---|
| 1.4 | syncs | syncs; per-device tokens work (the app just sends the token) | syncs |
| 1.5, 1.6 | syncs; pairing links and QR codes | syncs | syncs; the viewer's "Connect this iPhone" code pairs through a link or the camera |
| Web sign-in pairing | syncs | syncs | syncs; 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 inserver/api/openapi.json(embedded in theapibinary, served at/openapi.jsonas before) and gains tags, a sharedErrorschema, 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)./demosigns anyone into one shared, view-only account holding sample data, for two hours, recording no IP address or browser;make web-democreates the account. Every route that changes an account refuses it, and/demonever replaces a session the browser already holds. No schema change. Seeweb/README.md, "Demo account".
Changed#
- Sign-ups are a waitlist (accounts mode,
WEB_SIGNUPS)./signupreads 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./adminlists the waitlist oldest first. Undecided requests are no longer deleted after 30 days:020_waitlist_retention.sqlreplacesauth.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_appit 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 ALLran as a parallel plan that TimescaleDB 2.29 answers without that half. metric_dailytakes 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.sqlis re-applied bymigrateon the nextdocker 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
.envstill holding thechange-meplaceholder from.env.examplefor a token or a database role password (see Security below). Generate real values (openssl rand -hex 32); an install made byscripts/bootstrap.shalready has them. TRUST_PROXY_HEADERS,PULS_ALLOW_SHARED_TOKENorPULS_MULTI_USERset to anything buttrue/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
apiservice given aPULS_TIME_ZONEother than the one themigrateservice stored on the database (puls_time_zone()). Compose hands every service the same.env, so this only happens to anapirun 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 newweb_approle, which reads health data only through per-user security-barrier views (schemaweb), filtered on the user that every health query's transaction now sets. Sessions in a__Host-cookie with only a hash stored, scrypt passwords, anOrigincheck 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_URLandTRUST_PROXY_HEADERS=true; seeweb/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/adminpage, which emails the person an invite. Signed-in people connect their own iPhone from their account page (a pairing code shown once, fromWEB_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. Migration016_web_signups.sqladds the request table, theSECURITY DEFINERfunctions 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 psshows them; the Go images answer their ownhealthchecksubcommand, having no shell). The MCP server waits for a healthy API. -
GET /v1/usersreports the API'stimeZone, and the MCP server takes its zone from there whenPULS_TIME_ZONEis unset (Compose no longer passes it). -
/adminshows how many requests wait, with Decline selected and Decline all shown. -
An optional
tunnelCompose 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: DENYand aPermissions-Policy; pages arenoindex. -
Every pairing path ends in a QR code, and none needs
qrencode.ingest qrrenders a terminal QR code in pure Go from a payload on stdin (never argv — the payload carries the token).scripts/bootstrap.shfalls back to it through the running ingest container when the host has noqrencode, and still never fails a bootstrap over a QR code. -
devices issueprints the Server URL, the pairing QR code and thepuls://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 fromPULS_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-qrprints the text alone. -
scripts/bootstrap.sh --issue-device <label> [--user <uuid>] [--url <URL>], wrapped asmake issue-device NAME='My iPhone': one command that mints a per-device token, derives the URL by the pairing block's own rules (--lanincluded) and ends in a scannable code.--print-urlprints 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 emptyPULS_TOKEN) the pairing block names the--issue-devicecommand to run instead of printing no code at all. - The host
qrencodecall 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_ZONEdiffers from the database'spuls_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/typesis 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
localDateis dated by its own time-zone offset when the line carries one. -
migrateholds an advisory lock for the whole run:make migrateduringdocker compose up -dwaits 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.shpinsPULS_VERSIONto 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 inteston the quoted label. -
make restoredrops the viewer'sauthandwebschemas along withpublic: left in place,pg_restorestopped atschema "auth" already existswithpublicalready 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
nextfield could be pointed off-site as/<tab>/example.com. -
restore.shstops 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 suggestsdocker compose down -v, which deletes thebackupsvolume 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-Forentry, 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_IDlists 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 withRetry-Afterbeyond 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_SIZEsets the viewer's connection pool (default 4). - Releases: only a
v*tag onmainis published as a release, andlatestmoves 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, usecf-connecting-ip). - The
ingestrole holds an exact, asserted grant list: nothing onschema_migrations, the views or the viewer's schemas, noDELETEondevice_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-IDmay be absent or equal, anything else is 403 before the body is read. Everybatchesrow now records which device wrote it (device_token_id, NULL for the shared token) and the per-batch log line carriestoken_id. Migration014_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
userargument below ride on it). Every/v1route takes an optionaluser=<uuid>query parameter; absent, the request is answered forPULS_USER_IDexactly as before.GET /v1/userslists the users the deployment answers for — name, e-mail,createdAt,lastSync,batches,uploadedSamplesfrom thebatcheslog — plusdefaultandmultiUser./openapi.jsondescribes the parameter on every scoped operation. PULS_MULTI_USER(.env, defaultfalse) decides whetheruser=may name anyone but the default. Off, another user is 403multi-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 staticPULS_API_TOKEN— the tokendocs/ai.mdsays 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 auserargument on every tool;PULS_USER_IDpins an instance to one person (PULS_MCP_USER_IDfor the Compose service). Needs the product API'suserparameter and/v1/users(SRV-11). GET /v1/summary?range=7d|14d|30d|90don 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=jsonfor the numbers. The MCP server exposes it asget_summary(AI-6).
Changed#
PULS_TOKENis optional.PULS_ALLOW_SHARED_TOKEN(defaulttrue) turns the shared token off once every phone has its own; emptyPULS_TOKENdoes the same. Ingest logs its auth mode at startup and warns when nothing at all could authenticate.scripts/bootstrap.shandmake pairingaccept 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
grafanarole loses SELECT ondevice_tokens(revoked by099_read_roles.shon every run). - The
api_readerrole gains SELECT onbatches(for/v1/users; the table holds no credential). No operator action:099_read_roles.shre-runs on the nextdocker 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
POSTplus optional read endpoints, specified indocs/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
migrateservice runs before every app service ondocker compose up -d, records each file inschema_migrationswith a checksum, refuses an edited or missing applied file, and requires an explicitbaselinefor a database that predates it. - A one-command quickstart.
scripts/bootstrap.shgenerates the secrets, starts the stack and prints the pairing QR;makewraps the rest.--lantrades 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/exportstreams CSV or JSONL;tools/puls-exportis 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.jsonis rendered from the SwiftHealthTypeCatalog, 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
/healthzon 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
NOTICEandTRADEMARK.md,SECURITY.md,CONTRIBUTING.mdwith 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.