Commit Graph

311 Commits

Author SHA1 Message Date
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
saravanakumardb1
652a8e5d15 fix(platform-service): missing cosmos containers + NaN guard in cross-product limit
- cosmos-init.ts: add onboarding_events + onboarding_completions containers
  (onboarding repository references them but they were never registered)
- telemetry cross-product route: parseInt(limit) could produce NaN when
  given non-numeric input — now clamps to 1-100 with default 20
2026-03-19 22:20:31 -07:00
saravanakumardb1
4e7401d164 test(platform-service): add broadcast + survey module tests — 43 tests
Broadcasts (23 tests): schema validation, targeting engine (segments,
platform, version range, country, specific users, percentage rollout),
query builder, context extraction.

Surveys (20 tests): schema validation (create, update, question, answer,
triggers), completion rate, answer type validation (NPS, text, rating,
dropdown, scale, ranking), length/range constraints.
2026-03-19 22:16:28 -07:00
saravanakumardb1
0352ea5383 feat(platform-service): pre-built Stripe checkout flow (Phase 4.4) — 6 tests
New modules/billing-checkout/ — higher-level POST /billing/checkout with:
- Zod-validated input (plan OR explicit priceId)
- Tax collection support (automatic_tax)
- Customer email pre-fill
- Arbitrary metadata passthrough
- Trial period and promo code support
- 6 tests: plan, priceId, missing both, invalid plan, optional fields, URL validation
2026-03-19 22:10:32 -07:00
saravanakumardb1
0e880fd40d feat(platform-service): shared onboarding analytics module (Phase 4.3) — 8 tests
New modules/onboarding/ with standard pattern (types → repository → routes):
- POST /onboarding/step — track step completion (any auth)
- POST /onboarding/complete — track onboarding completion (any auth)
- GET /onboarding/funnel — funnel conversion rates (admin)
- GET /onboarding/user/:userId — user progress (admin)
- Cosmos containers: onboarding_events, onboarding_completions
- Funnel: per-step unique users, conversion rates, avg duration
- 8 tests: schema validation, funnel, date filter, user progress, empty product
2026-03-19 22:07:03 -07:00
saravanakumardb1
d900df3dc8 feat(platform-service): cross-product telemetry endpoint (Phase 4.2) — 6 tests
GET /telemetry/cross-product?products=a,b,c — admin-only endpoint for
multi-product telemetry comparison:
- Per-product summary: totalEvents, errorEvents, errorRate, topModules, platforms
- Daily event counts per product (for stacked bar charts)
- Top error clusters across products (merged + sorted by count)
- Date range filtering via from/to query params
- 6 tests: summary, daily breakdown, clusters, date filter, unknown product, limit
2026-03-19 22:04:00 -07:00
saravanakumardb1
1fe1e75999 feat(platform-service): auto-registration on first request (Phase 4.1) — 8 tests
Zero-touch product provisioning: when a request arrives with an unknown
productId and a valid JWT, auto-create a minimal ProductDoc instead of
rejecting. Enables new products to use platform-service immediately.

- auto-register.ts: auto-create ProductDoc with sensible defaults
- Rate limited: max 10 auto-registrations per minute
- Requires valid JWT (unauthenticated requests still rejected)
- Audit logged as product.auto_registered
- request-context.ts: exported extractProductIdAsync with auto-register
- 8 tests: register, duplicate, format validation, rate limit
2026-03-19 22:00:57 -07:00
saravanakumardb1
0f299231cc feat(platform-service): declarative YAML module loader (4.4) — 34 tests
New files:
- src/lib/declarative-schema.ts — YAML schema + Zod validation
  - ModuleSchema, FieldSchema, EndpointSchema
  - fieldToZodSchema, buildCreateSchema, buildUpdateSchema, defaultEndpoints

- src/lib/declarative-loader.ts — runtime route generator
  - parseModuleYaml, registerModuleRoutes, loadDeclarativeModules
  - MemoryStore with filtering, sorting, pagination
  - Auth enforcement (none/user/admin), custom endpoint support

- src/lib/declarative-loader.test.ts — 34 tests
  - Schema validation, field conversion, endpoint generation
  - MemoryStore CRUD, route integration with full lifecycle

Dependency: yaml (npm)
2026-03-19 21:16:58 -07:00
saravanakumardb1
6ba86e0bf4 fix: replace corepack pnpm with pnpm in pretest/predev scripts
Node 25 removed corepack as a built-in. Replace all 'corepack pnpm'
invocations with direct 'pnpm' calls since pnpm is installed globally.

