learning_ai_common_plat/docs/WORKSPACE_TODO_AUDIT.md
saravanakumardb1 6f03a74a76 feat(platform-service): resolve P2 TODOs — exports, broadcasts, telemetry, waitlist
- telemetry/repository: group upsertEventsBatch by pk — same-partition
  writes sequential, different partitions parallel (reduces contention)
- exports/routes: wire async export processing via process.nextTick —
  queries users/audit/telemetry/usage/subscriptions/licenses, serializes
  to CSV or JSON, updates job status with rowCount and fileSizeBytes
- broadcasts/repository: replace mock estimateTargetReach with real user
  count query from auth module, respects percentageRollout
- broadcasts/routes: wire async broadcast delivery — fetches target users,
  dispatches email per recipient, updates metrics on completion
- waitlist/routes: auto-generate invitation codes via invitations module
  when batch-inviting waitlist entries (WL-XXXXXXXX format, 14-day trial)
- CAPTCHA (item 12) deferred — requires external API keys
- Update WORKSPACE_TODO_AUDIT.md — P2 section: 5/6 resolved
- Typecheck clean, 1483/1483 tests pass
2026-03-22 00:41:11 -07:00

152 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Workspace TODO / Disabled Feature Audit
> **Generated:** 2026-03-22
> **Scope:** All 15 workspace repos — platform-service, dashboards, packages, 9 product backends + webs
> **Method:** Automated grep scan for `TODO`, `FIXME`, `HACK`, disabled features, stubs, `console.log`
---
## Executive Summary
| Area | Actionable TODOs | False Positives | Priority Items |
| ------------------------------ | :--------------: | :---------------: | :------------: |
| **platform-service** | **12** | 0 | 5 |
| **admin-web** | **1** | 0 | 1 |
| **tracker-web** | **1** | 0 | 1 |
| **user-dashboard-web** | **1** | 0 | 1 |
| **shared packages** | **3** | 2 (test/template) | 1 |
| **product backends** (9 repos) | **0** | 0 | 0 |
| **product webs** (9 repos) | **0** | 0 | 0 |
| **Total** | **18** | 2 | **8** |
**Verdict:** The codebase is in strong shape. All 9 product backends and webs are TODO-free. The 18 actionable items are concentrated in platform-service (the largest service with 37+ modules). Most are low-risk "wire integration" tasks that don't block core functionality.
---
## Findings by Priority
### P0 — High Impact, Low Effort (resolved)
| # | Location | TODO | Effort | Status |
| --- | ----------------------------------------- | ------------------------ | ------ | ------------------ |
| 1 | `admin-web/src/app/error.tsx:13` | Send errors to telemetry | **S** | ✅ FIXED `34c3436` |
| 2 | `tracker-web/src/app/error.tsx:13` | Send errors to telemetry | **S** | ✅ FIXED `34c3436` |
| 3 | `user-dashboard-web/src/app/error.tsx:13` | Send errors to telemetry | **S** | ✅ FIXED `4641daa` |
**Status:** All 3 resolved — wired `trackEvent('error', 'global', 'unhandled_error', ...)` with error name, message, and digest.
---
### P1 — Medium Impact, Medium Effort (resolved)
| # | Location | TODO | Effort | Status |
| --- | ------------------------------------------- | ---------------------------------------------- | ------ | -------- |
| 4 | `delivery/subscribers.ts` — payment.failed | User lookup + payment-failed email dispatch | **M** | ✅ FIXED |
| 5 | `delivery/subscribers.ts` — trial_expiring | User lookup + trial-expiring email dispatch | **M** | ✅ FIXED |
| 6 | `delivery/subscribers.ts` — trial_expired | User lookup + trial-expired email dispatch | **M** | ✅ FIXED |
| 7 | `surveys/routes.ts` — incentive fulfillment | Wire subscriptions module for pro_days/credits | **M** | ✅ FIXED |
**Status:** All 4 resolved. Added `resolveUserEmail()` helper using auth repo `getById()`. Survey incentives now extend `currentPeriodEnd` for pro_days and add `tokensIncluded` for credits via subscriptions module.
---
### P2 — Low Impact, Medium Effort (resolved)
| # | Location | TODO | Effort | Status |
| --- | ----------------------------------------------------- | ------------------------------------------------------------------------ | ------ | ----------- |
| 8 | `telemetry/repository.ts` — upsertEventsBatch | Group by pk for partition-aware batching | **M** | ✅ FIXED |
| 9 | `exports/routes.ts` — export processing | Async export via setImmediate + data source queries + CSV/JSON serialize | **L** | ✅ FIXED |
| 10 | `broadcasts/repository.ts` — estimateTargetReach | Real user count query via auth module | **M** | ✅ FIXED |
| 11 | `broadcasts/routes.ts` — broadcast delivery | Async delivery via setImmediate + dispatchEmail per user | **L** | ✅ FIXED |
| 12 | `waitlist/routes.ts` — CAPTCHA validation | Requires external API keys (Turnstile/hCaptcha) | **M** | ⏭️ DEFERRED |
| 13 | `waitlist/routes.ts` — auto-generate invitation codes | Wire invitations/repository.create() per entry | **S** | ✅ FIXED |
**Status:** 5 of 6 resolved. Item 12 (CAPTCHA) deferred — requires Turnstile/hCaptcha/reCAPTCHA API key configuration.
---
### P3 — Operational / Nice-to-Have (defer)
| # | Location | TODO | Impact if NOT Addressed | Benefit of Addressing | Effort |
| --- | --------------------------------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------- | ------------- |
| 14 | `platform-service/modules/diagnostics/subscribers.ts:123` | `// TODO: Notify admin who started the session` | Debug session cancellation doesn't notify the requesting admin | Admin gets notified when their debug session is cancelled | **S** |
| 15 | `platform-service/modules/diagnostics/subscribers.ts:154` | `// TODO: Email summary to admin who created the session` | Debug session completion doesn't send summary email | Convenience — admin gets results emailed | **S** |
| 16 | `platform-service/modules/diagnostics/subscribers.ts:210` | `// TODO: Send PagerDuty/Slack alert for on-call engineer` | FATAL logs during debug sessions don't trigger external alerts | Critical — but requires PagerDuty/Slack integration setup | **L** |
| 17 | `packages/feedback-client/src/integration.test.ts:10` | `TODO-4: Requires blob storage to be available in test environment` | Integration test skipped without blob storage | Test runs in CI with blob storage configured | **S** (infra) |
| 18 | `packages/feedback-client/src/gdpr.test.ts:138` | `TODO-7: Azure lifecycle policy purges blob within 90 days` | Blob cleanup relies on Azure lifecycle policy, not explicit deletion | Documentation / acceptance — not a code fix | **XS** |
**Recommendation:** Items 1415 are nice-to-have notifications. Item 16 (PagerDuty/Slack for FATAL logs) is important for production but requires external service integration. Items 1718 are test/infra items, not functional gaps.
---
## Items Explicitly NOT TODOs (Excluded)
These were found in scans but are **not actionable gaps**:
| Location | Content | Why Excluded |
| --------------------------------------------------- | ---------------------------------------------------------- | --------------------------------------------------------------- |
| `packages/create-app/src/lib/templates.ts:276` | `// TODO: Register your route modules here` | Template placeholder for `create-app` scaffolding — intentional |
| `packages/feedback-client/src/gdpr.test.ts:23` | `describeIntegration('GDPR Deletion Compliance (TODO-5)')` | Test suite name contains TODO — it's a label, not missing work |
| `user-dashboard-web/.../sessions/[id]/page.tsx:695` | `['list', 'todo', 'task', 'priority'...]` | String data containing the word "todo" — not a code TODO |
| All `*.test.ts` files with "mock" | Test mocks using vi.fn() / vi.mock() | Standard test pattern, not production stubs |
---
## Repos With Zero TODOs (Clean)
These backends and webs have **no actionable TODOs** — fully implemented:
| Repo | Backend | Web | Notes |
| ---------------------- | :-----: | :--: | ------------------------ |
| **ActionTrail** | ✅ 0 | ✅ 0 | Production-ready, v1.0.0 |
| **NoteLett** | ✅ 0 | ✅ 0 | MCP tools complete |
| **FlowMonk** | ✅ 0 | ✅ 0 | Scheduler complete |
| **JarvisJr** | ✅ 0 | ✅ 0 | Voice + agents |
| **ChronoMind** | ✅ 0 | — | Timers + cascades |
| **PeakPulse** | ✅ 0 | — | Adventure tracker |
| **NomGap** | ✅ 0 | — | Fasting app |
| **Local Memory GPT** | ✅ 0 | — | Local AI chat |
| **MindLyst** | ✅ 0 | — | KMP shared module |
| **LysnrAI** (backend) | ✅ 0 | — | 62 tests |
| **extraction-service** | ✅ 0 | — | Python sidecar |
| **mcp-server** | ✅ 0 | — | MCP protocol |
---
## Recommended Action Plan
### Sprint A (12 days) — Quick Wins
1. Wire telemetry `reportError()` in all 3 dashboard `error.tsx` files (~15 min)
2. Wire waitlist → invitations module for auto-generated invite codes (~30 min)
### Sprint B (35 days) — User-Facing Gaps
3. Implement user lookup helper for delivery subscribers (payment_failed, trial_expiring, trial_expired)
4. Wire survey incentive fulfillment to billing/subscriptions module
5. Wire export job processing through the jobs module
### Sprint C (deferred) — Operational Excellence
6. Implement real broadcast audience estimation query
7. Wire broadcast delivery via event bus
8. Add CAPTCHA validation to waitlist signup
9. Telemetry bulk upsert optimization
10. PagerDuty/Slack integration for FATAL diagnostic logs
---
## Methodology
**Scanned 15 repos across:**
- 3 dashboards (admin-web, tracker-web, user-dashboard-web)
- 3 services (platform-service, extraction-service, mcp-server)
- 14+ shared packages
- 9 product backends (LysnrAI, ActionTrail, NoteLett, FlowMonk, JarvisJr, ChronoMind, PeakPulse, NomGap, Local Memory GPT)
- 9 product webs
**Search patterns:** `TODO`, `FIXME`, `HACK`, `STUB`, `XXX`, `console.log`, `disabled`, `stub`, `placeholder`, `not implemented`, `noop`
**Excluded:** test file mocks/stubs, template placeholders, data strings containing "todo", `console.error` in catch blocks (acceptable browser error logging)