Skip to content

Git-backed namespace management#2326

Merged
shangyian merged 8 commits into
DataJunction:mainfrom
shangyian:flat-namespaces-git
Jul 13, 2026
Merged

Git-backed namespace management#2326
shangyian merged 8 commits into
DataJunction:mainfrom
shangyian:flat-namespaces-git

Conversation

@shangyian

@shangyian shangyian commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes git-backed DJ namespaces coherent to manage in the UI, and generalizes the backend that gates them. A namespace can be one of the following:

  • a git root (owns a repo, spawns branches)
  • a flat git namespace (tracks a branch directly)
  • an editable working branch
  • or a plain DJ namespace.

Each now presents a clean, single-line toolbar with one obvious way to view/manage/edit, along with consistent read-only enforcement across the namespace page, node pages, and the edit route.

Backend

  • Generalize the git-managed/read-only signal from is_git_root to is_repo_owner (github_repo_path set and no parent_namespace), which covers both git roots and flat namespaces.
  • git_only is now valid on any namespace (not just branches); enforcement (check_namespace_not_git_only) honors it uniformly.
  • On first git deploy, a namespace that tracks a repo is auto-locked as a repo owner (UI read-only) without a git_only write, so unlinking is just a config change.
  • Persist/normalize github_repo_path on deploy.

UI

  • One Git ▾ dropdown for low-frequency git actions that renders only the items valid for the current state.
  • NamespaceHeader is rewritten to a state-driven, single-line toolbar.
  • GitSettingsModal rewritten from a git-only checkbox / path form into an intent-based form:
Screenshot 2026-07-12 at 9 05 36 AM

Test Plan

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

Deployment Plan

shangyian and others added 4 commits July 11, 2026 22:56
Root always redirects; Git settings on the read-only default branch edits
the root's repo binding, flat/plain edit themselves, working branches drop
it. Removes the manageGit bypass/auto-open/navigate machinery.
A node in a flat/root git-backed namespace (read-only via shape, not the
git_only flag) still showed the Edit button. Drive NodePage's read-only
state from NamespaceHeader's onReadOnlyChange verdict (git_only OR flat/root
shape OR git-deployed), same signal that gates Add Node on the namespace page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- AddEditNodePage redirects /nodes/<name>/edit to the node view when the
  namespace is read-only (git-managed), and doesn't render the editor until
  the node is confirmed editable.
- NamespaceHeader reports the read-only verdict via onReadOnlyChange only once
  known (config + sources loaded), not a premature false on mount — which was
  what let the editor flash before redirecting.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 12, 2026

Copy link
Copy Markdown

Deploy Preview for thriving-cassata-78ae72 canceled.

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

shangyian and others added 2 commits July 12, 2026 08:48
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@shangyian shangyian changed the title Flat namespaces git Git-backed namespace management UX Jul 12, 2026
@shangyian shangyian changed the title Git-backed namespace management UX Git-backed namespace management Jul 12, 2026
shangyian and others added 2 commits July 12, 2026 13:28
… autolock/normalize

The Tier A change generalized check_namespace_not_git_only to block direct
user node create/update/delete in any git repo owner (github_repo_path set,
no parent_namespace), not just git_only namespaces. Six git tests configured
a namespace as a repo owner and THEN created nodes directly via the user node
API — now correctly rejected (422), so those creates never happened and the
sync/branch/git_info operations under test failed downstream.

Fix (resolution b — the blocked calls are genuine user node-API writes into a
read-only repo owner, not internal git flows): author the nodes BEFORE
configuring git, so setup uses the editable window and the operation under
test still exercises a git-backed namespace. Branch-copy remains internal
(copy_nodes_to_namespace, no guard) so branch creation still succeeds.

Coverage: add tests for the new deployments.py code on this branch —
_normalize_repo_path (scheme-prefix strip, .git strip, scp-style colon,
single-segment) and the _verify_git_deployment skip path for a git_only
namespace with no github_repo_path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
test_create_branch_cleanup_namespace_fails_gracefully created its two parent
source nodes AFTER configuring git, so once the parent became a git repo owner
those user node-API POSTs were rejected (422). The parent then had no nodes to
copy into the branch, so when the branch-create rollback fired,
_cleanup_namespace_and_nodes iterated an empty list and never executed the
`await session.delete(node)` delete-loop body (branches.py:232).

Author the nodes before configuring git (same read-only repo-owner model as the
other git tests). The nodes now get copied into the branch namespace, so the
rollback's cleanup deletes >=1 node and line 232 is exercised again. Confirmed
branches.py back to 100% under tests/api/git_test.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@shangyian
shangyian marked this pull request as ready for review July 13, 2026 00:01
@shangyian
shangyian merged commit 9c5fdf6 into DataJunction:main Jul 13, 2026
21 checks passed
@shangyian
shangyian deleted the flat-namespaces-git branch July 13, 2026 00:02
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