Skip to content

[comp] Production Deploy#2924

Open
github-actions[bot] wants to merge 3 commits into
releasefrom
main
Open

[comp] Production Deploy#2924
github-actions[bot] wants to merge 3 commits into
releasefrom
main

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 25, 2026

This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.


Summary by cubic

Adds control family grouping so large frameworks are easier to browse, plus fixes custom framework link handling so policies, tasks, and documents show up correctly. Run Prisma migrations when deploying; no breaking changes—families are optional and the UI falls back to a flat list.

  • New Features

    • Framework controls: grouped view with collapsible families, search, pagination, and a family filter; auto-enables when families exist, otherwise shows the flat list.
    • New UI components and tests: FrameworkControlsGrouped, FamilyFilterDropdown, GroupedControlRow, shared helpers/tests.
    • Framework editor: Control Family column (combobox) to set/edit families, Manage Families dialog (rename/delete with impact preview), batch updates and hooks.
    • API/DB: controlFamily on control templates; per-instance FrameworkControlFamily; diff/preview now describe family changes; manifest/export/import/sync/rollback include families.
    • Build config: transpiles @trycompai/design-system and updates Tailwind content paths.
  • Bug Fixes

    • Custom frameworks: policies, tasks, and documents now appear by merging framework-scoped and direct links with dedup across all read paths (detail, list, requirement views), fixing compliance scores.
    • Write-side sync mirrors direct policy/task/document links into framework-scoped junctions for all custom framework instances using a control; fast no-op when an org has no custom frameworks.
    • Unlink cascades run in a single transaction and clean up framework-scoped links for custom frameworks; guarded to avoid deleting explicitly-scoped links.
    • Utilities/tests: shared dedup helpers; unit tests for controls and custom-framework sync.

Written for commit a32ec37. Summary will update on new commits. Review in cubic

@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

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

Project Deployment Actions Updated (UTC)
comp-framework-editor (staging) Ready Ready Preview, Comment May 26, 2026 3:27pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app (staging) Skipped Skipped May 26, 2026 3:27pm
portal (staging) Skipped Skipped May 26, 2026 3:27pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 45 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

* fix(controls): include direct policy/task links in custom framework view

Custom frameworks never populate FrameworkControlPolicyLink/TaskLink
junction tables, so findOneForFramework returned empty policies/tasks.
Now merges both framework-scoped and direct relationships with dedup.

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

* fix(controls): scope direct-link fallback to custom frameworks only

Avoids regression for built-in frameworks where framework-scoped links
are intentionally per-framework. Also applies the same fix to
findRequirement() in frameworks service for list/detail consistency.
Extracts deduplicateById to shared util.

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

* fix(controls): write-side sync + complete read fallback for custom frameworks

Write side: syncDirectLinksToCustomFrameworks mirrors direct policy/task/
document links into framework-scoped junction tables for all custom FIs
using a control. Called from linkPolicies/linkTasks/linkDocumentTypes
(no frameworkInstanceId) and linkControlsToRequirement (custom FI).

Read side: all 4 read paths (findOneForFramework, findOne, findAll,
findRequirement) fall back to direct relationships for custom frameworks,
covering existing data without a migration.

Extracts mergeControlLinks helper to deduplicate mapping logic between
findOne and findRequirement. Collapses deduplicateById/deduplicateByFormType
into a generic deduplicateBy.

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

* perf(controls): early exit sync when org has no custom frameworks

Avoids the requirementMap query on every direct-link operation for
orgs that don't use custom frameworks (vast majority of traffic).

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

* fix(controls): clean up framework-scoped doc links on direct unlink

When unlinking a direct ControlDocumentType, also delete the
corresponding FrameworkControlDocumentTypeLink rows for custom
framework instances. Prevents stale evidence showing up in custom
framework views after the direct link is removed.

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

* fix(controls): only cascade doc-link cleanup when direct link existed

Skip framework-scoped cleanup if deleteMany removed 0 direct rows,
preventing deletion of explicitly-scoped custom framework links.

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

