feat(ai): enforce local-first routing
Keep external providers behind server consent, task, and prompt-cost gates while persisting actual provider provenance.
This commit is contained in:
@@ -16,7 +16,7 @@ Allowed statuses are `NOT STARTED`, `IN PROGRESS`, `IMPLEMENTED — NOT VERIFIED
|
||||
|
||||
`DONE` requires every applicable acceptance criterion, focused and regression tests, browser/accessibility/theme/mobile checks, tenant and entitlement checks, documentation, migration/rollback evidence, and production verification. Repository-only work that still requires production is at most `VERIFIED LOCALLY`.
|
||||
|
||||
Exactly one implementation item may be `IN PROGRESS`. As of this revision it is **AI-002**.
|
||||
Exactly one implementation item may be `IN PROGRESS`. As of this revision it is **AI-003**.
|
||||
|
||||
## Consolidated dependency order
|
||||
|
||||
@@ -383,7 +383,7 @@ Ordering differences from the suggested list:
|
||||
- **Blocker:** browser localhost is denied; Stripe/MariaDB/production are unavailable. Usage accounting is complete only for AI Workspace, so provider rollout remains blocked until durable execution centralizes it.
|
||||
- **Evidence:** `docs/verification/pol-001-free-pro-entitlements.md`; focused backend 74/74; full backend 568/568; focused frontend 22/22; full frontend 47 suites/157 tests; production build.
|
||||
- **Commit:** none.
|
||||
- **Remaining work:** browser locked/Pro state checks; mocked Stripe expiry/downgrade lifecycle; central all-task usage accounting through AI-001/002; production role/config smoke. PRODUCT-001 separately removes the known landing-page price/third-tier/unlimited claims.
|
||||
- **Remaining work:** browser locked/Pro state checks; mocked Stripe expiry/downgrade lifecycle; central all-task usage accounting through AI-003/004 producers; production role/config smoke. PRODUCT-001 separately removes the known landing-page price/third-tier/unlimited claims.
|
||||
|
||||
### POL-002 — AI privacy, consent and external-fallback policy
|
||||
|
||||
@@ -398,10 +398,10 @@ Ordering differences from the suggested list:
|
||||
- **Required browser verification:** user/admin controls and disclosure/locked/failure states.
|
||||
- **Required production verification:** external egress capture with synthetic data only; no real private CV/email.
|
||||
- **Status:** `IMPLEMENTED — NOT VERIFIED`.
|
||||
- **Blocker:** browser localhost is denied; MariaDB/production/external-provider verification is unavailable. Final fallback triggers and provenance depend on AI-001/002.
|
||||
- **Blocker:** browser localhost is denied; MariaDB/production/external-provider verification is unavailable. Task-specific payload minimization/accounting depend on AI-003/004.
|
||||
- **Evidence:** `docs/verification/pol-002-ai-privacy.md`; focused backend 72/72 and final policy 28/28; sidecar 18/18; focused frontend 8/8; full backend 576/576; full frontend 47 suites/158 tests; production build; config and migration script checks.
|
||||
- **Commit:** none.
|
||||
- **Remaining work:** browser user/admin disclosure checks; MariaDB and production synthetic egress proof; AI-001 policy snapshot/recheck; AI-002 provider provenance, payload minimization, cost controls and bounded local-first fallback. Background CV calls currently fail safe to local.
|
||||
- **Remaining work:** browser user/admin disclosure checks; MariaDB and production synthetic egress proof; AI-003/004 task-specific payload minimization, accounting and real producer verification. AI-001/002 now carry rechecked policy/task context and record bounded local-first provenance.
|
||||
|
||||
### AI-001 — Durable AI queue, backpressure and operation APIs
|
||||
|
||||
@@ -416,10 +416,10 @@ Ordering differences from the suggested list:
|
||||
- **Required browser verification:** synthetic operation status across refresh/nav/double-click/offline/retry/cancel.
|
||||
- **Required production verification:** queue depth/age, one-worker canary, Ollama offline/restart and app/worker restart.
|
||||
- **Status:** `IMPLEMENTED — NOT VERIFIED`.
|
||||
- **Blocker:** real 202 producers/browser verification depend on AI-003/004; provider/model circuit and provenance depend on AI-002; MariaDB/production are unavailable and the worker remains off.
|
||||
- **Blocker:** real 202 producers/browser verification depend on AI-003/004; MariaDB/production are unavailable and the worker remains off.
|
||||
- **Evidence:** `docs/verification/ai-001-durable-ai-queue.md`; focused queue/state/API tests 17/17; full backend 581/581; Compose config and diff checks.
|
||||
- **Commit:** none.
|
||||
- **Remaining work:** AI-002 provider/model controls; AI-003/004 task handlers and 202 endpoints; browser refresh/double-click/cancel/retry; MariaDB and monitored single-worker production canary. Do not create a second CV- or Strategy-specific queue.
|
||||
- **Remaining work:** AI-003/004 task handlers and 202 endpoints; browser refresh/double-click/cancel/retry; MariaDB and monitored single-worker production canary. AI-002 supplies local-first circuit/provenance. Do not create a second CV- or Strategy-specific queue.
|
||||
|
||||
### AI-002 — Ollama adapter and local-first provider routing
|
||||
|
||||
@@ -433,11 +433,11 @@ Ordering differences from the suggested list:
|
||||
- **Required tests:** routing matrix, Ollama adapter, schema failure, local circuit, fallback allowed/prohibited/unavailable, cost limits and deduplication.
|
||||
- **Required browser verification:** provider-agnostic queued states and appropriate fallback disclosure.
|
||||
- **Required production verification:** actual selected local model and controlled synthetic fallback.
|
||||
- **Status:** `IN PROGRESS`.
|
||||
- **Blocker:** actual model/config depends on PROD-003; adapter/policy can use fakes first.
|
||||
- **Evidence:** new programme explicitly supersedes ADR-004's single-provider decision for this scope.
|
||||
- **Status:** `IMPLEMENTED — NOT VERIFIED`.
|
||||
- **Blocker:** browser and production checks, actual local-model selection and controlled provider fallback depend on administrator browser policy plus PROD-001/003 access/benchmarks. Repository behavior is not blocked.
|
||||
- **Evidence:** `docs/verification/ai-002-provider-routing.md`; V-098–V-100; focused backend 26/26, full backend 588/588, sidecar fake-transport 22/22, Compose/diff checks pass.
|
||||
- **Commit:** none.
|
||||
- **Remaining work:** design smallest central policy; preserve old provider config for rollback.
|
||||
- **Remaining work:** AI-003/004 must register typed producers/handlers and explicit external task allowlists; complete monthly cross-feature accounting; browser/MariaDB/selected-model/controlled-provider/production verification. Old provider/model configuration remains available for rollback.
|
||||
|
||||
### PROD-001 — Read-only production AI inventory and rollout safety
|
||||
|
||||
@@ -523,9 +523,9 @@ Ordering differences from the suggested list:
|
||||
- **Required tests:** endpoint/handler/provider fakes, all required states, entitlement/privacy/tenant checks, E2E.
|
||||
- **Required browser verification:** complete queue/status/error/retry/cancel/refresh/back-forward/mobile/theme flow.
|
||||
- **Required production verification:** local model success, timeout and restart recovery.
|
||||
- **Status:** `NOT STARTED`.
|
||||
- **Blocker:** dependencies.
|
||||
- **Evidence:** reported timeout not yet reproduced in this programme.
|
||||
- **Status:** `IN PROGRESS`.
|
||||
- **Blocker:** browser and production checks remain unavailable, but repository tracing, handler/API implementation and fake-provider tests can proceed.
|
||||
- **Evidence:** reported timeout was code-traced as synchronous `/cv/rewrite` work; live browser/provider reproduction remains blocked and must not be inferred.
|
||||
- **Commit:** none.
|
||||
- **Remaining work:** do not build a Strategy-specific queue.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user