Skip to content
Open
Binary file modified .yarn/install-state.gz
Binary file not shown.
4 changes: 4 additions & 0 deletions server/modules/nodeDef/manager/nodeDefManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ const _onAncestorCyclesUpdate = async ({ survey, nodeDefAncestor, cycles, cycles
// perform updates in batch
await client.batch(batchUpdates)

// a descendant left with no cycles is a dangling node def (invisible in every cycle, but still
// occupying its name); soft-delete it instead of leaving it as a live orphan
await NodeDefRepository.markNodeDefsWithoutCyclesDeleted(surveyId, client)

return nodeDefsUpdated
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export default class NodeDefsValidationJob extends Job {
this.setContext({ surveyPublishedPrevious })

await NodeDefManager.deleteOrphaneNodeDefs(surveyId, tx)
// self-heal node defs left with an empty cycles array by past bugs (e.g. narrowing an
// ancestor entity's cycles), which would otherwise remain invisible ghosts blocking publish
// with false duplicate-name errors
await NodeDefManager.markNodeDefsWithoutCyclesDeleted(surveyId, tx)

const surveySummary = await SurveyManager.fetchSurveyById({ surveyId, draft: true }, tx)
const cycleKeys = R.pipe(Survey.getSurveyInfo, Survey.getCycleKeys)(surveySummary)
Expand Down
Loading