Commit Graph

46 Commits

Author SHA1 Message Date
Sacha Al Himdani
c635492f75 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>
2026-04-16 00:01:13 +02:00
Sacha Al Himdani
b63f043849 Move document title ownership from document to version
Title is now owned by document_versions, following the same pattern as
classification and document_type. The documents.title column is made
nullable with a TODO to drop it. Backend loads title from a
latest_versions CTE for ordering purposes only. The frontend resolves
title from the latest version, and DocumentTitleForm now operates on
DocumentVersion using UpdateDocumentVersion mutation.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 20:01:32 +02:00
Sacha Al Himdani
ab5f42ad74 Redesign document approval flow
Replace the per-approver add/remove model with a quorum-based approval
system. Documents now have default approvers that are pre-populated when
requesting approval, and the publish dialog lets users adjust the list
before submitting.

Key changes:

- Add PENDING_APPROVAL document version status with dedicated transitions
- Introduce approval quorums with request/approve/reject/void lifecycle
- Add default approvers per document (stored in document_default_approvers)
  with MERGE-based upsert for efficient sync
- Add NoDuplicates validator for slice fields
- Split ALTER TYPE ADD VALUE migrations into separate files (required by
  PostgreSQL when run inside transactions)
- Use VOIDED consistently for both quorum status and decision state enums
- Expose void/approve/reject through GraphQL and MCP, with e2e tests
- Add approval management UI: publish dialog with approver selection,
  approval list with void support, and external approve/reject page

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-09 18:18:30 +02:00
Sacha Al Himdani
ef2e99d86c Add measure-document linking
Introduce the ability to link measures to documents, following the
existing pattern used by controls and risks. This includes:

- Database migration for measures_documents join table
- Coredata MeasureDocument struct with insert/delete operations
- Document service methods for listing/counting by measure ID
- Measure service CreateDocumentMapping/DeleteDocumentMapping methods
- Cleanup of measure-document mappings on document archive
- GraphQL mutations, inputs, payloads, and Measure.documents field
- DocumentConnection.TotalCount support for measure resolver
- MCP linkMeasure/unlinkMeasure updated to support documents
- MCP listMeasureDocuments tool
- Frontend MeasureDocumentsTab with LinkedDocumentsCard integration
- Authorization actions for measure document mapping
- E2e tests for measure document mapping

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-03 17:51:31 +02:00
Sacha Al Himdani
2b377a22e7 Sort employee signatures and approvals by most recently updated
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-03 17:38:28 +02:00
Bryan Frimin
f17fb7bf49 Upgrade to kit v0.3.0
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-04-03 11:56:06 +02:00
Sacha Al Himdani
9a418a7711 Move document type from document to document version
Follow the same pattern used for classification: document type now lives
exclusively on DocumentVersion. A migration copies existing values from
documents to their versions. The document filter uses a subquery on the
latest version. All three API surfaces (GraphQL, MCP, CLI), resolvers,
frontend, and e2e tests are updated accordingly.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-04-02 16:32:38 +02:00
Sacha Al Himdani
5d6d0bdd7f Move document classification from document to document version
Classification now lives exclusively on DocumentVersion. The field is
removed from the Document model, all SQL queries, GraphQL Document
type, SignableDocument type, UpdateDocumentInput, and MCP Document
schema.

New documents still accept classification in CreateDocumentInput,
applied to the first version. New drafts inherit classification from
the previous version. PDF generation uses the version classification.

The drawer allows editing classification on draft versions via the
updateDocumentVersion mutation. Classification is read-only on
published versions.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-31 14:11:57 +02:00
Sacha Al Himdani
68bc8cf59a Add major.minor document versioning
Introduce a two-part version scheme (major.minor) for documents.
Drafts start at 0.1 and increment minor on each new draft. Publishing
as minor keeps the current version, publishing as major bumps to the
next major.0. Both current_published_major and current_published_minor
are tracked on the document for exact version lookups.

Signatures and approval quorums aggregate across all versions sharing
the same major number using CTE joins. Approval page mutations spread
the decision fragment so Relay updates the version row state without
requiring a page refresh.

GraphQL, MCP, and service layer expose separate publishMajor and
publishMinor mutations instead of a single mutation with a type enum.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-30 18:54:28 +02:00
Sacha Al Himdani
999171a626 Add document approval workflow
Introduce a complete approval system for document publishing. Document
versions can now require approval from selected reviewers before being
published, with automatic publishing once all approvers have approved.

- Add approval quorum and decision tables with backfill migration
- Implement request approval, approve, and reject flows with electronic
  signature support for approve decisions
- Add employee approvals page with dedicated tab and pending approvals view
- Add changelog field to publish and request approval flows
- Pre-select previous version's approvers in the publish dialog
- Show quorum approvers in document list with 100 approver hard limit
- Expose approval workflow through GraphQL, MCP, and CLI
- Remove legacy default approvers feature entirely
- Add comprehensive e2e test coverage for approval workflows

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-27 19:43:20 +01:00
Sacha Al Himdani
8c02c53315 Update copyright headers across all Go files
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-25 17:38:32 +01:00
Sacha Al Himdani
1db8e7133e Add document archiving
Documents can be archived and unarchived. Archived documents are
read-only, excluded from the trust center, and moved to a dedicated
Archived tab in the document list.

