[comp] Production Deploy#2924
Conversation
[dev] [Marfuen] mariano/nist-sp800-53-readiness
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
* 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>
There was a problem hiding this comment.
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([ |
There was a problem hiding this comment.
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>
| const allTasks = deduplicateById([ | ||
| ...mappedDirectTasks, | ||
| ...mappedFrameworkTasks, |
There was a problem hiding this comment.
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>
| const allTasks = deduplicateById([ | |
| ...mappedDirectTasks, | |
| ...mappedFrameworkTasks, | |
| const allTasks = deduplicateById([ | |
| ...mappedFrameworkTasks, | |
| ...mappedDirectTasks, |
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
FrameworkControlsGrouped,FamilyFilterDropdown,GroupedControlRow, shared helpers/tests.controlFamilyon control templates; per-instanceFrameworkControlFamily; diff/preview now describe family changes; manifest/export/import/sync/rollback include families.@trycompai/design-systemand updates Tailwind content paths.Bug Fixes
Written for commit a32ec37. Summary will update on new commits. Review in cubic