-
Notifications
You must be signed in to change notification settings - Fork 6
feat(cli): pull per-workflow deletion dependencies into transcend.yml #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
iamtheluckyest
merged 5 commits into
main
from
annalisa/wal-10452-pull-per-workflow-deletion-dependencies
Aug 18, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6a5d8b4
feat(cli): pull per-workflow deletion dependencies into transcend.yml
iamtheluckyest ad8400a
fix(cli): emit full object[] when pull has deletion-dependency overrides
iamtheluckyest c812d28
fix(cli): rename DeletionDependencyObject import after push merge
iamtheluckyest c02170d
Add comments, small refactor
iamtheluckyest f36ecf6
fix(cli): use workflowInternalName for deletion-dependency pull
iamtheluckyest File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
.changeset/wal-10452-pull-per-workflow-deletion-dependencies.md
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
| 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`. |
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
| 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). | ||
| * | ||
| * @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, | ||
| ], | ||
| }; | ||
| } | ||
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
80 changes: 80 additions & 0 deletions
80
packages/cli/src/lib/tests/buildDeletionDependencies.test.ts
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
| 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'] }], | ||
| }); | ||
| }); | ||
| }); |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.