Commit Graph

79 Commits

Author SHA1 Message Date
saravanakumardb1
9a5e93bf05 feat(nomgap): add social-fasting + meal-log modules (47 tests, 2 Cosmos containers) 2026-02-28 00:37:46 -08:00
saravanakumardb1
5e8f133816 feat(webhooks): add webhook subscriptions module — 15 event types, HMAC signing, retry delivery 2026-02-28 00:27:32 -08:00
saravanakumardb1
b4237acaa2 feat(chronomind): add routines, households, shared-timers modules (88 new tests, 847 total) 2026-02-28 00:05:18 -08:00
saravanakumardb1
c1a1f86cd6 feat(timers): add timer CRUD endpoints for ChronoMind cloud sync (42 new tests, 759 total) 2026-02-27 23:48:31 -08:00
saravanakumardb1
1744bcf63f feat(api): NomGap fasting modules — sessions CRUD + stats, 14 built-in protocols + custom CRUD, body stages + autophagy confidence (47 new tests, 717 total) 2026-02-27 22:32:28 -08:00
saravanakumardb1
ca70a05e1d feat(flags): add region, osVersion targeting to feature flags
- Add OsVersionRange interface + Zod schema (platform, minVersion?, maxVersion?)
- Add regions[] and osVersions[] to FeatureFlagDoc, CreateFlagSchema, UpdateFlagSchema
- Add compareVersions() helper for dot-separated semver comparison
- Extend GET /flags/poll with ?region and ?osVersion query params
- Region targeting: flag only returned if client region is in flag's regions list
- OS version targeting: per-platform min/max version range filtering
- Add 10 new tests (schema validation, compareVersions edge cases)
- 634 tests passing, tsc clean
2026-02-17 20:53:48 -08:00
saravanakumardb1
51e2ecdec8 test(telemetry): Phase 3 regression tests — UpdateClusterSchema, ClusterStatusEnum, extractClientIp (614→624 tests) 2026-02-17 11:24:59 -08:00
saravanakumardb1
788ee57935 docs(telemetry): update routes doc comment with all 14 endpoints 2026-02-17 11:23:38 -08:00
saravanakumardb1
08b9642408 fix(telemetry): 3 bugs — Slack Block Kit text key, cluster reopen clears resolution, affectedInstallIds uses correct ID 2026-02-17 11:22:13 -08:00
saravanakumardb1
0bfd4bdf22 feat(telemetry): geo distribution endpoint (GET /telemetry/geo) with Cosmos GROUP BY aggregation 2026-02-17 11:13:55 -08:00
saravanakumardb1
61c919a916 feat(telemetry): Phase 3 — policy preview endpoint (count matching clients from recent events) 2026-02-17 10:59:13 -08:00
saravanakumardb1
2f61ea517c feat(telemetry): Phase 3 — geo enrichment, Prometheus metrics export endpoint 2026-02-17 10:56:19 -08:00
saravanakumardb1
80a4459f81 docs: update documentation 2026-02-17 10:49:14 -08:00
saravanakumardb1
2fb341048e feat(telemetry): Phase 3 — rate limiting, batch dedup, ETag config caching (614 tests) 2026-02-17 10:24:07 -08:00
saravanakumardb1
20f77d5a50 test(telemetry): add route-logic tests — containsPII, computePk, normalizeMessage, fingerprint, policyMatch, mergePolicies (34→77 tests) 2026-02-17 09:42:57 -08:00
saravanakumardb1
ce4c4ff53d feat(telemetry): add telemetry module — ingest, config, query, clusters, policies (34 tests) 2026-02-17 09:06:43 -08:00
saravanakumardb1
18a5b342d9 fix(request-context): block sunset products in public productId resolver 2026-02-16 23:45:17 -08:00
saravanakumardb1
b0e8304d59 test(server): update @bytelyst/config mock for loadProductIdentity 2026-02-16 23:28:52 -08:00
saravanakumardb1
c7480661eb fix(waitlist): harden public endpoints and unsubscribe validation
- Block sunset products on public waitlist join/count/config endpoints
- Verify unsubscribe email matches unsubscribeToken before status change
- Keep idempotent join behavior explicit for existing entries (200 path)
- Escape CSV newline/carriage-return values to prevent malformed exports
- Refactor request productId extraction to shared helper in request-context
- Guard prelaunchConfig merge with safe default object in products update route
2026-02-16 23:28:32 -08:00
saravanakumardb1
6a996cc11d test(waitlist): add 45 unit tests + update doc checkboxes with commit links
- 45 tests: schema validation, email normalization, status transitions, route exports
- Update Phase 1, 2, 3, 4 checkboxes in PRE_LAUNCH_SIGNUP_SYSTEM.md with commit SHAs
- Add webhook env vars to .env.example
2026-02-16 22:49:42 -08:00
saravanakumardb1
2692c918ce feat(waitlist): add pre-launch waitlist module (types, repo, routes)
- Create waitlist/types.ts: WaitlistEntryDoc, Zod schemas for join/status/unsubscribe/admin
- Create waitlist/repository.ts: full CRUD, dedup by emailNormalized, position assignment, stats
- Create waitlist/routes.ts: 5 public endpoints + 7 admin endpoints with role guard
- Add waitlist container to cosmos-init.ts (+ 13 previously missing containers)
- Add dispatchWaitlistJoined webhook to webhooks.ts
- Register waitlistRoutes in server.ts
- Public: join, check status, count, config, unsubscribe
- Admin: list, stats, get, update, delete, batch invite, CSV export
2026-02-16 22:45:14 -08:00
saravanakumardb1
66e657a646 feat(products): extend product status lifecycle + prelaunch config
- Add 6 product statuses: draft, pre_launch, beta, active, sunset, disabled
- Add PrelaunchConfig with customFields, CAPTCHA, tagline, maxSignups
- Add isValidStatusTransition() helper for safe status changes
- Update getRequestProductId() to block draft/sunset/disabled
- Add getRequestProductIdForPublic() for pre_launch waitlist routes
- Add status transition validation to product update route
- Add PRE_LAUNCH_SIGNUP_SYSTEM.md design doc with full roadmap
2026-02-16 22:36:53 -08:00
saravanakumardb1
209213b50d test(server): cover platform bootstrap wiring and hooks 2026-02-16 15:25:27 -08:00
saravanakumardb1
1df94103ea test(cosmos): add init path coverage for platform-service 2026-02-16 15:22:38 -08:00
saravanakumardb1
e3f173c164 test(config): add env schema coverage for platform-service 2026-02-16 15:20:04 -08:00
saravanakumardb1
9fbaf60ba8 test(platform-service): add route coverage for items invitations audit 2026-02-16 15:00:13 -08:00
saravanakumardb1
7179f1e7c4 test(platform-service): add promos route-level tests 2026-02-16 12:46:40 -08:00
saravanakumardb1
e4ee23aab4 test(platform-service): add comments route-level tests 2026-02-16 12:43:56 -08:00
saravanakumardb1
3e1647ae96 test(platform-service): add tokens route-level tests 2026-02-16 12:41:34 -08:00
saravanakumardb1
dc0cf6d8b4 test(platform-service): add referrals route-level tests 2026-02-16 12:38:42 -08:00
saravanakumardb1
783b9792df test(platform-service): add memory route-level tests 2026-02-16 12:36:27 -08:00
saravanakumardb1
8576fe2e91 test(platform-service): add route tests for settings, votes, and public modules 2026-02-16 12:33:17 -08:00
saravanakumardb1
c7934af227 test(platform-service): add subscriptions route-level tests — 395 tests, 39.6% stmts 2026-02-16 12:17:00 -08:00
saravanakumardb1
1cb9af3ae4 test(platform-service): add usage route-level tests — 386 tests, 37.9% stmts 2026-02-16 12:15:40 -08:00
saravanakumardb1
149d97dd9f test(platform-service): add route-level tests for plans + notifications — 379 tests, 35.4% stmts 2026-02-16 12:14:42 -08:00
saravanakumardb1
87f7d76915 test(platform-service): add products, cache, votes repository tests — 362 tests, 32.6% stmts 2026-02-16 12:08:40 -08:00
saravanakumardb1
747d89fe4d test(platform-service): add repository tests for settings, referrals — 336 tests, 30.64% coverage 2026-02-16 12:05:03 -08:00
saravanakumardb1
fbb2197f7c test(platform-service): add repository tests for notifications, plans, subscriptions, usage, tokens, memory + fix extraction-service flaky test 2026-02-16 11:59:06 -08:00
saravanakumardb1
7524c4d29e feat(platform-service): add GET /settings/kill-switch public endpoint
- No auth required — mobile apps call this at launch before login
- Reads kill_switch feature flag from Cosmos DB
- If flag enabled=true → returns disabled:true with maintenance message
- Fail-open: DB errors allow app to run normally
- Response: { enabled: bool, disabled: bool, message: string }

