Commit Graph

812 Commits

Author SHA1 Message Date
saravanakumardb1
8af997ba0f docs(devops): update stale mywisprai/MyWisprAI branding across 5 AKV docs
- BytelystAI → ByteLyst in titles
- MyWisprAI → LysnrAI (legacy) for wispr-* secret references
- Added 'legacy resource name' annotations to Azure resource names
  (kv-mywisprai, cosmos-mywisprai, etc. cannot be renamed)
- Updated dashboard paths (admin-web moved to dashboards/)
- Fixed telemetry role name: mywisprai-admin → lysnrai-admin
- Updated last-updated dates to 2026-03-21

Files: AZURE_KEY_VAULT_AND_SECRETS_ROTATION.md,
AZURE_PORTAL_SETUP.md, AZURE_RESOURCE_INVENTORY.md,
ENVIRONMENT_VARIABLES_AND_KEYVAULT_AUDIT.md,
END_TO_END_ENCRYPTION_ROADMAP.md
2026-03-21 09:15:30 -07:00
saravanakumardb1
5b2c6f2874 docs: add cross-repo automation playbook reference to AGENTS.md and CLAUDE.md 2026-03-21 09:11:48 -07:00
saravanakumardb1
2e35334e13 docs(devops): add coding agent automation playbook
- 11 cross-repo automation tasks for AI coding agents
- Workspace hygiene, test suites, coverage gaps, typecheck, deps, secrets
- Baseline test counts: 1,457 backend + 864 web = 2,321 total
- Priority matrix, quick-start commands, existing workflow references
2026-03-21 09:04:35 -07:00
saravanakumardb1
af5684587d docs(devops): fix 14 bugs/gaps in E2EE design + roadmap after codebase review 2026-03-21 09:01:35 -07:00
saravanakumardb1
b6a1d637fb docs(devops): add E2EE design document and implementation roadmap 2026-03-21 08:51:43 -07:00
saravanakumardb1
6856d23a2e fix(swift-sdk): resolve BLAuditLogger + BLCrashReporter build errors in ByteLystPlatform
- BLAuditLogger is an enum (static API) — cannot be constructed; use .Type reference + configure()
- BLCrashReporter is @MainActor — defer construction to start() via Task { @MainActor }
2026-03-20 23:28:47 -07:00
saravanakumardb1
2eadf480dc docs: Add post-implementation review fixes section to roadmap
Systematic review found 7 bugs across 7 repos:
1. LysnrAI Android: SettingsStore.kt incorrectly deleted (ada3d43)
2. Android kill switch: result.killed → result.disabled (3 repos)
3. Auth App iOS: BLKillSwitchClient.check() returns Void (215e7c9)
4. ChronoMind iOS: nonexistent BLKillSwitchResult (d3c3aff)
5. MindLyst iOS: KillSwitch + CrashReporter wrong API (cd78597)
6. JarvisJr iOS: KillSwitchResponse decoded 'killed' not 'disabled' (2a3cc7e)
7. NoteLett Mobile: createDiagnosticsClient doesn't exist (0b5c224)
2026-03-20 23:16:19 -07:00
saravanakumardb1
76e05f836a docs: Update MOBILE_DRY_REFACTORING_ROADMAP with all 9 phases completed
Phases 1-9 complete with commit links and checked boxes:
- Phase 1: ChronoMind Android (2060a83)
- Phase 2: JarvisJr Android (336535a)
- Phase 3: FlowMonk Mobile RN (ce70d8c)
- Phase 4: LysnrAI Android (24a09a2) — 11 dead services deleted
- Phase 5: NomGap RN (63bd34b) — billingFetch replaced
- Phase 6: LysnrAI iOS (862e981) — 5 dead services deleted
- Phase 7: Auth App Android (5b65215) — telemetry/flags/killswitch added
- Phase 8: Auth App iOS (4a84050) — telemetry/flags/killswitch added
- Phase 9A: ChronoMind iOS (c328216) — Config + KillSwitch wrappers
- Phase 9B: NoteLett Mobile (c2d6414) — diagnostics-client added
- Phase 9C: MindLyst iOS (dce9e22) — Config + KillSwitch + CrashReporter
- Phase 9D: JarvisJr iOS — no changes needed (sync manager active)

