Skip to content

[dev] [Marfuen] feat/framework-instance-requirements#2370

Open
github-actions[bot] wants to merge 25 commits intomainfrom
feat/framework-instance-requirements
Open

[dev] [Marfuen] feat/framework-instance-requirements#2370
github-actions[bot] wants to merge 25 commits intomainfrom
feat/framework-instance-requirements

Conversation

@github-actions
Copy link
Contributor

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

Marfuen and others added 25 commits March 24, 2026 16:56
…ents

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Create NestJS module for managing custom framework instance requirements
scoped to the customer's organization. Includes full CRUD with org-level
authorization via HybridAuthGuard + PermissionGuard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… enabled

Adds advancedModeEnabled prop through page -> Overview -> FrameworksOverview chain.
When enabled, framework rows link to their detail page. Otherwise, they remain static.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…detail page

Adds RequirementMapWithControl, InstanceRequirementWithMaps, TemplateRequirement,
and FrameworkInstanceDetail types. Creates useFrameworkInstance SWR hook for
client-side data fetching. Updates detail page to pass instance requirement data
to new FrameworkRequirementsList component and adds generateMetadata.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove separate FrameworkRequirementsList - all requirements (template
and custom) now appear in the same table without visual distinction.
Add Requirement button and delete action for custom requirements.
Use design-system Sheet/Drawer, Field/FieldGroup/FieldLabel/FieldError,
SheetBody/SheetFooter components instead of ui/* equivalents.
Update findRequirement API to look up both template and instance
requirements, and query RequirementMap by either requirementId or
frameworkInstanceRequirementId. Remove isCustom guard on row click.
…ls multi-select on create requirement sheet

- Add CreateControlForRequirementSheet to requirement detail page
- Update controls API to support frameworkInstanceRequirementId in mappings
- Add controlIds field to create requirement API for linking controls
- Add controls multi-select dropdown to CreateRequirementSheet
MultipleSelector caches defaultOptions on first render, so we need
to wait for the SWR fetch to complete and use a key to force re-mount
when controls data arrives.
Replace @trycompai/ui MultipleSelector with @trycompai/design-system
Combobox, ComboboxChips, ComboboxChip, ComboboxContent, ComboboxList,
ComboboxItem, ComboboxEmpty components.
Pass controls from the framework instance instead of fetching all
org controls. Controls now come from frameworkInstanceWithControls.
- Add DS Combobox multi-selects for tasks and policies in
  CreateControlForRequirementSheet
- Fetch available tasks/policies from controls options API
- Switch all buttons and icons to @trycompai/design-system components
- Controls options API now returns both template and custom requirements
- CreateControlSheet handles isInstanceRequirement flag to send correct
  mapping (requirementId vs frameworkInstanceRequirementId)
- Updated useControls payload type to support both mapping types
…quirements

- Include frameworkInstanceRequirement in controls API includes
- Update RequirementsTable to read from either requirement or
  frameworkInstanceRequirement (whichever is present)
@cursor
Copy link

cursor bot commented Mar 25, 2026

PR Summary

Medium Risk
Introduces a new persisted requirement type and API surface, plus a DB migration that relaxes RequirementMap.requirementId nullability and adds new uniqueness constraints; mistakes could break existing mappings or writes. UI now reads/writes both template and custom requirements, so regressions could affect control/requirement linking and navigation.

Overview
Adds custom requirements per framework instance by introducing FrameworkInstanceRequirement in Prisma (with migration), allowing RequirementMap to reference either a template requirement (requirementId) or a custom one (frameworkInstanceRequirementId).

Extends the API to CRUD these custom requirements via new v1/framework-instance-requirements endpoints (guarded by framework permissions), updates FrameworksService and ControlsService to return and accept custom requirements/mappings, and updates the app UI to list/create/delete custom requirements and create controls mapped to either requirement type (including updated navigation/search in requirements tables).

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

@vercel
Copy link

vercel bot commented Mar 25, 2026

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

Project Deployment Actions Updated (UTC)
app Error Error Mar 25, 2026 6:45pm
comp-framework-editor Ready Ready Preview, Comment Mar 25, 2026 6:45pm
portal Ready Ready Preview, Comment Mar 25, 2026 6:45pm

Request Review

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.

@IsOptional()
@IsString()
requirementId: string;
frameworkInstanceRequirementId?: string;
Copy link

Choose a reason for hiding this comment

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

RequirementMapping allows creating orphaned maps without any requirement

High Severity

RequirementMappingDto makes both requirementId and frameworkInstanceRequirementId optional with no cross-field validation ensuring at least one is provided. The create method uses conditional spreads that silently skip both when neither is present, producing a RequirementMap row that references no requirement at all — an orphaned record that bypasses both @@unique constraints (since NULL ≠ NULL in PostgreSQL unique indexes).

Additional Locations (1)
Fix in Cursor Fix in Web

>
<TrashCan size={16} />
</Button>
)}
Copy link

Choose a reason for hiding this comment

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

Delete button shown without checking delete permission

Medium Severity

The delete button for custom requirements is rendered based only on item.isCustom, without checking hasPermission('framework', 'delete'). The backend enforces @RequirePermission('framework', 'delete'), so users without that permission see a button that always fails. Other delete UIs in this codebase (e.g., FrameworkOverview) wrap delete actions with hasPermission checks.

Fix in Cursor Fix in Web

@mintlify
Copy link
Contributor

mintlify bot commented Mar 25, 2026

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

Project Status Preview Updated (UTC)
CompAI 🟢 Ready View Preview Mar 25, 2026, 6:54 PM

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