Skip to content

feat(THU-448): App version management: track device versions and enforce minimum version (BACKEND)#985

Open
arienemaiara wants to merge 2 commits into
mainfrom
THU-448/backend
Open

feat(THU-448): App version management: track device versions and enforce minimum version (BACKEND)#985
arienemaiara wants to merge 2 commits into
mainfrom
THU-448/backend

Conversation

@arienemaiara

@arienemaiara arienemaiara commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Note

Low Risk
Additive nullable column and config flag with server-side validation; enforcement remains on the client unless paired with frontend changes.

Overview
Adds device app version tracking and optional minimum version configuration for clients.

A migration adds nullable app_version on powersync.devices. On PowerSync token requests, the server reads X-App-Version (trimmed, max 32 chars), persists it via device upsert, and ignores oversized values. Omitting the header leaves any existing version unchanged. app_version is treated as server-managed: PowerSync upload PATCH cannot set it.

MIN_APP_VERSION is wired through settings and exposed on unauthenticated GET /config as minAppVersion, omitted when unset so clients can treat missing values as no enforcement. Tests cover config wiring, token persistence, header validation, and upload stripping.

Reviewed by Cursor Bugbot for commit 22112bd. Bugbot is set up for automated code reviews on this repo. Configure here.

- Add app_version column to devices and persist X-App-Version on token issue
- Cap header at 32 chars; leave column untouched when header is absent
- Surface minAppVersion via GET /config (omitted when unset) for client-side enforcement
@arienemaiara arienemaiara changed the title feat(THU-448): track device app version and expose minAppVersion (BACKEND) feat(THU-448): App version management: track device versions and enforce minimum version (BACKEND) Jun 15, 2026
@github-actions

Copy link
Copy Markdown

Semgrep Security Scan

No security issues found.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 19b1bd2. Configure here.

Comment thread backend/src/db/powersync-schema.ts
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

PR Metrics

Metric Value
Lines changed (prod code) +27 / -3
JS bundle size (gzipped) 🟢 682.3 KB → 682.1 KB (-192 B, -0.0%)
Test coverage 🟢 78.09% → 78.09% (+0.0%)
Performance (preview) Preview not ready — Render deploy may have timed out
Accessibility
Best Practices
SEO

Updated Mon, 15 Jun 2026 19:21:43 GMT · run #1889

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown

Preview environment deployed 🚀

Service URL
Marketing / blog / docs https://thunderbolt-pr-985.preview.thunderbolt.io
App https://app-pr-985.preview.thunderbolt.io
API https://api-pr-985.preview.thunderbolt.io
Keycloak https://auth-pr-985.preview.thunderbolt.io
PowerSync https://powersync-pr-985.preview.thunderbolt.io

Stack: preview-pr-985 · Commit: 22112bdffd3c903c0d1b1376eab0fc7430cb821f

Auto-destroys on PR close/merge. Login via the bundled Keycloak realm — demo@thunderbolt.io / demo by default.

- Server manages devices.app_version via X-App-Version header on requests
- Add app_version to PowerSync upload deny list so clients can't override it
- Test confirms PATCH strips app_version while letting other fields through
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