Total: ~2,700 lines of dead code removed across 6 repos.
13 TODOs logged for build verification and deferred migrations.
2026-03-20 22:53:26 -07:00
saravanakumardb1
ac63116528 docs: mark Cross-Repo DRY Migration roadmap as COMPLETE (all 5 phases)
- Phase 4 (Web Client DRY) completed: createWebTelemetry + createWebDiagnostics
- 6 web apps migrated, all typechecks + tests pass
- product-config.ts standardization deferred (risk > ROI)
2026-03-20 18:58:31 -07:00
saravanakumardb1
b9e37bb8b4 feat(telemetry-client,diagnostics-client): add createWebTelemetry + createWebDiagnostics convenience factories
- telemetry-client: createWebTelemetry() wraps createTelemetryClient() with web defaults
- diagnostics-client: createWebDiagnostics() wraps DiagnosticsClient with install ID + web defaults
- Eliminates ~70 lines of boilerplate per web app
- 11/11 telemetry tests pass, 21/21 diagnostics tests pass
2026-03-20 18:47:18 -07:00
saravanakumardb1
470661e274 docs: mark Phase 3 complete, Phase 4 deferred in DRY migration roadmap 2026-03-20 08:06:37 -07:00
saravanakumardb1
0d8c0a5ffe feat(backend-flags,backend-telemetry): create shared flag registry + telemetry buffer packages
- @bytelyst/backend-flags: createFlagRegistry() with defaults, 6 tests
- @bytelyst/backend-telemetry: createTelemetryBuffer() with enabled switch, 5 tests
2026-03-20 08:02:17 -07:00
saravanakumardb1
08661bbd97 feat(backend-config): create @bytelyst/backend-config package with shared Zod schema
- baseBackendConfigSchema: PORT, HOST, NODE_ENV, CORS_ORIGIN, SERVICE_NAME,
  DB_PROVIDER, COSMOS_*, JWT_SECRET, PLATFORM_JWKS_URL
- parseBackendConfig() helper for env parsing
- Products extend via baseBackendConfigSchema.extend({...})
- 8 tests passing
2026-03-20 07:51:22 -07:00
saravanakumardb1
f5d64d58ce docs: mark Phase 0+1 complete in DRY migration roadmap with commit hashes 2026-03-20 07:48:24 -07:00
saravanakumardb1
ea2cb4c0e6 fix(fastify-auth): support getter functions for jwtSecret/jwksUrl
Allows dynamic config resolution (e.g. test mocks that change config between calls).
Options can now be string | (() => string) for both jwtSecret and jwksUrl.
2026-03-20 07:38:26 -07:00
saravanakumardb1
f61a1f0b04 feat(fastify-auth): create @bytelyst/fastify-auth package with JWT auth + request context
- createAuthMiddleware(): RS256 JWKS + HS256 fallback (parameterized)
- createRequestContext(): productId validation + getUserId()
- Fastify request type augmentation for jwtPayload
- 15 tests passing
2026-03-20 07:30:53 -07:00
saravanakumardb1
d10322095a docs: fix 10 inaccuracies in DRY audit + roadmap after thorough review
Verified claims against actual codebase. Key corrections:

Audit (CROSS_REPO_DRY_AUDIT.md):
- Fix #5: all 9 repos already use @bytelyst/datastore — issue is only
  DB_PROVIDER missing from config.ts in 3 older repos (not a full migration)
- Fix #6: only 3 repos have product-config.ts (not 4) — NomGap was wrong
- Fix #11: web telemetry.ts is in NomGap+NoteLett+ChronoMind+LysnrAI (not JarvisJr)
- Fix #12: web diagnostics.ts includes LysnrAI user-dashboard-web (5 repos total)
- Fix auth.ts LOC: exactly 79 lines × 9 repos = 711 (was '60-90')
- Fix request-context.ts LOC: 30-49 lines range (was '~30-50')
- Fix package count: 50 packages (not 53)
- Add items 15-16: web auth.ts + billing-client.ts (noted as keep-as-is)
- Fix LOC math: ~2,700 total (was inflated ~4,200)
- Add cosmos-init.ts note (5 repos, product-specific, not consolidation candidates)