Affected: platform-service, tracker-web, blob, testing, LLM dashboard
2026-03-19 19:57:16 -07:00
saravanakumardb1
16dc1c4a79 feat(platform-service): overhaul module generator with auto-patching
- Rewrote gen-module.ts to match actual codebase patterns
- Repository uses getRegisteredContainer from @bytelyst/cosmos
- Routes use req.jwtPayload?.sub for auth (not req.user)
- Routes register with explicit /name paths under /api prefix
- Auto-patches cosmos-init.ts with container definition
- Auto-patches server.ts with import + route registration
- Proper parenthesis-aware field splitter for enum(a,b,c)
- Test template generates per-field validation tests
- Checks for existing module directory before overwriting
- Pascal/camel case helpers handle hyphenated module names
- Dry-run shows auto-patch previews
2026-03-19 19:52:06 -07:00
saravanakumardb1
1ad8660dd8 fix(platform): fix 2 type errors found in typecheck sweep
- api-key-auth.ts: Record<string, unknown> → FilterMap (import from @bytelyst/datastore)
- reviews/notifications.ts: raw subject/html/text → templateId + variables (match dispatchEmail signature)
2026-03-19 19:02:57 -07:00
saravanakumardb1
548f7199bf fix(extraction-service): fix QueueJob generic type mismatch in createJob
enqueue() returns QueueJob<TPayload, unknown> since no result exists at
enqueue time. mapQueueJob expects ExtractionJobResult. Cast at the call
site since newly enqueued jobs have undefined result and all accesses
use optional chaining.
2026-03-19 18:12:34 -07:00
root
e996962b64 feat(mcp-server): add team provisioning follow-up hooks 2026-03-15 09:59:35 +00:00
root
8976caa966 feat(mcp-server): add org review follow-up hooks 2026-03-15 09:56:04 +00:00
root
7c5999ce5a feat(mcp-server): wire a2a governance hooks 2026-03-15 09:51:00 +00:00
root
d93ada4037 docs(config): align rate limit settings 2026-03-15 09:42:42 +00:00
root
e4bff5a2fe feat(platform-service): add support case management foundation 2026-03-15 09:39:20 +00:00
root
14346fbd5d feat(ratelimit): back api throttles with datastore 2026-03-15 09:37:03 +00:00
root
8b99b7a9a7 feat(platform-service): add scim provisioning foundation 2026-03-15 09:36:27 +00:00
root
66d0bf53a9 feat(platform-service): add shared knowledge foundation 2026-03-15 09:33:17 +00:00
root
728d8f2484 feat(platform-service): add ai budget governance 2026-03-15 09:30:16 +00:00
root
3f06427038 feat(platform-service): add agent evaluation governance 2026-03-15 09:26:40 +00:00
root
8d78b6ce59 feat(api-key): audit security events 2026-03-15 09:24:01 +00:00
root
2f7163b856 feat(api-key): restrict job operations to service tokens 2026-03-15 09:08:38 +00:00
root
95261acb92 feat(api-key): log auth and throttling rejects 2026-03-15 09:06:51 +00:00
root
798c1b9fad feat(platform-service): add agent registry foundation 2026-03-15 09:05:39 +00:00
root
473b7310d5 fix(tokens): tighten machine credential issuance 2026-03-15 06:28:50 +00:00
root
57abfa5b03 feat(api-key): add per-product throttling 2026-03-15 06:26:42 +00:00
root
8240f6060d feat(api-key): restrict ops routes to service tokens 2026-03-15 06:24:08 +00:00
root
d1b3faae8b fix(tokens): issue machine-ready defaults 2026-03-15 06:19:48 +00:00
root
eac633e1e7 fix(api-key): enforce machine token policy 2026-03-15 06:16:15 +00:00
root
507f0fdd1f feat(tokens): classify machine credentials 2026-03-15 06:09:42 +00:00
root
3398d1400f feat(platform-service): add human review queue 2026-03-15 06:08:23 +00:00
root
33c5a5a5ce feat(platform-service): add org workspace foundation 2026-03-15 06:03:08 +00:00
root
841d2f5129 fix(api-key): enforce requested product binding 2026-03-15 06:01:17 +00:00
root
daec38faf7 feat(a2a): persist incident pipeline runs 2026-03-15 05:58:15 +00:00
root
07e9475b70 fix(tokens): align api token storage with cosmos partitioning 2026-03-15 05:57:34 +00:00
root
a76b932502 feat(platform-service): add durable run tracking 2026-03-14 16:08:07 +00:00
root
885ee2d504 feat(events): add durable event bus worker path 2026-03-14 16:02:40 +00:00
root
8de22f9f22 feat(platform-service): allow scoped api keys on webhook routes 2026-03-14 15:38:42 +00:00
root
da744ab116 feat(platform-service): allow scoped api keys on ops routes 2026-03-14 14:58:08 +00:00
root
0ad6703961 feat(platform-service): add api key auth context and throttling guard 2026-03-14 14:55:23 +00:00
root
7616901683 test(workspace): harden service bootstrap and sync coverage 2026-03-14 06:40:10 +00:00
root
2b4fccb744 feat(queue): add durable worker runtime and extraction integration 2026-03-14 06:25:10 +00:00
root
91885f0d4f Add Mailpit-backed prototype email sandbox 2026-03-14 06:16:28 +00:00
root
a27a822fc2 Add prototype storage diagnostics and smoke test 2026-03-14 06:06:35 +00:00