Used by iOS KillSwitchService.swift and Android KillSwitchService.kt
2026-02-15 21:30:03 -08:00
saravanakumardb1
5622499575 feat(licenses): add POST /licenses/revoke endpoint
Sets license status to 'revoked' and clears all device activations.
Returns the updated license doc. Idempotent — already-revoked licenses
return immediately.
2026-02-15 20:15:10 -08:00
saravanakumardb1
972a1a21d7 feat(usage): cross-product usage queries + product breakdown
- Make productId optional in repository list() — omitting it queries all products
- Add resolveProductFilter() helper: productId=_all skips filter, specific value overrides default
- Add ProductBreakdown interface for per-product aggregation
- Summary endpoint now returns productBreakdown[] alongside model/source breakdowns
- Enables admin to compare John's LysnrAI usage vs MindLyst usage
2026-02-15 19:47:23 -08:00
saravanakumardb1
1cf74d22fa feat(usage): add source/platform tracking + source breakdown in summary
- Add optional 'source' field to UsageDoc (desktop/web/ios/android)
- Add 'source' to UpsertUsageSchema validation
- Include source in upsert document ID to avoid cross-platform overwrites
- Add SourceBreakdown interface
- Aggregate sourceBreakdown in GET /usage/summary alongside modelBreakdown
- Clients can now pass source when reporting usage for per-app analytics
2026-02-15 18:57:16 -08:00
saravanakumardb1
b977e85bc2 feat(platform-service): add profile updates, tokens, and themes modules
Auth:
- PUT /auth/profile — self-service profile update (displayName, phone, bio, avatarUrl)
- ProfileUpdateSchema added to types.ts
- Repository update() expanded to accept profile fields