Roadmap (CROSS_REPO_DRY_MIGRATION_ROADMAP.md):
- Phase 0.2: 6 repos need product-config.ts (add NomGap)
- Phase 2.3: rewritten from 'migrate to datastore' to 'add DB_PROVIDER to config'
- Phase 4: add LysnrAI user-dashboard-web to affected repos, remove JarvisJr from telemetry
- Fix product-config.ts template path (was ../../../../, now ../../../ with depth note)
- Fix success metrics: packages 50→55, product-config 3→9, LOC ~1,760
- Fix overview table: Phase 2 name, Phase 4 repo count
2026-03-20 07:15:07 -07:00
saravanakumardb1
a769f671e2 docs: cross-repo DRY audit + end-to-end migration roadmap
- CROSS_REPO_DRY_AUDIT.md: identified 14 duplication patterns across
  9 product backends + web clients (~4,200 LOC duplicated)
- CROSS_REPO_DRY_MIGRATION_ROADMAP.md: 5-phase execution plan with
  concrete file lists, migration steps, verification checkpoints,
  rollback strategy, and success metrics
- Phase 0: quick wins (delete errors.ts re-exports, standardize product-config)
- Phase 1: @bytelyst/fastify-auth (auth + request-context for 9 repos)
- Phase 2: @bytelyst/backend-config + datastore migration for 3 older repos
- Phase 3: backend-flags, backend-telemetry, domain-events (FlowMonk + ActionTrail)
- Phase 4: web client DRY (telemetry, diagnostics, product-config conveniences)
- Estimated: 11 days, 5 new packages, ~3,260 LOC eliminated
2026-03-20 07:04:46 -07:00
saravanakumardb1
10c288857d fix(support-cases): prevent auto-triage from regressing case status
- Auto-triage previously always set status to 'triaged', even for cases
  already in in_progress, escalated, or other later states
- Now only transitions to 'triaged' if case is still in 'open' state
- Cases in later states keep their current status (only priority + tags update)
- Added regression test for in_progress case
- 10 support-cases tests passing
2026-03-20 06:25:43 -07:00
saravanakumardb1
78cb958a6d fix(ai-budgets): tighten rollover period filter to exclude stale entries
- Previous filter only checked e.recordedAt < currentPeriodStart
- Now also checks e.recordedAt >= prevPeriodStart (lower bound)
- Prevents entries from periods before the previous one from inflating
  the spent amount, which would reduce the rollover incorrectly
- 12 ai-budgets tests passing
2026-03-20 06:24:13 -07:00
saravanakumardb1
f3a4d915f5 fix(support-cases): prevent crash when auto-triage encounters undefined tags
- supportCase.tags is optional in SupportCaseDoc schema
- Spreading undefined throws TypeError at runtime
- Fixed both [...supportCase.tags] and .includes() call with ?? [] fallback
- Added regression test for undefined tags case
- 9 support-cases tests passing
2026-03-20 06:23:34 -07:00
saravanakumardb1
63322a2d07 docs(roadmap): mark P3 Platform Deepening as complete with commit links
All 6 phases implemented, 58 new tests (1,278 → 1,336):
- Phase 1: 15e24e5 — Event Bus + Worker Runtime (15 tests)
- Phase 2: 84dc348 — Agent Runtime Orchestration (14 tests)
- Phase 3: 05acacd — AI Budget & Cost Governance (9 tests)
- Phase 4: 9758192 — AI Governance & Evals (8 tests)
- Phase 5: a060ee4 — Human Review Queue (7 tests)
- Phase 6: 0bbae1f — Support Case Management (5 tests)
2026-03-20 03:39:48 -07:00
saravanakumardb1
0bbae1f14e feat(platform): Phase 6 — Support Case Management
- Case timeline: GET /support/cases/:id/timeline
  - Merges case creation, notes, escalations chronologically
