SOA as document: replace export with publish workflow

Statements of Applicability are no longer exported as one-off PDFs.
Instead, each SOA owns a persistent document that accumulates versions
over time, following the same publish/approve lifecycle as authored
documents.

Publishing without approvers publishes immediately; publishing with
approvers creates a draft pending approval via the existing quorum
system. SOAs can also store default approvers that are pre-populated in
the publish dialog.

The SOA is removed from the snapshot system — applicability statements
are now queried directly (snapshot_id IS NULL) rather than through
snapshot copies.

A standalone migration script (cmd/migrate-soa-snapshots-to-documents)
converts existing SOA snapshots into documents with proper ProseMirror
content, preserving version history and approval decisions.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-04-10 13:38:42 +02:00
parent 53edc5ba26
commit c635492f75
74 changed files with 3509 additions and 1595 deletions

View File

@@ -5144,6 +5144,7 @@ components:
- RECORD
- REPORT
- TEMPLATE
- STATEMENT_OF_APPLICABILITY
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.DocumentType
DocumentClassification:
@@ -5170,6 +5171,13 @@ components:
- ARCHIVED
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.DocumentStatus
DocumentWriteMode:
type: string
enum:
- AUTHORED
- GENERATED
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.DocumentWriteMode
DocumentVersionSignatureState:
type: string
enum:
@@ -5244,6 +5252,7 @@ components:
- id
- organization_id
- trust_center_visibility
- write_mode
- status
- created_at
- updated_at
@@ -5267,6 +5276,9 @@ components:
trust_center_visibility:
$ref: "#/components/schemas/TrustCenterVisibility"
description: Trust center visibility
write_mode:
$ref: "#/components/schemas/DocumentWriteMode"
description: Write mode (authored or generated)
status:
$ref: "#/components/schemas/DocumentStatus"
description: Document status
@@ -5419,6 +5431,11 @@ components:
query:
type: string
description: Search query
write_modes:
type: array
items:
$ref: "#/components/schemas/DocumentWriteMode"
description: Filter by write mode (AUTHORED or GENERATED)
trust_center_visibilities:
type: array
items:
@@ -6119,7 +6136,6 @@ components:
- id
- organization_id
- name
- owner_id
- created_at
- updated_at
properties:
@@ -6132,14 +6148,11 @@ components:
name:
type: string
description: Statement of applicability name
owner_id:
$ref: "#/components/schemas/GID"
description: Owner profile ID
snapshot_id:
document_id:
anyOf:
- $ref: "#/components/schemas/GID"
- type: "null"
description: Snapshot ID
description: Associated document ID
created_at:
type: string
format: date-time
@@ -6211,7 +6224,6 @@ components:
required:
- organization_id
- name
- owner_id
properties:
organization_id:
$ref: "#/components/schemas/GID"
@@ -6219,9 +6231,6 @@ components:
name:
type: string
description: Statement of applicability name
owner_id:
$ref: "#/components/schemas/GID"
description: Owner profile ID
AddStatementOfApplicabilityOutput:
type: object
@@ -6242,9 +6251,6 @@ components:
name:
type: string
description: Statement of applicability name
owner_id:
$ref: "#/components/schemas/GID"
description: Owner profile ID
UpdateStatementOfApplicabilityOutput:
type: object
@@ -6272,7 +6278,8 @@ components:
$ref: "#/components/schemas/GID"
description: Deleted statement of applicability ID
ExportStatementOfApplicabilityPDFInput:
PublishStatementOfApplicabilityInput:
type: object
required:
- id
@@ -6280,19 +6287,24 @@ components:
id:
$ref: "#/components/schemas/GID"
description: Statement of applicability ID
approver_ids:
type: array
items:
$ref: "#/components/schemas/GID"
description: Optional approver profile IDs. If provided, creates a draft pending approval instead of publishing immediately.
ExportStatementOfApplicabilityPDFOutput:
PublishStatementOfApplicabilityOutput:
type: object
required:
- pdf_base64
- filename
- document_id
- document_version_id
properties:
pdf_base64:
type: string
description: Base64-encoded PDF content
filename:
type: string
description: Suggested filename for the PDF
document_id:
$ref: "#/components/schemas/GID"
description: Created or updated document ID
document_version_id:
$ref: "#/components/schemas/GID"
description: Created document version ID
ApplicabilityStatementOrderField:
type: string
@@ -8597,15 +8609,14 @@ tools:
$ref: "#/components/schemas/DeleteStatementOfApplicabilityInput"
outputSchema:
$ref: "#/components/schemas/DeleteStatementOfApplicabilityOutput"
- name: exportStatementOfApplicabilityPDF
description: Export a statement of applicability as a PDF document
- name: publishStatementOfApplicability
description: Publish a statement of applicability as a document. If a document already exists, a new version is created.
hints:
readonly: true
idempotent: true
readonly: false
inputSchema:
$ref: "#/components/schemas/ExportStatementOfApplicabilityPDFInput"
$ref: "#/components/schemas/PublishStatementOfApplicabilityInput"
outputSchema:
$ref: "#/components/schemas/ExportStatementOfApplicabilityPDFOutput"
$ref: "#/components/schemas/PublishStatementOfApplicabilityOutput"
- name: listApplicabilityStatements
description: List all applicability statements for a statement of applicability
hints: