S.E.T module: questionnaire lifecycle
MERGED, NOT DEPLOYED — the following is the S.E.T module's code behavior. The staging baseline predates held edits, cycles and scoped answer history; the pack explicitly identifies those wave-1 routes as not live. E:evidence.md:13-16,59-60,69-72
Submit checks both response and copy revisions and required visible answers. It increments the cycle and takes a restore point. Customer Reopen changes Submitted to Draft; it refuses Accepted. Staff Return accepts Submitted or Accepted and returns a Draft. The route's historical name is restore; this means Return, not restoring a snapshot. A:apps/api/src/questionnaires/responses.service.ts:507-571,1062-1090
| Operation | Permission and behavior |
|---|---|
| Answer, attach, submit, reopen | portal:write and active session-derived client. A:apps/api/src/questionnaires/responses.controller.ts:74-187 |
| Review and held edits | responses:review. Staff edits apply only to Submitted answers; note required. Customer response shaping never reads the held layer. A:apps/api/src/questionnaires/responses.controller.ts:334-407 A:apps/api/src/questionnaires/responses.service.ts:299-325,896-971 |
| Stale held edits | Compare the recorded base with the current customer answer. Return is blocked until staff confirm or discard stale edits; Accept is blocked whenever any held edit exists. Return publishes held edits in its transaction. A:apps/api/src/questionnaires/responses.service.ts:838-878,944-998,1138-1150 |
| Scoped answer restore | questionnaires:restore. Draft only; selected question IDs restrict the change. Type-changed answers are skipped (all selected changed means refusal). Removed questions can restore as history. A:apps/api/src/questionnaires/restore-points.controller.ts:116-129 A:apps/api/src/questionnaires/restore-points.service.ts:285-370 A:.set/work/decisions-2026-10-26.md:35-36 |
| History and cycles | Answer history is represented by restore_points kind=answer/event=answer_changed. Notes carry cycle and question_ids; held edits carry base and publication/discard timestamps. A:apps/api/drizzle/tenant/0020_staff_edits.sql:1-36 |
No blanket overwrite of unrelated answers is implied by scoped restore. Snapshot restore and Return are different operations with different permissions. User flows lists those permissions. Data model lists the tables.