- SLA engine: GET /support/cases/:id/sla
  - Priority-based SLA targets (critical=1h/4h, high=4h/24h, etc.)
  - First-response and resolution breach detection
- Auto-triage: POST /support/cases/:id/auto-triage
  - Keyword-based priority heuristics (outage→critical, error→high, etc.)
  - Category detection (auth, billing, api)
  - Deduped tag application
- Case metrics: GET /support/metrics
  - Aggregates by status/priority/source
  - Avg resolution hours, SLA breach count, compliance rate
- New repo function: listAllCases
- 1,336 tests passing (5 new)
2026-03-20 03:38:08 -07:00
saravanakumardb1
a060ee4496 feat(platform): Phase 5 — Human Review Queue
- Batch decisions: POST /reviews/batch-decision (up to 50 items)
  - Parallel execution with allSettled, reports succeeded/failed counts
- Delegation: POST /reviews/:id/delegate
  - Reassigns review with delegation metadata tracking
  - Triggers notification to new assignee
- Auto-expiry: POST /reviews/expire
  - Scans pending/assigned reviews past dueAt, marks expired
- Review stats: GET /reviews/stats
  - Aggregates by status/priority/category, avg resolution time
  - Computes pendingCount, overdueCount, avgResolutionHours
- New repo functions: listExpired, listAll
- 1,331 tests passing (7 new)
2026-03-20 03:33:55 -07:00
saravanakumardb1
9758192377 feat(platform): Phase 4 — AI Governance & Evals
- Run history: GET /agent-evals/suites/:id/runs with limit param
- Regression comparison: GET /agent-evals/suites/:id/regression
  - Detects 5%+ score drop between consecutive runs
  - Returns latest vs previous comparison + trend data
- Release gate check: GET /agent-evals/suites/:id/gate
  - Checks if latest release-gate run passed threshold
- Agent compliance report: GET /agent-evals/agents/:agentId/report
  - Aggregates pass rate, avg score, suite counts, recent runs
- Eval scheduling: POST /agent-evals/suites/:id/schedule
  - Wires eval suite to job runner with cron expression
- New repo functions: listRunsBySuite, listRunsByAgent
- 1,324 tests passing (8 new)
2026-03-20 03:30:03 -07:00
saravanakumardb1
05acacd400 feat(platform): Phase 3 — AI Budget & Cost Governance
- Scope expansion: BudgetScopeTypeSchema now includes 'org' + 'workspace'
- Cost dashboard: GET /ai-budgets/costs with groupBy (model/agent/day/scope)
  - Aggregates totalCostUsd, totalTokens, entryCount, breakdown
- Budget rollover: POST /ai-budgets/policies/:id/rollover
  - Computes previous period remaining, creates rollover doc, adjusts budget
  - GET /ai-budgets/policies/:id/rollovers for history
- Enforcement check: POST /ai-budgets/check (pre-flight, no spend recorded)
  - Model allowlist + threshold evaluation, returns verdict + reasons
- New types: CostDashboardQuerySchema, BudgetRolloverSchema
- New repo functions: listAllSpendEntries, createRollover, listRollovers
- New Cosmos container: ai_budget_rollovers
- 1,316 tests passing (9 new)
2026-03-20 03:26:23 -07:00
saravanakumardb1
84dc348687 feat(platform): Phase 2 — Agent Runtime Orchestration
- New: agents/executor.ts — full agent execution engine
  - Multi-step pipeline: prompt_assembly → tool_execution → finalize
  - AbortController-based cancellation with in-memory tracking
  - Token usage aggregation across tool calls
  - Review-required tool gating (pauses run, returns review_required)
  - Step event streaming for SSE consumers
- New: agents/tool-registry.ts — global tool registry
  - Register/list/validate tools with risk levels + review flags