- Add archived_at timestamp and status (ACTIVE/ARCHIVED) PG enum column
- Rename DocumentStatus → DocumentVersionStatus, introduce DocumentStatus
- Archive/unarchive mutations in GraphQL, MCP, and CLI
- Bulk archive/unarchive mutations with Active/Archived tabs in the list
- ABAC policies: write actions denied on archived docs, unarchive denied
  on active docs
- Remove control/risk mappings and reset trust center visibility on archive
- Exclude archived documents from mapping dialogs and trust center tab

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2026-03-19 14:15:54 +01:00
Bryan Frimin
9e788ee558 Fix compliance page to only show published document versions
The compliance page was leaking draft document content and titles.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-02-23 19:11:49 +01:00
Bryan Frimin
93c7b0c2dc Add multi-approver support
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-02-17 10:48:44 +01:00
Bryan Frimin
3d8c7c4dd6 Rename owner by approver
Document owner does not make sense it's more an document approver.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-02-17 10:48:43 +01:00
Émile Ré
24bcabe620 Fix do not use peoples.primary_email_address anymore
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:13 +04:00
Émile Ré
29371662e2 Fix referenced columns used in certain SQL queries + minor front fixes
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:13 +04:00
Émile Ré
d7e1703ff3 Fix coredata SQL queries using new FKs columms
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:10 +04:00
Émile Ré
e156a428d4 Stop using coredata.People except for people service and people page resolvers
Signed-off-by: Émile Ré <emile@getprobo.com>
2026-02-12 16:21:09 +04:00
Bryan Frimin
4013b00841 Refactor policies document
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-01-17 11:37:39 -08:00
Bryan Frimin
74fc3b8cd1 Rewrite identity and access management
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2026-01-17 10:07:34 -08:00
Émile Ré
c0b2a5702d Introduce pkg/mail.Addr
Signed-off-by: Émile Ré <nemile.re@gmail.com>
2025-12-15 18:24:00 +01:00
Émile Ré
5c41a5bdb1 Review fixes
Signed-off-by: Émile Ré <nemile.re@gmail.com>
2025-12-11 16:24:36 +01:00
Émile Ré
1ed291aa0e Fix cubic review
Signed-off-by: Émile Ré <nemile.re@gmail.com>
2025-12-11 16:24:36 +01:00
Émile Ré
c8e3636bf3 Implement Merge for trusct center document accesses
Signed-off-by: Émile Ré <nemile.re@gmail.com>
2025-12-11 16:24:35 +01:00
Émile Ré
c8471cd48d Add reject button + email on trust center access request
Signed-off-by: Émile Ré <nemile.re@gmail.com>
2025-12-11 16:24:34 +01:00
Sacha Al Himdani
975d16c623 Add employee page
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-12-09 15:33:05 +01:00
Sacha Al Himdani
288c59a5f2 Make descriptions nullable
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-11-05 17:58:50 +01:00
Bryan Frimin
59aa332ab5 Move to vanity import url
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-10-31 17:01:52 +01:00
Sacha Al Himdani
9a33f7b771 Manage errors
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-10-31 15:14:56 +01:00
Bryan Frimin
c7cabf23de Add document classification
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-10-22 17:02:39 +02:00
Sacha Al Himdani
8504830c4b Add public trust center documents
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-10-06 11:04:47 +02:00
Sacha Al Himdani
770a795cd3 Add granular trust center access
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-10-01 14:54:32 +02:00
Sacha Al Himdani
04e3eb81a7 Upgrade documents
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-09-18 16:32:59 +02:00
Sacha Al Himdani
b6254f4758 Soft delete documents
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-09-08 16:51:03 +02:00
Bryan Frimin
23b54e7517 Fix SQL errors
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-08-10 18:26:02 +04:00
Sacha Al Himdani
ab97fc8cf8 Add organization deletion
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-08-08 15:31:23 +02:00
Sacha Al Himdani
32c47a1988 Add trust center configuration
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-07-31 15:36:24 +02:00
Bryan Frimin
d4dbadee10 Fix 5xx on document type order
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-07-03 08:26:25 +02:00
Bryan Frimin
6dc24d82d0 Fix totalCount document risk
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-06-13 16:31:12 -07:00
Bryan Frimin
1f94ddba95 Fix totalCount 5xx
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-06-13 13:23:46 -07:00
Sacha Al Himdani
069ff4aa9a Fix search queries
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-06-10 10:45:16 -07:00
Bryan Frimin
5bc65d3834 Add documents totalCount support
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
2025-06-09 21:20:09 -07:00
Sacha Al Himdani
a9a5f9cf49 Add fulltext search on risks, documents, and measures
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-06-09 15:11:36 -07:00
Sacha Al Himdani
2391b19db3 Add type to document
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-05-30 13:54:07 -07:00
Sacha Al Himdani
e1b4079e1f Rename policy to document
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
2025-05-30 13:53:14 -07:00