Conversation
…tion
Org creation reads controls/policies/tasks/requirements from each
framework's pinned FrameworkVersion.manifest (a frozen snapshot), then
creates org rows whose template FKs point at the LIVE framework-editor
tables. When a template is hard-deleted from the editor after a version
is published, the manifest still references the dead id, so the insert
fails with a P2003 foreign-key violation and onboarding aborts.
This surfaced as Task_taskTemplateId_fkey for any org selecting PCI DSS:
its only published version (1.0.0) references two task templates
("Attestation of Compliance", "Self-Assessment Questionnaires") that were
later deleted from the editor.
loadFrameworkSources now reconciles manifest-sourced ids against the live
editor tables and prunes any whose row no longer exists, before they reach
createMany. Covers controls, policies, tasks AND requirements — the first
three are already tolerated by the downstream instance-map guards, but
RequirementMap.requirementId has no such guard, so dead requirement ids are
filtered out of groupedRelations explicitly. A console.warn logs what was
pruned so stale manifests are observable.
Applied to both independent loader copies (app cannot import from api).
Tests: new load-framework-sources specs (vitest + jest) covering each
dead-ref case and the all-live passthrough/automationStatus path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nifest-fk fix(frameworks): prune deleted editor templates during org initialization
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Contributor
|
🎉 This PR is included in version 3.66.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Prevents org setup from failing when a published framework version points to deleted editor templates by reconciling manifest IDs with live tables and pruning dead references before inserts. Applies to both
apps/apiandapps/app, with tests covering stale-reference cases and the all-live path.frameworkEditor*tables, avoiding P2003 FK errors (e.g., Task_taskTemplateId_fkey).automationStatusfrom live rows.RequirementMap_requirementId_fkeyfailures.Written for commit 113c239. Summary will update on new commits.