Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@transcend-io/cli": minor
"@transcend-io/sdk": minor
---

`transcend inventory pull` now writes per-workflow deletion dependencies into `transcend.yml`. Global-only configs stay as a list of titles; once any override exists, the whole field is written as objects. Overrides on workflows without an internal name are skipped with a warning, since `transcend.yml` references workflows by internal name.

`DataSiloEnriched` gains `dependedOnDataSilosPerWorkflow`.
46 changes: 46 additions & 0 deletions packages/cli/src/lib/graphql/buildDeletionDependencies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import type { DataSiloEnriched } from '@transcend-io/sdk';

import type { DataSiloInput } from '../../codecs.js';

/**
* Build the `deletion-dependencies` entries for a data silo being pulled into transcend.yml.
*
* With no per-workflow overrides, global dependencies stay as a list of titles so existing
* configurations round-trip unchanged. When overrides exist, the whole field is a list of
* objects (`{ titles }` for global, `{ workflow, titles }` for each override).
Comment on lines +8 to +10

@iamtheluckyest iamtheluckyest Aug 11, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is not ideal long-term, but I think we have to make a choice in terms of which way to return the data (list of strings or list of objects) and I think this is best to be non-breaking. But long-term, we would want to transition users over to use the list of objects no matter what.

Maybe we have a flag that they pass in that tells us if they want a list of global-only dependencies to be returned as objects? But at some point code would have to be updated to add/remove that flag, so I'm not sure it's a huge benefit (for us or them) over supporting both.

*
* @param dataSilo - The data silo being pulled
* @returns The `deletion-dependencies` field, or an empty object when there is nothing to write
*/
export function buildDeletionDependenciesInput(
dataSilo: Pick<DataSiloEnriched, 'dependentDataSilos' | 'dependedOnDataSilosPerWorkflow'>,
): Pick<DataSiloInput, 'deletion-dependencies'> {
const { dependentDataSilos, dependedOnDataSilosPerWorkflow } = dataSilo;

const globalTitles = dependentDataSilos.map(({ title }) => title);

const workflowOverrides = dependedOnDataSilosPerWorkflow.map(
({ workflowInternalName, dependedOnDataSilos }) => ({
workflow: workflowInternalName,
titles: dependedOnDataSilos.map(({ title }) => title),
}),
);

// If there are no global or workflow dependencies, return an empty object
if (globalTitles.length === 0 && workflowOverrides.length === 0) {
return {};
}

// If there are no workflow overrides, return the global titles as string[], to keep legacy behavior
if (workflowOverrides.length === 0) {
return { 'deletion-dependencies': globalTitles };
}

// If there are workflow overrides, return a list of objects
return {
'deletion-dependencies': [
...(globalTitles.length > 0 ? [{ titles: globalTitles }] : []),
...workflowOverrides,
],
};
}
11 changes: 6 additions & 5 deletions packages/cli/src/lib/graphql/pullTranscendConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ import {
} from '../../codecs.js';
import { TranscendPullResource } from '../../enums.js';
import { logger } from '../../logger.js';
import { buildDeletionDependenciesInput } from './buildDeletionDependencies.js';
import { fetchAllAssessmentTemplates } from './fetchAllAssessmentTemplates.js';

export const DEFAULT_TRANSCEND_PULL_RESOURCES = [
Expand Down Expand Up @@ -1519,6 +1520,7 @@ export async function pullTranscendConfiguration(
notifyEmailAddress,
identifiers,
dependentDataSilos,
dependedOnDataSilosPerWorkflow,
owners,
country,
countrySubDivision,
Expand Down Expand Up @@ -1548,11 +1550,10 @@ export async function pullTranscendConfiguration(
'identity-keys': identifiers
.filter(({ isConnected }) => isConnected)
.map(({ name }) => name),
...(dependentDataSilos.length > 0
? {
'deletion-dependencies': dependentDataSilos.map(({ title }) => title),
}
: {}),
...buildDeletionDependenciesInput({
dependentDataSilos,
dependedOnDataSilosPerWorkflow,
}),
...(owners.length > 0 ? { owners: owners.map(({ email }) => email) } : {}),
...(teams.length > 0 ? { teams: teams.map(({ name }) => name) } : {}),
...(discoveredBy.length > 0
Expand Down
80 changes: 80 additions & 0 deletions packages/cli/src/lib/tests/buildDeletionDependencies.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { expect, describe, it } from 'vitest';

import { buildDeletionDependenciesInput } from '../graphql/buildDeletionDependencies.js';

describe('buildDeletionDependenciesInput', () => {
it('omits the field when there are no dependencies', () => {
expect(
buildDeletionDependenciesInput({
dependentDataSilos: [],
dependedOnDataSilosPerWorkflow: [],
}),
).to.deep.equal({});
});

it('writes global dependencies as the string shorthand', () => {
expect(
buildDeletionDependenciesInput({
dependentDataSilos: [{ title: 'Identity Service' }],
dependedOnDataSilosPerWorkflow: [],
}),
).to.deep.equal({ 'deletion-dependencies': ['Identity Service'] });
});

it('writes workflow overrides as a full object list', () => {
expect(
buildDeletionDependenciesInput({
dependentDataSilos: [{ title: 'Identity Service' }],
dependedOnDataSilosPerWorkflow: [
{
workflowConfigId: 'wf-gdpr',
workflowInternalName: 'GDPR Erasure',
dependedOnDataSilos: [{ title: 'Identity Service' }, { title: 'CRM Warehouse' }],
},
],
}),
).to.deep.equal({
'deletion-dependencies': [
{ titles: ['Identity Service'] },
{ workflow: 'GDPR Erasure', titles: ['Identity Service', 'CRM Warehouse'] },
],
});
});

it('keeps an explicit empty override distinguishable from an absent one', () => {
expect(
buildDeletionDependenciesInput({
dependentDataSilos: [{ title: 'Identity Service' }],
dependedOnDataSilosPerWorkflow: [
{
workflowConfigId: 'wf-gdpr',
workflowInternalName: 'GDPR Erasure',
dependedOnDataSilos: [],
},
],
}),
).to.deep.equal({
'deletion-dependencies': [
{ titles: ['Identity Service'] },
{ workflow: 'GDPR Erasure', titles: [] },
],
});
});

it('omits the global object when only workflow overrides are present', () => {
expect(
buildDeletionDependenciesInput({
dependentDataSilos: [],
dependedOnDataSilosPerWorkflow: [
{
workflowConfigId: 'wf-gdpr',
workflowInternalName: 'GDPR Erasure',
dependedOnDataSilos: [{ title: 'Identity Service' }],
},
],
}),
).to.deep.equal({
'deletion-dependencies': [{ workflow: 'GDPR Erasure', titles: ['Identity Service'] }],
});
});
});
17 changes: 16 additions & 1 deletion packages/sdk/src/data-inventory/fetchEnrichedDataSilos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,26 @@ export interface DataSiloEnriched {
/** True if identifier is wired */
isConnected: boolean;
}[];
/** Dependent data silos */
/** Dependent data silos that apply to every erasure workflow */
dependentDataSilos: {
/** Title of silo */
title: string;
}[];
/**
* Dependent data silos for the erasure workflows that override the global configuration.
* An entry with an empty list is a workflow that runs this data silo with no dependencies.
*/
dependedOnDataSilosPerWorkflow: {
/** ID of the workflow config the override applies to */
workflowConfigId: string;
Comment thread
iamtheluckyest marked this conversation as resolved.
/** Internal name of the workflow config; used as the transcend.yml workflow key */
workflowInternalName: string;
/** Silos depended on within that workflow */
dependedOnDataSilos: {
/** Title of silo */
title: string;
}[];
}[];
/** Silo owners */
owners: {
/** Email owners */
Expand Down
7 changes: 7 additions & 0 deletions packages/sdk/src/data-inventory/gqls/dataSilo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ export const DATA_SILOS_ENRICHED = gql`
dependentDataSilos {
title
}
dependedOnDataSilosPerWorkflow {
workflowConfigId
workflowInternalName
dependedOnDataSilos {
title
}
}
owners {
email
}
Expand Down
Loading