From 9b6e610afcde183fe5fc177933fef60867cf6464 Mon Sep 17 00:00:00 2001 From: Tofik Hasanov Date: Wed, 10 Jun 2026 13:42:44 -0400 Subject: [PATCH 1/5] feat(evidence-forms): add Account Types document type (CS-513) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a new "Account Types" evidence document type so it can be linked to NIST SP 800-53 controls in the framework editor. The form is a table of [Account Type, Allowed/Disallowed, Justification] pre-seeded with the 10 standard account types. This required two small, reusable additions to the evidence-form platform: - matrix columns can now be dropdown picklists (type: 'select' + options), not just free text; - matrix fields can ship default/seed rows. Conditional validation: a Justification is required only when a row is Allowed; Disallowed rows may leave it blank. Touch points (the current — code-only — way to add a document type): - EvidenceFormType enum + migration (packages/db) - @trycompai/company: form-types, db-form-type-map, types, definitions, submission-schemas - app wizard renders select columns + seeded rows (MatrixCellControl) - framework-editor DOCUMENT_TYPE_OPTIONS + app DOCUMENT_TYPE_LABELS Tests: 8 definition/validation specs + 1 wizard render spec (10 seeded rows, Allowed/Disallowed dropdowns, prefilled values). Co-Authored-By: Claude Fable 5 --- ...anySubmissionWizard.account-types.test.tsx | 66 ++++++++++++++ .../components/CompanySubmissionWizard.tsx | 67 +++++++++++--- .../components/account-types-form.test.ts | 87 +++++++++++++++++++ .../documents/components/submission-utils.tsx | 2 + .../components/documentTypeLabels.ts | 1 + .../(pages)/controls/document-type-options.ts | 1 + .../src/evidence-forms/db-form-type-map.ts | 2 + .../company/src/evidence-forms/definitions.ts | 52 +++++++++++ .../company/src/evidence-forms/form-types.ts | 1 + .../src/evidence-forms/submission-schemas.ts | 55 ++++++++++++ packages/company/src/evidence-forms/types.ts | 6 ++ .../migration.sql | 2 + packages/db/prisma/schema/shared.prisma | 1 + 13 files changed, 329 insertions(+), 14 deletions(-) create mode 100644 apps/app/src/app/(app)/[orgId]/documents/components/CompanySubmissionWizard.account-types.test.tsx create mode 100644 apps/app/src/app/(app)/[orgId]/documents/components/account-types-form.test.ts create mode 100644 packages/db/prisma/migrations/20260610133701_add_account_types_evidence_form_type/migration.sql diff --git a/apps/app/src/app/(app)/[orgId]/documents/components/CompanySubmissionWizard.account-types.test.tsx b/apps/app/src/app/(app)/[orgId]/documents/components/CompanySubmissionWizard.account-types.test.tsx new file mode 100644 index 0000000000..cc4c13044c --- /dev/null +++ b/apps/app/src/app/(app)/[orgId]/documents/components/CompanySubmissionWizard.account-types.test.tsx @@ -0,0 +1,66 @@ +import { fireEvent, render, screen, waitFor, within } from '@testing-library/react'; +import { describe, expect, it, vi } from 'vitest'; + +vi.mock('next/navigation', () => ({ + useRouter: () => ({ push: vi.fn(), refresh: vi.fn() }), +})); +vi.mock('@/lib/api-client', () => ({ api: { post: vi.fn() } })); +vi.mock('@/components/file-uploader', () => ({ FileUploader: () =>
})); +vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); + +// Light design-system mock: render a Select as a native , + Section: Passthrough, + Text: ({ children }: any) => {children}, + Textarea: (props: any) =>