Repository navigation
feat: add independent bench and site cloning - #557
Open
BreadGenie wants to merge 51 commits into
Open
BreadGenie wants to merge 51 commits into
BreadGenie wants to merge 51 commits into
Conversation
Add pilot fork with source inference from the current bench, fresh site snapshots, independent Git worktrees, and isolated databases and files. Support reusable fixture templates and overlap artifact copying with database restore. Serialize bench creation, reserve all runtime ports, and preserve worktree registrations during app moves and cleanup.
Copy app code with filesystem cloning where supported, materialize independent Git repositories, and recreate editable Python environments. Stream fresh MariaDB/PostgreSQL database copies directly into separate databases, copy uploads and default UAT sites to paused scheduling and muted email. The fresh fork command composes these primitives; prepared worktrees remain explicit. Add authenticated Admin clone actions, destination selection and existing task progress. Validate isolation, stream failures, authorization, idempotency and conflicts. Targeted tests: 123 passed; frontend build and 73 tests passed. Full suite: 3008 passed, 1 skipped, with the existing template-fuzzer failure. Real MariaDB UI/CLI and source-write isolation verified.
Use source Git credentials for branch discovery and fetching, discard copied worktree registrations, and prepare nested frontend dependencies before builds. Respect site database connection settings and resolve Homebrew PostgreSQL clients. Return active idempotent clone tasks before validating destination existence. Validation: 421 focused tests passed; changed-file lint, formatting and whitespace checks passed. Full suite: 3044 passed, 1 skipped, with one existing template fuzz failure reproduced on develop.
Contributor
[High impact] The reviewed changes appear safe to merge. Reviews (34) · Last reviewed commit: "fix: validate clone databases and preser..." · Reviewed by Greptile |
|
Guard · Confidence 1/5 (apex) · risk high · 9 new findings (9 P1) · 13 open from earlier reviews (13 P1) Affects 713 callers in 190 files. 9 callers may break. Summary
Confidence and Risk
FindingsImpactflowchart LR
n0["route:POST benches_bp:*/actions/clone"]:::changed
n1["clone_bench"]:::changed
n2["route:GET benches_bp:*/clone-branch-options"]:::changed
n3["clone_branch_options"]:::changed
n4["get_clone_bench_name"]:::changed
n5["get_clone_site_names"]:::changed
n6["clone_site"]:::changed
n7["route:POST sites_bp:*/actions/clone"]:::changed
n8["CloneAppBranches"]:::changed
classDef changed fill:#fff3cd,stroke:#d39e00
classDef external fill:#e7f1ff,stroke:#0b5ed7
classDef tests fill:#f1f3f5,stroke:#adb5bd,color:#495057
DiagramsequenceDiagram
participant UI as Admin UI
participant API as Admin API
participant Task as Clone task
participant Core as Bench/Site clone
UI->>API: Submit clone request
API->>Task: Queue clone
Task->>Core: Clone destination
Core-->>Task: Result or rollback
Task-->>UI: Task status
Reviews (9) · Last reviewed commit: feat: fork development benches into isolated agent workspaces · Re-trigger · Fix all |
Use each source site's database engine for validation and destination credentials, regardless of either bench's default. Canonicalize source-site task reservations, follow boolean naming conventions and extract Redis test setup/cleanup to meet the complexity limit. Keep clone routes bench-scoped: creating a destination site exceeds a source-site token's authority. Document and test this intentional access contract.
Member
Author
|
@frappe-guard rereview |
Member
|
@guard review |
Member
Author
|
@frappe-guard review |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add separate commands and Admin actions for copying bench code and site data into independent destinations.
Bench cloning supports origin-default, named and current-checkout branches, including per-app overrides. Site cloning supports MariaDB and PostgreSQL, preserves the document encryption key, resets credentials, pauses the scheduler and disables outgoing mail. Database import and upload copying run concurrently, with rollback on failure. Compatible dependency and asset caches speed up bench cloning.
Related: #620 sets up a fresh development bench from an app checkout. The standalone
clone-sitecommand provides an explicit way to bring existing site data into a compatible destination bench. Fork, prepared-template and managed-worktree features are deferred.Evidence
clone-benchandclone-sitedemo:VID_20261002_162224.mp4
forkandprepare-template, combining checkout/environment creation with site-data copying.clone-benchandclone-siteremain. CLI discovery, independent repository/file copying, cache reuse, database streaming, rollback and concurrent Redis ownership are covered by tests.Merge Danger
Door: two-way
New destinations are created explicitly; source code and site data are preserved. Failed site copies roll back their generated resources; failed bench copies remain available for inspection.
Blast Radius: moderate
Adds cloning commands and Admin actions, plus shared dependency/build caching. Destination apps and database engines must support the copied site. No worktree creation or whole-directory-copy POC is enabled.