- New: agents/executor-routes.ts — 11 endpoints, 14 tests
  - POST /agents/execute, POST /runs/:id/cancel
  - GET /agents/active-runs, GET /runs/:id/children, GET /runs/:id/tree
  - GET /agents/:id/metrics, GET /runs/:id/stream (SSE)
  - GET /tools, POST /tools/validate, POST /agents/:id/schedule
- Enhanced: runs/repository.ts — added listChildRuns() for DAG query
- 1,307 tests passing (14 new)
2026-03-20 03:20:31 -07:00
saravanakumardb1
15e24e5710 feat(platform): Phase 1 — Durable Event Bus + Worker Runtime
- New module: event-subscriptions/ (types, repository, routes, 15 tests)
  - Subscription CRUD: create/list/get/update/delete event subscriptions
  - DLQ: list/retry/delete/purge dead-letter queue entries
  - Event replay: POST /events/replay by topic + time range
- New lib: event-dispatcher.ts — subscription-driven dispatch with retry + DLQ
- New lib: event-store-bridge.ts — persistent event log for replay capability
- Worker runtime hardening (jobs/runner.ts):
  - Concurrency limit (MAX_CONCURRENT_JOBS=5)
  - Stuck-job recovery (10min threshold)
  - Graceful shutdown (30s drain)
  - Active job tracking + diagnostics (getActiveJobs/getActiveJobCount)
  - Per-job dedup (skip if already running)
- Wired dispatcher + event-subscriptions into server.ts startup
- Cosmos containers: event_subscriptions, event_dlq, event_log
- 1,293 tests passing (15 new)
2026-03-20 03:12:54 -07:00
saravanakumardb1
17f5671595 docs(roadmap): P3 platform deepening roadmap — reviewed and audited
- 6 phases: Event Bus, Agent Runtime, AI Budget, AI Evals, Reviews, Support Cases
- 7-sprint mapping (14 weeks) with parallelization opportunities
- Cross-referenced all claims against actual codebase — 15 bugs/gaps found and fixed:
  - DurableEventBus already exists in @bytelyst/events (not just in-memory)
  - jobs/ has 25 tests (not 6), support-cases/ has 4 (not 3)
  - ai-budgets already has verdict engine (252 LOC), alert generation, model allowlists
  - BudgetScopeType only supports product+agent (not org/workspace yet)
  - reviews/notifications.ts already has notifyReviewAssigned()
  - Phase 2 effort overflowed (17d in 15d sprint) — rebalanced
  - Test baseline corrected to 1,278 (not 1,308)
  - Identified Cosmos QueueStore gap as critical path for Phase 1
  - ai-diagnostics has 5,235 LOC but 0 tests — flagged as risk
- Estimated ~138 new tests bringing total to ~1,416
2026-03-20 01:20:49 -07:00
saravanakumardb1
9e510f7b49 test(scim): add 7 tests for stats, pause, resume, delete endpoints
- routes.test.ts: add mock functions for deleteConnector, getConnectorStats
- 7 new tests: stats endpoint, pause active, pause rejects non-active,
  resume paused, resume rejects non-paused, delete paused, delete rejects active
- Total: 11 SCIM tests (was 4)
2026-03-20 01:06:07 -07:00
saravanakumardb1
28b6668fb1 fix(knowledge): align searchChunks scoring with routes, add 5 new tests
- repository.ts: searchChunks now includes tag matching (+2 per tag hit)
  consistent with scoreChunk() in routes.ts
- routes.test.ts: add 5 new tests — stats endpoint, delete draft base,
  reject non-draft delete, delete source, search chunks
- Total: 9 knowledge tests (was 4)
2026-03-20 01:04:32 -07:00
saravanakumardb1
036d17d8f0 fix(agents): use NotFoundError for missing resources, add deprecate+published tests
- routes.ts: use NotFoundError (404) instead of BadRequestError (400)
  for missing agent by key and missing published version
- routes.test.ts: fix expectation for unknown key (400→404),
  add 4 new tests: deprecate success, deprecate already-deprecated guard,
  GET published success, GET published 404 when none