Tokens module (new):
- GET /tokens — list tokens (admin: all, user: own)
- POST /tokens — create API token (admin only)
- GET /tokens/count — count active tokens
- PATCH /tokens/:id — revoke token (admin only)
- DELETE /tokens/:id — delete token (super_admin only)

Themes module (new):
- GET /themes — list all themes (admin only)
- POST /themes — create theme (admin only)
- GET /themes/active — get active theme (public, no auth)
- GET /themes/:id — get theme by id (admin only)
- PUT /themes/:id — update theme (admin only)
- DELETE /themes/:id — delete theme (admin only)
- POST /themes/:id/activate — set theme as active (admin only)
2026-02-15 17:29:43 -08:00
saravanakumardb1
be3f5459bd feat(platform-service): add SSO login endpoint (/auth/sso)
- POST /auth/sso — accepts verified email + provider + productId
- Creates user if not exists (with subscription + license provisioning)
- Issues platform JWT tokens for existing SSO users
- Supports Microsoft and Google OAuth providers
- Added SsoLoginSchema to types.ts
2026-02-15 16:38:10 -08:00
saravanakumardb1
c7fb2eb357 feat(platform-service): add admin user management routes
- GET /auth/users — list users (paginated, admin-only)
- GET /auth/users/count — total + by-plan counts
- GET /auth/users/:id — get user by id
- PUT /auth/users/:id — update user (displayName, role, plan, status)
- DELETE /auth/users/:id — delete user
- repository: added list, count, countByPlan, update, remove functions
- types: added UpdateUserSchema
2026-02-15 16:21:26 -08:00
saravanakumardb1
aaf7ec5b59 fix(licenses): add deviceName and platform to ActivateLicenseSchema
Desktop and mobile clients send deviceName and platform in the activate
payload. Without these fields in the schema, they were silently stripped
by Zod. Now accepted as optional fields for contract alignment.
2026-02-15 15:41:52 -08:00
saravanakumardb1
daccbaea6c fix(stripe): remove dead syncUserPlan call to deleted backend /api/users/:userId/plan route
The Python backend users.py route was deleted in the backend cleanup.
Plan updates are already handled by authRepo.updatePlan() inline in
each webhook handler — the syncUserPlan fetch was redundant dead code.
2026-02-15 15:40:42 -08:00
saravanakumardb1
8a7a0495b0 test(platform-service): add route-level tests for Phase 1 migration behaviors
- Added auth register route tests for default provisioning and best-effort fallback
- Added license activate route tests for token issuance, product device limits, and lockout
- Added Stripe webhook route tests for any-product fallback and plan normalization
- Verified: tsc --noEmit clean, 23 test files / 189 tests passing
2026-02-15 15:09:23 -08:00
saravanakumardb1
b987dec92c fix(platform-service): make Stripe webhook product routing resilient
- Added cross-product fallback lookup by stripeCustomerId when metadata lacks productId
- Ensure invoice payments are stored under the resolved subscription productId
- Normalize checkout metadata plan value before persistence/sync
- Keep auth plan sync aligned with resolved product context
- Verified: tsc --noEmit clean, 20 test files / 183 tests passing
2026-02-15 15:01:02 -08:00
saravanakumardb1
a699dd9073 fix(platform-service): harden register/stripe flows for multi-product correctness
- Make auth register provisioning truly best-effort (warn on failure, do not fail signup)
- Process Stripe webhook events for all products (remove non-default skip)
- Derive updated subscription plan from Stripe price IDs on subscription.updated
- Sync derived plan to auth users and backend plan sync endpoint
- Verified: tsc --noEmit clean, 20 test files / 183 tests passing
2026-02-15 14:59:27 -08:00