Workflows¶
Every long-lived state machine in SISS is a Temporal workflow in
workflow-svc. Activities call other services via authenticated HTTP.
Temporal provides durable retries, SLA timers, human-task gates (via signals),
and a full replayable history for audit.
Why Temporal (not BPMN / Camunda)¶
- Native Python SDK, first-class activity testing.
- Workflow code is the source of truth; no separate BPMN XML to maintain alongside code.
- Replayable history enables workflow versioning without breaking in-flight submissions.
- Time-travel debugging during support and audits.
KM Submission Workflow¶
This is the core M2 workflow — from PSP pre-consult through SIGL issuance.
flowchart TD
Start([PSP submits])
S1[① Pre-consultation<br/>· PSP completes checklist<br/>· AI admin pre-check<br/>· CMU officer review + SLA gate]
S2[② Intake accepted<br/>fan-out: compliance extraction + BIM validation]
S3a[③ ATD review<br/>draft comments → officer finalise]
S3b[③ ATL review<br/>draft comments → officer finalise]
S3c[③ ...more departments]
Join{all departments closed}
S4[④ Consolidation & Perakuan<br/>· Aggregate comments<br/>· Draft Kertas Perakuan<br/>· ATD/ATL digital signatures<br/>· Generate SIGL]
S5[⑤ Issue & Notify<br/>Publish certificates · Notify all parties]
End([Submission ISSUED])
Start --> S1 --> S2
S2 --> S3a
S2 --> S3b
S2 --> S3c
S3a --> Join
S3b --> Join
S3c --> Join
Join --> S4 --> S5 --> End
S1 -.pushback.-> PSP[PSP revision pending]
PSP -.resubmit.-> S1
End-to-end sequence¶
One cycle across PSP, workflow-svc, ai-svc, comment-svc, signing-svc, and notification-svc.
sequenceDiagram
autonumber
participant PSP
participant SPA
participant SUB as submission-svc
participant WF as workflow-svc
participant AI as ai-svc
participant CMT as comment-svc
participant SIGN as signing-svc
participant NOT as notification-svc
PSP->>SPA: submit documents
SPA->>SUB: POST /submissions
SUB-->>WF: submission.created
SUB-->>NOT: submission.created
NOT-->>PSP: "received" email
WF->>AI: extract compliance (activity)
AI-->>WF: compliance.report.ready
WF->>CMT: draft comments per ATD/ATL
CMT-->>WF: drafts
WF-->>NOT: workflow.step.assigned (per officer)
Note over WF: SLA timer running
CMT->>WF: OfficerFinalizesComments (signal)
WF->>CMT: aggregate
WF->>AI: draft Kertas Perakuan
AI-->>WF: PDF draft
WF->>SIGN: multi-signer perakuan
SIGN-->>WF: perakuan.signed
WF->>SIGN: issue SIGL
SIGN-->>SUB: sigl.certificate.issued
SUB-->>NOT: notify all parties
NOT-->>PSP: certificates ready
Workflow spec (from architecture §6.1)¶
Workflow: KMSubmissionWorkflow(submission_id)
① PreConsultationChecklist
waitFor PSP_completes_checklist (signal)
activity AI_admin_precheck → ai-svc
gate CMU_officer_reviews (human task + SLA timer)
② IntakeAccepted
fan-out AIExtractCompliance → ai-svc
BIMValidateIfPresent → bim-svc
③ DepartmentReview (parallel per ATD/ATL)
each branch:
activity GenerateDraftComments → ai-svc
signal OfficerFinalizesComments
SLA 2-day reminder via notification-svc
joinOn all_departments_closed
④ ConsolidationAndPerakuan
activity AggregateComments → comment-svc
activity DraftKertasPerakuan → ai-svc
gate ATD/ATL_digital_signature
activity GenerateSIGL → ai-svc + signing-svc
⑤ IssueAndNotify
activity PublishCertificates → submission-svc
activity NotifyAllParties → notification-svc
Child workflows¶
SLAReminder— timer-driven reminders escalating through an assignee chain.RevisionResubmission— handles PSP resubmission after pushback; reuses parent context.ApplicantResponseTracker— tracks PSP replies to comments and signals the parent when the response set is complete.
Replay gates every workflow code change
Production workflow history is captured and replayed against proposed workflow code changes in CI. Any replay failure blocks merge, so in-flight submissions never break on deploy.