- Total: 13 agent tests (was 8)
2026-03-20 01:02:36 -07:00
saravanakumardb1
5f294b30b0 docs: update workspace review — all P0/P1/P2 items completed with commit links
- P0: typecheck sweep (0 errors), integration verified, roadmap hygiene (8c3d540)
- P1: analytics deepened (1efbb93), cloud SDK + declarative loader already done
- P2: orgs RBAC (0195cde), agents (ae87371), knowledge (20663d7), SCIM (d073122)
- 4 items deferred to product-level: iOS keyboard, create-app publish, ChronoMind, auth-ui
- Full test sweep: 1,262 tests pass across 114 files
2026-03-20 00:46:42 -07:00
saravanakumardb1
d073122a48 feat(scim): deepen SCIM provisioning — stats, delete, pause/resume
- repository.ts: add ScimConnectorStats interface, getConnectorStats (user/group/event counts),
  deleteConnector
- routes.ts: 4 new endpoints — GET /scim/connectors/:orgId/:id/stats,
  DELETE /scim/connectors/:orgId/:id (must be paused first),
  POST /scim/connectors/:orgId/:id/pause, POST /scim/connectors/:orgId/:id/resume
- Existing 4 tests unchanged, typecheck clean
2026-03-20 00:44:49 -07:00
saravanakumardb1
20663d7078 feat(knowledge): deepen Knowledge/RAG — search, stats, delete endpoints
- repository.ts: add searchChunks (term-based text search with scoring),
  getBaseStats (source/chunk/token counts), deleteSource, deleteBase
- routes.ts: 4 new endpoints — GET /knowledge/bases/:id/stats,
  DELETE /knowledge/bases/:id (draft only), DELETE /knowledge/bases/:id/sources/:sourceId,
  POST /knowledge/bases/:id/search (text search with previews)
- Existing 4 tests unchanged, typecheck clean
2026-03-20 00:42:12 -07:00
saravanakumardb1
ae87371b3a feat(agents): deepen agent registry — version lifecycle, lookup by key, delete
- repository.ts: add getAgentByKey, updateAgentVersion, getPublishedVersion, deleteAgent
- routes.ts: 5 new endpoints — GET /agents/by-key/:key, GET /agents/:id/published,
  POST /agents/:id/versions/:vId/publish (auto-deprecates previous),
  POST /agents/:id/versions/:vId/deprecate, DELETE /agents/:id (draft only)
- routes.test.ts: 6 new tests (8 total) — publish lifecycle, deprecate guard,
  key lookup, delete draft-only guard
- repository.test.ts: 1 existing test unchanged
2026-03-20 00:39:24 -07:00
saravanakumardb1
0195cde1c0 feat(orgs): deepen Org/Workspace RBAC — role hierarchy, permissions, delete endpoints
- types.ts: add ROLE_HIERARCHY (owner>admin>member>viewer), ROLE_PERMISSIONS matrix (11 permissions),
  hasPermission() and canManageRole() helpers
- repository.ts: add deleteMembership, getUserMembership, deleteOrganization, deleteWorkspace
- routes.ts: 4 new endpoints — DELETE /orgs/:id (owner only), DELETE /orgs/:id/workspaces/:wsId,
  DELETE /orgs/:id/memberships/:mbrId (RBAC enforced), GET /orgs/:id/permissions
- RBAC enforcement: role update checks actor outranks target, cannot remove owner, cannot
  assign role >= own level
- routes.test.ts: 6 new tests (8 total) — owner-only delete, member removal RBAC,
  permissions endpoint, non-member handling
