Move document classification from document to document version#952
Open
SachaProbo wants to merge 1 commit intomainfrom
Open
Move document classification from document to document version#952SachaProbo wants to merge 1 commit intomainfrom
SachaProbo wants to merge 1 commit intomainfrom
Conversation
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.
apps/console/src/pages/organizations/documents/_components/DocumentListItem.tsx
Outdated
Show resolved
Hide resolved
apps/console/src/pages/organizations/documents/_components/DocumentLayoutDrawer.tsx
Show resolved
Hide resolved
a42924e to
340f8ee
Compare
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.
apps/console/src/pages/organizations/employee/_components/DocumentRow.tsx
Show resolved
Hide resolved
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>
340f8ee to
019e489
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 support per‑version classification. Console editing is limited to draft versions; published versions are read‑only, and APIs/clients were updated accordingly.New Features
updateDocumentVersionon drafts.createDocumentstill acceptsclassification; applied to the first version. New drafts inherit the previous version’s classification.classificationexposed onEmployeeDocumentVersion; removed fromDocument/EmployeeDocument.Migration
documents.classification.classificationfrom GraphQLDocument/EmployeeDocumentand fromUpdateDocumentInput; read it from the latest version instead.updateDocumentVersionto change classification;UpdateDocumentVersionInputnow has optionalcontentand optionalclassification.classificationonDocument;classificationoptional onUpdateDocumentVersionInput.Written for commit 019e489. Summary will update on new commits.