Skip to main content

PRD-006: Case Workflow — Nota de Culpa (Charges)

Author: MLT backend team | Date: 2026-08-19 | Status: Draft | Version: v0.1.1


Revision History

VersionDateAuthorDescription of Change
v0.1.02026-08-19MLT backend teamInitial draft — third phase of the Case Workflow, backfilled from the rebuild roadmap (interim PRD).
v0.1.12026-09-08MLT backend teamAdd SYS-REQ-303: the recorded delivery method and proof are readable back (#59), closing the same write-only gap SYS-REQ-104 flagged for #56.

1. Context & Business Rationale

The Nota de Culpa (CHARGES_ISSUED) is the third phase and the start of the mandatory disciplinary spine (charges → defence → reasoned decision) under the Código do Trabalho. It is reached from Abertura directly (has_preliminary_inquiry = false) or after the Inquérito Prévio proposes PROCEED_DISCIPLINARY.

Part of the Case Workflow theme (theme: case-workflow, label workflow: nota de culpa (3/8)). Reuses the guarded-transition engine, deliverable mechanism, and case-role authorization established earlier; adds the charges deliverable, the legal-review gate, and formal service of the charges.

Sourcing: the firm brief (_poc/firm-qa.md) and the 2026-08-11 client meeting. PoC autopsy: outcomes & proposal, dossier XSS.

2. Problem Statement

There is no server-side way to draft and serve a Nota de Culpa, gate it behind a legal review, or record proof of its delivery — the moment that starts the arguido's response-window clock. The PoC generated documents by unescaped string-concatenation and enforced no review or receipt.


3. Goals, Non-Goals, and Success Metrics

3.1 Goals

  • Produce the Nota de Culpa (circumstantiated facts + enquadramento legal), the Comunicação da Intenção de Despedimento when the sanction is expulsive, and the suspensão preventiva decision.
  • Gate the transition to Consulta behind an approved legal review (revisor jurídico).
  • Record formal service of the charges and stamp charges_delivered_at.

3.2 Non-Goals

  • The arguido's response and the evidence phase (5–6/8).
  • The portal file-inspection window (4/8).

3.3 Success Metrics

Metric TypeMetric DefinitionBaselineTarget
PrimaryCharges generated + served server-side with proof of receiptPoC: none100%
Guard RailDeliverable field injection (XSS)PoC: possibleImpossible (escaped)
Guard RailAdvance to Consulta without legal reviewPoC: possibleBlocked by gate

4. User Personas & Actors

4.1 Instrutor (Primary)

  • Role: drafts the Nota de Culpa and records the suspensão-preventiva decision.
  • Role: approves or rejects the Nota de Culpa at the charges-review gate.

4.3 Case Manager (Secondary) · Arguido (notified)

  • The arguido receives the served charges; delivery + receipt are recorded.

5. User Stories

  • As an instrutor, I want to produce the Nota de Culpa (facts + legal framing + intenção de despedimento when expulsive) and record the suspensão-preventiva decision, so the accusation is complete and lawful. → #57
  • As a revisor jurídico, I want to approve or reject the Nota de Culpa at a gate that blocks the advance to Consulta until approved, so no charges go out unreviewed. → #58
  • As a case manager, I want to record how and when the charges were served (in person / registered letter) with proof of receipt, so charges_delivered_at anchors the response deadline. → #59

6. System Requirements

6.1 Charges deliverable

  • SYS-REQ-101: The Nota de Culpa shall generate via the deliverable mechanism with escaped fields.
  • SYS-REQ-102: The Comunicação da Intenção de Despedimento shall be required when the intended sanction is expulsive.
  • SYS-REQ-103: The suspensão preventiva decision (yes/no + reason) shall be recorded.
  • SYS-REQ-104: The recorded suspensão preventiva decision shall be readable back (case detail read), not write-only — flagged as a frontend contract gap during #56's review (#104 needs to display it after a refresh).
  • SYS-REQ-201: Only the assigned legal_reviewer shall decide the charges-review gate; others 403.
  • SYS-REQ-202: The transition to CONSULTATION_PORTAL shall be refused until the gate is approved.

6.3 Service of charges

  • SYS-REQ-301: Delivery method (in person / registered letter — declaração receptícia) and proof of receipt shall be recorded.
  • SYS-REQ-302: charges_delivered_at shall be stamped and anchor the Resposta deadline.
  • SYS-REQ-303: The recorded delivery method and proof shall be readable back (GET .../charges-delivery), not write-only — the same gap SYS-REQ-104 closed for the suspensão-preventiva decision.

7. Workflow

(from Abertura false-branch, or Inquérito → proceed)


CHARGES_ISSUED ── draft Nota de Culpa (+ intenção de despedimento if expulsive)
│ record suspensão-preventiva decision

charges_review gate ── reject ──► back for redraft
│ approve

Serve charges (pessoal / carta registada) ── stamp charges_delivered_at


CONSULTATION_PORTAL (phase 4/8)

8. Open Questions

  • None specific to this phase beyond the shared sanction-set confirmation tracked in PRD-010.

9. Edge Cases & Exception Handling

  • Gate rejected → returns to redraft, not forward.
  • Service unacknowledged / registered letter unclaimed — capture the declaração receptícia rule; confirm how a refused/unclaimed delivery anchors the clock with counsel.

10. Given-When-Then Acceptance Criteria

Issue the Nota de Culpa (#57)

  • The Nota de Culpa generates via the deliverable mechanism with escaped fields.
  • Intenção de despedimento is required when the intended sanction is expulsive.
  • The suspensão-preventiva decision is recorded (yes/no + reason).
  • The recorded decision, once set, appears on the case detail read (SYS-REQ-104).

Legal-review gate (#58)

  • Only the assigned legal_reviewer can decide the gate; others get 403.
  • The transition to CONSULTATION_PORTAL is refused until the gate is approved.

Notify the arguido + proof of receipt (#59)

  • Delivery method + proof of receipt are recorded.
  • charges_delivered_at is stamped and anchors the Resposta deadline.
  • The recorded method, proof and anchor, once set, are readable back (SYS-REQ-303).

11. Technical Constraints & Dependencies

  • Blocked by: the workflow engine (1/8, #40) and case-role authorization (Tenancy & RBAC #26).
  • Reuses the deliverable mechanism born in Abertura and the E15 platform primitives.
  • Feeds phase 4/8 (Consulta) — the gate guards that transition.