- repository.test.ts: 1 existing test unchanged
2026-03-20 00:36:02 -07:00
saravanakumardb1
1efbb9340d feat(analytics): deepen analytics rollups — aggregation, summary dashboard, top metrics
- types.ts: add AggregateRollupsSchema, SummaryQuerySchema, TopMetricsSchema, AnalyticsSummary
- repository.ts: add aggregateDailyToWeekly, aggregateDailyToMonthly (merge daily rollups)
- repository.ts: add getSummary (trend + top metrics over N days), getTopMetrics (per-date)
- routes.ts: 3 new endpoints — POST /analytics/aggregate, GET /analytics/summary, GET /analytics/top-metrics
- analytics.test.ts: 11 new tests (25 total) for aggregate, summary, top-metrics schemas
- Existing 14 tests unchanged
2026-03-20 00:30:07 -07:00
saravanakumardb1
b52ace83d0 ci: update CI/CD configuration 2026-03-20 00:26:26 -07:00
saravanakumardb1
8c3d54048a docs: reorganize roadmaps — broadcast/survey to completed, 10 scaffolded roadmaps to new dir
- Move platform_BROADCAST_SURVEY_ROADMAP.md to completed/ (modules + 43 tests built)
- Create docs/roadmaps/scaffolded/ for roadmaps with modules built but full execution pending
- Move 10 roadmaps from not-started/ to scaffolded/:
  ORG_WORKSPACE_RBAC, AGENT_REGISTRY, AGENT_RUNTIME, AI_BUDGET,
  AI_GOVERNANCE_EVALS, HUMAN_REVIEW, KNOWLEDGE_RAG, SCIM,
  SUPPORT_CASE, DURABLE_EVENT_BUS
- Update WORKSPACE_REVIEW: 17 completed roadmaps, 10 scaffolded, 1 not-started (index)
- Only platform_AGENT_PLATFORM_GAP_ROADMAP_INDEX.md remains in not-started/
2026-03-20 00:25:36 -07:00
saravanakumardb1
a8bef2ea08 docs: sync workspace review with actual code state — post-audit update
- platform-service: 37 → 62 modules, 1020 → 1239 tests, 23 → 53 packages
- Mark completed: Platform Acceleration (4 phases), CDN, Search, Dunning,
  Tenants, Retention, Backups, API Versioning, A/B Testing, Impersonation,
  Predictive Analytics, AI Diagnostics, Broadcasts, Surveys
- Add scaffolded roadmaps section (11 modules with types/repo/routes/tests)
- Update maturity score: 91 → 97/100
- Update priority list: 13 items moved from TODO to DONE
- Accurate counts: 75 routes, 131 Cosmos containers, ~3,492 total tests
2026-03-20 00:02:08 -07:00
saravanakumardb1
3a14f87814 chore(platform-service): wire P2+P3 modules into server + cosmos-init
- server.ts: register cdnRoutes, searchRoutes, dunningRoutes (P2)
- server.ts: register tenantRoutes, retentionRoutes, backupRoutes, apiVersioningRoutes (P3)
- cosmos-init.ts: 17 new containers across 7 modules:
  CDN: cdn_assets, cdn_purge_requests, cdn_origin_configs
  Search: search_index, search_suggestions
  Dunning: dunning_campaigns, dunning_policies
  Tenants: tenants, tenant_members, tenant_invites
  Retention: retention_policies, retention_jobs
  Backups: backups, restores, backup_configs
  API Versioning: api_versions, api_version_pins
