mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 22:32:04 +00:00
Operator-side kill matrix for every LLM-driven surface. Master flag `assistantEnabled` plus five sub-flags carve the seven surfaces: Coach + chat, Daily Briefing + advisor, per-metric status cards, correlation narration, Health-Score delta explainer. Defaults are `true` so existing installs upgrade without losing affordances. New `src/lib/feature-flags/` module exposes `getAssistantFlags()`, `resolveAssistantFlags()` and the `AssistantDisabledError` typed error route handlers throw to surface the 403 + `errorCode: "assistant.disabled.<surface>"` envelope. The resolver forces every sub-flag false when the master is off so callers never have to compose `master && sub`. Locks per `.planning/RESPONSE-TO-IOS-TEAM-2026-05-16.md` §3 R5: the same matrix gates server-routed AND iOS on-device surfaces. Migration 0065 is additive only; `app_settings` gains six boolean columns, all default `true`, idempotent under `IF NOT EXISTS`.
36 lines
1.5 KiB
SQL
36 lines
1.5 KiB
SQL
-- v1.4.31 — Assistant-surface operator feature flags
|
|
--
|
|
-- Six new boolean columns on `app_settings`. One master flag plus
|
|
-- five sub-flags covering the seven LLM-driven surfaces (Coach,
|
|
-- Daily Briefing, per-metric status cards, correlations,
|
|
-- Health-Score delta explainer). All default `true` so existing
|
|
-- installs upgrade without losing surfaces. The runtime resolver
|
|
-- forces every sub-flag false when the master is off — so flipping
|
|
-- one row in the admin panel can mute the whole assistant.
|
|
--
|
|
-- Additive-only — six nullable-then-default columns, no data
|
|
-- movement. `IF NOT EXISTS` keeps the migration idempotent against
|
|
-- partial historical runs (same posture as 0058, 0061, 0063).
|
|
--
|
|
-- Locks per `.planning/RESPONSE-TO-IOS-TEAM-2026-05-16.md` §3 R5
|
|
-- and the architecture doc at
|
|
-- `.planning/research/v15-assistant-optional.md`.
|
|
|
|
ALTER TABLE "app_settings"
|
|
ADD COLUMN IF NOT EXISTS "assistant_enabled" BOOLEAN NOT NULL DEFAULT true;
|
|
|
|
ALTER TABLE "app_settings"
|
|
ADD COLUMN IF NOT EXISTS "assistant_coach_enabled" BOOLEAN NOT NULL DEFAULT true;
|
|
|
|
ALTER TABLE "app_settings"
|
|
ADD COLUMN IF NOT EXISTS "assistant_briefing_enabled" BOOLEAN NOT NULL DEFAULT true;
|
|
|
|
ALTER TABLE "app_settings"
|
|
ADD COLUMN IF NOT EXISTS "assistant_insight_status_enabled" BOOLEAN NOT NULL DEFAULT true;
|
|
|
|
ALTER TABLE "app_settings"
|
|
ADD COLUMN IF NOT EXISTS "assistant_correlations_enabled" BOOLEAN NOT NULL DEFAULT true;
|
|
|
|
ALTER TABLE "app_settings"
|
|
ADD COLUMN IF NOT EXISTS "assistant_health_score_explainer_enabled" BOOLEAN NOT NULL DEFAULT true;
|