Appearance
Teacher AI Preview Question Bank Draft Runtime Proof
Date: 2026-07-12
Scope
This proof covers the narrow reviewed-generation path only:
text
teacher-web -> Gateway exact route -> question-bank-service -> canonical DRAFTai-classifier-service remains the preview owner. Question Bank is the only service that creates the canonical question. The default Gateway route table is unchanged.
Static And Hermetic Gates
bash
GOTOOLCHAIN=go1.25.11 go test ./services/question-bank-service/... -count=1
GOTOOLCHAIN=go1.25.11 go test ./services/api-gateway/internal/gateway \
-run TestGatewayTeacherAIPreviewRoutesForwardOnlyAuthenticatedTeacherScope -count=1
pnpm --filter @hoctapaz/ui typecheck
pnpm --filter @hoctapaz/ui test -- --run packages/ui/src/modules/teacher/teacher-workspace.test.tsx
make test-teacher-ai-preview-routesAll gates passed on 2026-07-12.
Local Runtime Evidence
- Rebuilt and started
question-bank-servicewithdocker compose -f deploy/docker-compose.yml up -d --build question-bank-service. - Confirmed
GET http://127.0.0.1:8089/readyzreturned200. - Posted a reviewed candidate to
POST /v1/questions/ai-preview-draftsunder isolated organizationorg_ai_preview_runtime_20260712. - The first response returned
201with a canonical question ID,status=DRAFT,sourceType=AI_GENERATED,source=AI preview, two ordered options, and provenance forpreviewId, provider, model, generation mode, and the teacher-edit marker. - An identical retry returned
200with that same canonical ID. Reusing the samepreviewIdwith changed reviewed content returned400and did not create another question. - A scoped
GET /v1/questions/{id}returned the stored explanation and the correct option marker. The fixture was deleted through the owner API; a final scoped read returned404. Reposting the original payload returned201and a new question ID, proving hard-delete cleanup of the service-owned idempotency record.
Boundary
- The teacher UI sends only a reviewed Gateway preview to the exact opt-in route. Local browser drafts cannot invoke a Question Bank write.
- Question Bank forces
DRAFT; teachers must review/edit before publication. - The Gateway forwards authenticated organization, user, and role headers and removes forged actor headers. The route regression test verifies this.
- The default broad
/api/questionsroute remainslegacy_proxy.
Not Proven
This is not proof of usage/quota/credit settlement, a billed live provider call, or applying an AI solution to an existing canonical question. Those need separate owner-service contracts.