3 bugs fixed in recent Phase A code:
1. POST /api/context-message: Add Zod schema validation, feature flag gate
(ai_context_messages.enabled), and safe body parsing. Previously had no
validation and unsafe 'as' cast that could null-ptr on missing body.
2. GET /api/timers/availability: Filter out dismissed/completed/fired timers.
Previously included inactive timers in occupied intervals, causing the
endpoint to report less free time than actually available.
3. agent-actions/routes.ts: Import PRODUCT_ID from product-config.ts instead
of hardcoding 'chronomind' string. Ensures consistency if product identity
changes.
Also: Add EXTRACTION_SERVICE_URL + PLATFORM_SERVICE_URL to .env.example.
All 219 backend tests pass. No breaking changes.
Add 3 new backend REST endpoints for MCP tool support:
- POST /timers/:id/reschedule — shift timer by delta seconds or set new target time
- GET /timers/availability — find free time slots in a window (interval merge algorithm)
- POST /routines/:id/start — transition routine from ready/template → active
All endpoints gated behind isFeatureEnabled('mcp.enabled') flag (default false).
Zod schemas: RescheduleTimerSchema (XOR validation), AvailabilityQuerySchema, FreeSlot type.
All 182 backend tests pass. No breaking changes to existing APIs.
$contains generates CONTAINS() SQL in Cosmos (string match), not
ARRAY_CONTAINS() needed for string[] fields. Use findMany + in-memory
post-filter for correct behavior across both providers.