* fix(controls): complete custom framework link coverage

- removePolicyControl: cascade-delete framework-scoped policy links
  for custom FIs when disconnecting a policy from a control
- findAll: add custom framework fallback for policies, documents, and
  tasks so dashboard compliance scores are correct
- create: sync framework-scoped links within the creation transaction
  when the control is mapped to custom framework requirements

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

* fix(controls): guard policy cleanup and fix task dedup ordering

- removePolicyControl: check link exists before cascading framework-
  scoped cleanup, preventing deletion of explicitly-scoped links
- findAll: filter empty-controls tasks before dedup and prioritize
  direct tasks, so custom framework tasks aren't dropped by
  empty framework-scoped entries shadowing valid direct entries

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

* fix(controls): wrap unlink cascades in transactions

Both removePolicyControl and unlinkDocumentType now run their
direct-link removal and framework-scoped cleanup in a single
transaction, preventing partial state on failure.

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

---------

Co-authored-by: Mariano Fuentes <marfuen98@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 7 files (changes from recent commits).

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/api/src/frameworks/frameworks.service.ts">

<violation number="1" location="apps/api/src/frameworks/frameworks.service.ts:353">
P2: Deduplication order is inconsistent between `findAll` and `findOne`. Since `deduplicateById` keeps the first occurrence, direct tasks win in `findAll` but framework tasks win in `findOne`. This can produce different `controls` arrays for the same task depending on the endpoint, leading to inconsistent compliance scores.</violation>
</file>

<file name="apps/api/src/controls/sync-custom-framework-links.ts">

<violation number="1" location="apps/api/src/controls/sync-custom-framework-links.ts:57">
P1: Wrap the multi-table link writes in a transaction to avoid partial sync state when one `createMany` fails.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic


const fiIds = customFiIds.map((r) => r.frameworkInstanceId);

await Promise.all([
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot May 26, 2026

Choose a reason for hiding this comment

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

P1: Wrap the multi-table link writes in a transaction to avoid partial sync state when one createMany fails.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/api/src/controls/sync-custom-framework-links.ts, line 57:

<comment>Wrap the multi-table link writes in a transaction to avoid partial sync state when one `createMany` fails.</comment>

<file context>
@@ -0,0 +1,92 @@
+
+  const fiIds = customFiIds.map((r) => r.frameworkInstanceId);
+
+  await Promise.all([
+    control.policies.length > 0 &&
+      prisma.frameworkControlPolicyLink.createMany({
</file context>
Fix with Cubic

Comment on lines +353 to +355
const allTasks = deduplicateById([
...mappedDirectTasks,
...mappedFrameworkTasks,
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot May 26, 2026

Choose a reason for hiding this comment

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

P2: Deduplication order is inconsistent between findAll and findOne. Since deduplicateById keeps the first occurrence, direct tasks win in findAll but framework tasks win in findOne. This can produce different controls arrays for the same task depending on the endpoint, leading to inconsistent compliance scores.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/api/src/frameworks/frameworks.service.ts, line 353:

<comment>Deduplication order is inconsistent between `findAll` and `findOne`. Since `deduplicateById` keeps the first occurrence, direct tasks win in `findAll` but framework tasks win in `findOne`. This can produce different `controls` arrays for the same task depending on the endpoint, leading to inconsistent compliance scores.</comment>

<file context>
@@ -232,41 +280,90 @@ export class FrameworksService {
+            controls: (controls as any[]).filter((c) => fwControlIds.has(c.id)),
+          }))
+        : [];
+      const allTasks = deduplicateById([
+        ...mappedDirectTasks,
+        ...mappedFrameworkTasks,
</file context>
Suggested change
const allTasks = deduplicateById([
...mappedDirectTasks,
...mappedFrameworkTasks,
const allTasks = deduplicateById([
...mappedFrameworkTasks,
...mappedDirectTasks,
Fix with Cubic

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.

0 participants