Move document classification from document to document version#952
Merged
SachaProbo merged 1 commit intomainfrom Mar 31, 2026
Merged
Move document classification from document to document version#952SachaProbo merged 1 commit intomainfrom
SachaProbo merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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.
a42924e to
340f8ee
Compare
Contributor
There was a problem hiding this comment.
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.
7d823de to
3131ef5
Compare
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>
3131ef5 to
5d6d0bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
DocumenttoDocumentVersionto enable per‑version classification. UI, APIs, and PDFs now use version classification; drafts are editable, published versions are read‑only.New Features
updateDocumentVersionon drafts only.createDocumentstill acceptsclassification; applied to the first version. New drafts inherit the previous version’s classification.EmployeeDocumentVersion.classification; removedclassificationfromDocument/EmployeeDocument.UpdateDocumentVersionInputnow has optionalcontentand optionalclassification.Migration
documents.classificationdefault toSECRET; the column will be dropped later.classificationfrom GraphQLDocument/EmployeeDocumentand fromUpdateDocumentInput; read from the latest version instead.updateDocumentVersionwithdocumentVersionIdto change classification; pass optionalclassification(and optionalcontent). Update MCP clients similarly.Written for commit 5d6d0bd. Summary will update on new commits.