Skip to content

Move document classification from document to document version#952

Merged
SachaProbo merged 1 commit intomainfrom
SachaProbo/doc-confidentiality-to-version
Mar 31, 2026
Merged

Move document classification from document to document version#952
SachaProbo merged 1 commit intomainfrom
SachaProbo/doc-confidentiality-to-version

Conversation

@SachaProbo
Copy link
Copy Markdown
Contributor

@SachaProbo SachaProbo commented Mar 27, 2026

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.


Summary by cubic

Moved document classification from Document to DocumentVersion to enable per‑version classification. UI, APIs, and PDFs now use version classification; drafts are editable, published versions are read‑only.

  • New Features

    • Classification is version‑scoped; edit via updateDocumentVersion on drafts only.
    • createDocument still accepts classification; applied to the first version. New drafts inherit the previous version’s classification.
    • Console and employee lists show the latest version’s classification. PDF output uses version classification.
    • GraphQL/MCP: added EmployeeDocumentVersion.classification; removed classification from Document/EmployeeDocument. UpdateDocumentVersionInput now has optional content and optional classification.
  • Migration

    • Run the DB migration to set documents.classification default to SECRET; the column will be dropped later.
    • Remove classification from GraphQL Document/EmployeeDocument and from UpdateDocumentInput; read from the latest version instead.
    • Use updateDocumentVersion with documentVersionId to change classification; pass optional classification (and optional content). Update MCP clients similarly.

Written for commit 5d6d0bd. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 15 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/console/src/pages/organizations/documents/_components/DocumentListItem.tsx">

<violation number="1" location="apps/console/src/pages/organizations/documents/_components/DocumentListItem.tsx:87">
P2: Delete errors are swallowed: the confirmation promise resolves on both GraphQL and network failures, so failed deletes are treated as success.</violation>
</file>

<file name="pkg/coredata/document.go">

<violation number="1" location="pkg/coredata/document.go:37">
P1: Two document-loading queries still select `classification` from `documents`, which will break after this PR’s schema move to version-level classification.</violation>
</file>

<file name="apps/console/src/pages/organizations/documents/_components/DocumentLayoutDrawer.tsx">

<violation number="1" location="apps/console/src/pages/organizations/documents/_components/DocumentLayoutDrawer.tsx:133">
P2: Replacing `useMutationWithToasts` with raw `useMutation` removes success/error feedback for document updates, causing silent failures for approver/type edits.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread pkg/coredata/document.go Outdated
Comment thread apps/console/src/pages/organizations/documents/_components/DocumentListItem.tsx Outdated
@SachaProbo SachaProbo marked this pull request as draft March 27, 2026 19:09
@SachaProbo SachaProbo force-pushed the SachaProbo/doc-confidentiality-to-version branch 2 times, most recently from a42924e to 340f8ee Compare March 27, 2026 20:34
@SachaProbo SachaProbo marked this pull request as ready for review March 27, 2026 20:42
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 16 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/console/src/pages/organizations/employee/_components/DocumentRow.tsx">

<violation number="1" location="apps/console/src/pages/organizations/employee/_components/DocumentRow.tsx:37">
P2: Guard against empty `lastVersion.edges` before reading `edges[0].node`, otherwise rendering will crash when no versions are returned.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@SachaProbo SachaProbo force-pushed the SachaProbo/doc-confidentiality-to-version branch 4 times, most recently from 7d823de to 3131ef5 Compare March 31, 2026 12:11
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>
@SachaProbo SachaProbo force-pushed the SachaProbo/doc-confidentiality-to-version branch from 3131ef5 to 5d6d0bd Compare March 31, 2026 12:12
@SachaProbo SachaProbo merged commit 5d6d0bd into main Mar 31, 2026
11 checks passed
@SachaProbo SachaProbo deleted the SachaProbo/doc-confidentiality-to-version branch March 31, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant