Skip to content

[dev] [carhartlewis] lewis/comp-framework-editor#2355

Merged
carhartlewis merged 8 commits intomainfrom
lewis/comp-framework-editor
Mar 21, 2026
Merged

[dev] [carhartlewis] lewis/comp-framework-editor#2355
carhartlewis merged 8 commits intomainfrom
lewis/comp-framework-editor

Conversation

@github-actions
Copy link
Contributor

This is an automated pull request to merge lewis/comp-framework-editor into dev.
It was created by the [Auto Pull Request] action.

…s with CRUD operations

- Implemented ControlTemplate, PolicyTemplate, and Requirement modules, controllers, and services.
- Added DTOs for creating and updating control and policy templates.
- Integrated permission checks for all CRUD operations using @RequirePermission decorator.
- Enhanced the framework editor with new endpoints for managing templates and requirements.
@mintlify
Copy link
Contributor

mintlify bot commented Mar 21, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
CompAI 🟢 Ready View Preview Mar 21, 2026, 3:11 PM

@vercel
Copy link

vercel bot commented Mar 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app Skipped Skipped Mar 21, 2026 4:15pm
portal Skipped Skipped Mar 21, 2026 4:15pm

Request Review

@cursor
Copy link

cursor bot commented Mar 21, 2026

PR Summary

Medium Risk
Adds multiple new platform-admin-only CRUD/linking endpoints and a new framework-editor UI surface, plus changes to policy content serialization during org initialization; regressions could break editor workflows or create incorrect linkages/content shapes.

Overview
Introduces a Framework Editor backend surface: new framework, requirement, control-template, and policy-template modules/controllers/services with platform-admin-only CRUD plus linking endpoints (e.g., link/unlink requirements, policy templates, and task templates to control templates; link controls/tasks/policies to a framework). Also expands task-template behavior with a new create endpoint, optional fields/defaults, framework-scoped filtering, and automationStatus support.

Updates auth and initialization plumbing: adds trusted origins for the framework-editor app, adjusts better-auth access-control typing, and fixes org initialization to correctly map policy template TipTap JSON into Policy.content/PolicyVersion.content arrays.

Adds the framework-editor Next.js UI for admin-only login and managing frameworks (tabs), requirements, controls, policies (including TipTap content editing with JSON size validation), tasks, and document-to-control linking; includes minor UI styling tweaks in the main app control sheet.

Written by Cursor Bugbot for commit 39f27bc. This will update automatically on new commits. Configure here.

…mplate table

- Added migration to remove the documentTypes column, which will result in data loss.
- Updated Control model to include controlDocumentTypes relation.
…trolTemplate model

- Introduced documentTypes field to the FrameworkEditorControlTemplate model to support evidence form types.
- This addition enhances the framework editor's capability to manage document types associated with control templates.
…ramework Editor

- Introduced a new Prisma schema for the Framework Editor, defining models such as User, Attachment, and Session.
- Added a migration to create the necessary database structure for the new schema.
- This setup enhances the framework editor's capabilities for managing user sessions and attachments.
…ew validation

- Added ConflictException handling in delete methods for ControlTemplateService, FrameworkEditorFrameworkService, and PolicyTemplateService to prevent deletion of referenced templates.
- Updated data update logic in FrameworkEditorFrameworkService and PolicyTemplateService to conditionally include fields.
- Introduced MaxJsonSize validator for policy content to enforce size limits on JSON input.
- Enhanced UpdateTaskTemplateDto to include automationStatus field with validation.
- Removed deprecated NuqsWrapper component and cleaned up unused search query parameters in DataTable component.
…ard and remove RequirePermission decorators

- Replaced HybridAuthGuard and PermissionGuard with PlatformAdminGuard in ControlTemplate, Framework, PolicyTemplate, Requirement, and TaskTemplate controllers.
- Removed @RequirePermission decorators from various endpoints to streamline permission handling.
- Updated session validation logic in layout and auth pages to check for admin role.
- Adjusted authorization utility to enforce admin role requirement alongside internal user check.
… CRUD operations

- Updated ControlTemplate, PolicyTemplate, and TaskTemplate controllers and services to accept frameworkId as a query parameter for create and findAll methods.
- Modified service logic to conditionally include requirements and control templates based on the provided frameworkId.
- Enhanced CreateTaskTemplateDto to allow optional fields for better flexibility.
- Updated API documentation to reflect the new frameworkId parameter in relevant endpoints.
…, and policies

- Implemented new endpoints in FrameworkEditorFrameworkController to link controls, tasks, and policies to frameworks.
- Added corresponding service methods in FrameworkEditorFrameworkService for linking operations.
- Introduced a new AddExistingItemDialog component for selecting and linking existing items in the UI.
- Updated ControlTemplate, TaskTemplate, and PolicyTemplate services to include linked items in their data fetching logic.
- Enhanced API documentation to reflect the new linking endpoints and their parameters.
@vercel vercel bot temporarily deployed to Preview – app March 21, 2026 16:15 Inactive
@vercel vercel bot temporarily deployed to Preview – portal March 21, 2026 16:15 Inactive
@carhartlewis carhartlewis merged commit fccf989 into main Mar 21, 2026
14 checks passed
@carhartlewis carhartlewis deleted the lewis/comp-framework-editor branch March 21, 2026 16:17
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

}),
],
[handleControlLinked, handleControlUnlinked],
);
Copy link

Choose a reason for hiding this comment

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

Unstable function references defeat column memoization

Medium Severity

handleControlLinked and handleControlUnlinked are plain inline functions (not wrapped in useCallback) but appear in the dependency array of the useMemo for columns. Since new function references are created on every render, the memoization is effectively defeated, causing the entire column definition and table to re-render on every state change.

Additional Locations (1)
Fix in Cursor Fix in Web

try {
const serialized = JSON.stringify(value);
const maxBytes = (args.constraints[0] as number) ?? DEFAULT_MAX_BYTES;
return serialized.length <= maxBytes;
Copy link

Choose a reason for hiding this comment

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

MaxJsonSize validator compares characters not bytes

Low Severity

The MaxJsonSizeConstraint uses serialized.length (UTF-16 code unit count) but the variable is named maxBytes and the error message reports "KB". For content with multi-byte characters (e.g., CJK, emoji), string.length significantly underestimates the actual byte size, allowing payloads that exceed the intended 500 KB limit.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant