Appearance
Handoff: SVC-008-question-save-reload-route-proof
Scope
- Dispatch ID:
SVC-008 - Service:
question-service(services/question-bank-service) - Task pack:
docs/agents/service-tasks/question-service.md - Next task:
SVC-008-question-save-reload-route-proof - Goal: prove question read/write/type save-reload behavior with live/browser and rollback evidence before default promotion.
- Status: accepted bounded slice, not service completion.
Docs Read
docs/agents/service-agent-next-slice-queue.jsondocs/agents/service-agent-next-slice-closeout-ledger.jsondocs/agents/service-tasks/question-service.mddocs/agents/handoff-phase-6-question-editor-projection-smoke.mddocs/qa/question-write-route-rehearsals.mddocs/qa/question-save-reload-route-proof.mddocs/qa/question-write-route-rehearsals.mddocs/qa/question-editor-gateway-ui-proof.mdscripts/test/question-write-browser-smoke.mjspackages/ui/src/modules/teacher/teacher-question-editor-api.tspackages/ui/src/modules/teacher/panels/question-editor-panel.tsxpackages/ui/src/modules/teacher/teacher-workspace.test.tsxdocs/api/question-bank-service.md
Legacy Evidence Read
/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/src/modules/questions/questions.controller.ts/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/src/modules/questions/question-permanent-delete.queue.ts/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/src/modules/questions/question-permanent-delete.worker.ts/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/src/modules/app-data/app-data.questions-write.ts/Users/velikho/Desktop/WORKING/HOCTAPAZ/node-platform/apps/api/prisma/schema.prisma
Legacy source was read-only evidence. No file under /Users/velikho/Desktop/WORKING/HOCTAPAZ/ was changed.
Files Changed
services/question-bank-service/internal/http/server_test.godocs/qa/question-save-reload-route-proof.mddocs/agents/handoffs/SVC-008-question-save-reload-route-proof.mddocs/agents/service-agent-next-slice-closeout-ledger.jsondocs/agents/service-agent-next-slice-closeout-ledger.mddocs/agents/service-agent-accepted-handoffs.mddocs/agents/service-tasks/question-service.mddocs/api/question-bank-service.mddocs/index.mddocs/.vitepress/config.tsdocs/qa/service-agent-goal-completion-audit.mddocs/qa/service-agent-readiness-smoke.md
Behavior Implemented
- Extended the question HTTP update workflow to reload the question after
PATCHand verify persisted replacement version, content, options, tags, and omitted-field preservation. - Revalidated permanent-delete job/impact ownership boundaries: only question-bank-owned rows are deleted; exam/attempt/course data is not.
- Revalidated native read/write route examples and legacy fallbacks without changing the default gateway table.
- Ran an isolated in-memory
question-bank-servicebehind the non-default question-write Gateway table. A teacher-scoped fixture was created, patched, reloaded, updated from Chromium, reloaded again, and deleted. - Updated the Chromium runner to use the installed
@playwright/testruntime and issue the read/write/reload requests from the browser context. It is an API-shell proof retained alongside the teacher-editor workflow below. - Wired the authenticated teacher question editor to Gateway-only
POST/PATCH /api/questionswrites followed byGET ...?view=editorreloads. Unauthenticated editor sessions preserve the existing local-draft behavior. - Bound the teacher editor's write and persistence reload to one 25-second deadline. Successful latency events include
writeDurationMsandreloadDurationMs; a timed-out budget recordsdeadlineExceeded=true.
Required Evidence
- save/reload proof:
PATCH /v1/questions/{id}followed byGET /v1/questions/{id}preserves the replacement version and refs. - live/browser proof: live save/reload passed through the non-default Gateway at
output/qa/question-save-reload-route-proof-20260713/gateway-live/. Chromium then observedquestions-detail,questions-update, and a reloadedquestions-detailfrom its page context atoutput/playwright/question-save-reload-route-proof-20260713/. - teacher-editor browser proof: the real
teacher-webeditor athttp://127.0.0.1:5214/teacher/questions/newcreated a question, reloaded it, published it withPATCH, and reloaded it again through the candidate Gateway. Route/header evidence and screenshots are inoutput/playwright/question-editor-gateway-ui-proof-20260713/. - rollback evidence: after the candidate Gateway stopped, the unmodified default
deploy/gateway/routes.jsonreturned502withquestions/legacy_proxyfor both read and update. Headers and bodies are retained underoutput/qa/question-save-reload-route-proof-20260713/rollback-default/.
Tests And Verification
gofmt -w services/question-bank-service/internal/http/server_test.goGOTOOLCHAIN=go1.25.11 go test ./services/question-bank-service/... -count=1make test-question-read-routes test-question-types-routes test-question-classification-apply-routes test-question-write-routesQUESTION_WRITE_SELF_TEST=1 make test-question-write-liveQUESTION_WRITE_BROWSER_SELF_TEST=1 make test-question-write-browser- Isolated live Gateway smoke passed with a real teacher JWT and a temporary in-memory question-service fixture.
- Chromium API-shell save/reload passed against that fixture, followed by a native delete cleanup. The temporary
:8089question-service and:18085Gateway listeners were stopped and verified absent. pnpm exec vitest run packages/ui/src/modules/teacher/teacher-workspace.test.tsx,pnpm --filter @hoctapaz/ui typecheck, andpnpm frontend:typecheckpassed.pnpm vitest run packages/ui/src/modules/teacher/teacher-question-editor-api.test.tspassed. It verifies the POST/PATCH and reload share one abort signal and the deadline rejects before a stalled write can consume a second 25-second wait.- The real editor browser proof also verified that default-table rollback returns
502/questions/legacy_proxyand surfaces the Gateway error in the editor instead of reporting a local save. - Permanent-delete usecase and HTTP tests passed for scoped rows, impact, and job lifecycle.
Route State
- Route/default state: question write route promotion requires save/reload, live/browser, and rollback evidence.
- Default question, folder, group, and fallback routes remain
legacy_proxy. - Candidate proof used only
deploy/gateway/routes.questions-write-native-localhost-example.json; it did not edit or promotedeploy/gateway/routes.json. - Native question write route tables remain non-default rehearsals.
Data Notes
- Question-service owns question-bank rows and copied reference projections.
- It intentionally does not delete exam, attempt, course, file bytes, or search index source data.
- Permanent-delete job processing is service-local and still requires durable broker/worker parity as a separate risk.
Risks / Blockers
- The real teacher-editor save/reload proof is local-candidate evidence only. It uses an in-memory Question Bank, a disposable teacher token, and a non-default Gateway route table; it is not a deployed or populated-target proof.
- Durable broker/worker parity remains separate from this route proof.
- Default question write promotion remains blocked pending candidate deployment validation, populated-target response parity, and rollback-after-live evidence, despite the completed local browser-visible editor proof.
Rollback Notes
These are the rollback notes for the accepted bounded slice:
- Set
GATEWAY_ROUTE_TABLE=deploy/gateway/routes.json. - Disable native question write rehearsal callers.
- Rerun
make test-question-write-routesand confirm broad question routes are legacy-proxied.
Next Step
Run the now Gateway-backed editor against a candidate deployment with production-like question ownership data, then attach rollback-after-live evidence before any default promotion review.