Skip to content

Remove deleted files as a part of the git sync path#2152

Merged
shangyian merged 2 commits into
DataJunction:mainfrom
shangyian:delete-nodes-sync-git
May 20, 2026
Merged

Remove deleted files as a part of the git sync path#2152
shangyian merged 2 commits into
DataJunction:mainfrom
shangyian:delete-nodes-sync-git

Conversation

@shangyian
Copy link
Copy Markdown
Collaborator

@shangyian shangyian commented May 20, 2026

Summary

With this PR, deactivating nodes and then clicking "Sync to Git" now actually removes the stale YAMLs from the branch, rather than leaving orphans behind or 422-ing on empty namespaces.

The changes include:

  • sync_namespace_to_git now detects orphan YAMLs in the existing git tree (paths under git_path that don't correspond to any active node in the namespace (e.g. deactivated nodes), and includes them as deletions in the same commit. dj.yaml is filtered out so it's never deleted.
  • Removes the early 422 "namespace has no nodes to sync" error so a namespace whose nodes were all deactivated can still push the resulting deletions.
  • GitHubService.commit_files accepts a deletions list, which are added to the tree as entries, which removes the path from the base tree in a single Git Data API commit.
  • In the UI the success message includes a deleted N file(s) log when deletions occurred.

Test Plan

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for thriving-cassata-78ae72 canceled.

Name Link
🔨 Latest commit d005856
🔍 Latest deploy log https://app.netlify.com/projects/thriving-cassata-78ae72/deploys/6a0dd7aef59e640008b117e4

@shangyian shangyian changed the title Emit deleted files as a part of the git sync namespace path Remove deleted files as a part of the git sync path May 20, 2026
@shangyian shangyian marked this pull request as ready for review May 20, 2026 17:27
@shangyian shangyian merged commit b940b1d into DataJunction:main May 20, 2026
21 checks passed
@shangyian shangyian deleted the delete-nodes-sync-git branch May 20, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant