Skip to content

Move document classification from document to document version#952

Open
SachaProbo wants to merge 1 commit intomainfrom
SachaProbo/doc-confidentiality-to-version
Open

Move document classification from document to document version#952
SachaProbo wants to merge 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 support per‑version classification. Console editing is limited to draft versions; published versions are read‑only, and APIs/clients were updated accordingly.

  • New Features

    • Classification is now version‑scoped; edit via updateDocumentVersion on drafts.
    • createDocument still accepts classification; applied to the first version. New drafts inherit the previous version’s classification.
    • PDF and console views read classification from the version.
    • GraphQL: classification exposed on EmployeeDocumentVersion; removed from Document/EmployeeDocument.
  • Migration

    • Run the DB migration to drop documents.classification.
    • Remove classification from GraphQL Document/EmployeeDocument and from UpdateDocumentInput; read it from the latest version instead.
    • Use updateDocumentVersion to change classification; UpdateDocumentVersionInput now has optional content and optional classification.
    • Update MCP clients: no classification on Document; classification optional on UpdateDocumentVersionInput.

Written for commit 019e489. Summary will update on new commits.

Copy link
Copy Markdown

@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.

@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

@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.

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 340f8ee to 019e489 Compare March 27, 2026 20:49
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