- Total platform-service modules: ~41, tests: 1239
2026-03-19 23:50:38 -07:00
saravanakumardb1
946390f378 feat(api-versioning): add API versioning — lifecycle, pins, deprecation
- types.ts: ApiVersionDoc, ClientVersionPinDoc + 4 Zod schemas
- repository.ts: version CRUD, client pin CRUD, active version lookup
- routes.ts: 10 endpoints (version lifecycle, current, pins CRUD)
- api-versioning.test.ts: 13 schema tests
- draft → active → deprecated → sunset lifecycle
- Client version pinning with auto-upgrade scheduling
- Cosmos containers: api_versions, api_version_pins
2026-03-19 23:50:23 -07:00
saravanakumardb1
b5c83b1874 feat(backups): add backup/restore module — on-demand + config
- types.ts: BackupDoc, RestoreDoc, BackupConfigDoc + 3 Zod schemas
- repository.ts: backup/restore CRUD, config singleton per product
- routes.ts: 9 endpoints (backup CRUD, restore, history, config)
- backups.test.ts: 11 schema tests
- Supports full/incremental/selective types with expiry
- Cosmos containers: backups, restores, backup_configs
2026-03-19 23:50:09 -07:00
saravanakumardb1
c638555069 feat(retention): add data retention policies — policy CRUD, enforce, jobs
- types.ts: RetentionPolicyDoc, RetentionJobDoc + 2 schemas + getCutoffDate helper
- repository.ts: policy CRUD, enabled policies query, job audit trail, stats
- routes.ts: 7 endpoints (policy CRUD, enforce with dry-run, job history, stats)
- retention.test.ts: 12 schema + helper tests
- Supports delete/archive/anonymize actions with configurable date fields
- Cosmos containers: retention_policies, retention_jobs
2026-03-19 23:49:56 -07:00
saravanakumardb1
33e5fd70ce feat(tenants): add multi-tenant module — tenant CRUD, members, invites
- types.ts: TenantDoc, TenantMemberDoc, TenantInviteDoc + 4 Zod schemas
- repository.ts: tenant CRUD, member CRUD, invite lifecycle, slug uniqueness
- routes.ts: 10 endpoints (tenant CRUD, invite, accept, member role, remove)
- tenants.test.ts: 16 schema + plan-limits tests
- Plan limits: free(5), starter(25), pro(100), enterprise(10k) members
- SHA-256 hashed invite tokens with 7-day expiry
- Cosmos containers: tenants, tenant_members, tenant_invites
2026-03-19 23:49:41 -07:00
saravanakumardb1
797f5e4318 feat(dunning): add billing dunning module — campaigns, policies, retries
- types.ts: DunningCampaignDoc, DunningPolicyDoc + 3 Zod schemas + helpers
- repository.ts: campaign CRUD, policy management, retry scheduling
- routes.ts: 11 endpoints (campaign lifecycle, policy CRUD, retry, grace period)
- dunning.test.ts: 20 schema + helper tests (getNextRetryTime, isGracePeriodExpired)
- Configurable retry schedules, grace periods, auto-downgrade
- Campaign status lifecycle: active → resolved/escalated
- Cosmos containers: dunning_campaigns, dunning_policies
2026-03-19 23:49:25 -07:00
saravanakumardb1
e9cb6b2a38 feat(search): add full-text search module — index, query, suggestions
- types.ts: SearchIndexDoc, SearchSuggestion + 3 Zod schemas
- repository.ts: index/remove entities, search with CONTAINS, prefix suggestions
- routes.ts: 6 endpoints (search, suggest, index entity, reindex, delete by type:id)
- search.test.ts: 15 schema validation tests
- Parameterized queries (no manual quote escaping)
- Composite doc ID format: entityType:entityId
- Cosmos containers: search_index, search_suggestions
2026-03-19 23:49:02 -07:00
saravanakumardb1
7b43a02126 feat(cdn): add CDN asset pipeline module — upload, purge, origin config
- types.ts: CdnAsset, PurgeRequest, OriginConfig + 3 Zod schemas
- repository.ts: asset CRUD, purge request tracking, origin config management
- routes.ts: 9 endpoints (asset upload/list/get/delete, purge, origin config CRUD)
- cdn.test.ts: 15 schema validation tests
- Supports categories (image/video/font/script/style/document/other)
- SHA-256 content hash tracking, size limits, TTL-based purge requests
- Cosmos containers: cdn_assets, cdn_purge_requests, cdn_origin_configs
2026-03-19 23:47:59 -07:00
saravanakumardb1
4071429871 fix(platform-service): fix OFFSET/LIMIT pairing, survey analytics productId, unused imports
- broadcasts/repository: fix OFFSET/LIMIT must be paired (Cosmos SQL requires both)
- broadcasts/repository: remove unused TargetingContext import
- surveys/repository: fix OFFSET/LIMIT in listSurveys + listResponsesForSurvey
- surveys/repository: fix getSurveyAnalytics to accept and pass productId
- surveys/repository: fix isComplete boolean param cast for Cosmos SDK types
- surveys/routes: fix parseInt safety for limit/offset query params (NaN guard)
- surveys/routes: pass productId to getSurveyAnalytics call
2026-03-19 23:47:43 -07:00