Skip to content

Add fork-based delivery mode for external repos#509

Merged
MichielDean merged 7 commits into
mainfrom
feat/ci-0pbgd
May 12, 2026
Merged

Add fork-based delivery mode for external repos#509
MichielDean merged 7 commits into
mainfrom
feat/ci-0pbgd

Conversation

@MichielDean
Copy link
Copy Markdown
Owner

Closes droplet ci-0pbgd.

Adds DeliveryMode field to RepoConfig supporting 'direct' (default) and 'fork' (push to fork, PR against upstream). Fixes 5 reviewer findings including: upstream-aware git sync, worktree tracking, invalid DeliveryMode validation, sed URL conversion for repos with dots, and fork owner prefix for cross-repo PRs.

Lobsterdog Contributors added 7 commits May 12, 2026 15:41
Add DeliveryMode field to RepoConfig supporting 'direct' (default, push to
origin, merge locally) and 'fork' (push to fork remote, open PR against
upstream). Changes:

- Add DeliveryMode type with DeliveryModeDirect/DeliveryModeFork constants
- Add DeliveryMode and UpstreamRemote fields to RepoConfig (YAML: delivery_mode, upstream_remote)
- Extend ValidateAqueductConfig: fork mode requires upstream_remote; empty defaults to direct
- Extend EnsurePrimaryClone to accept upstreamURL, add/update 'upstream' remote and fetch
- Extend prepareDropletWorktreeWithLogger with baseRemote param: 'upstream' tracks upstream/main
- Add fork delivery section to CONTEXT.md via ContextParams.RepoConfig
- Create cataractae/fork-delivery/ identity (PERSONA.md, INSTRUCTIONS.md)
- Add commented fork-mode examples to aqueduct.yaml and cistern.yaml
- Update dispatchRepo to pass baseRemote based on DeliveryMode
- Update runner.go to pass RepoConfig to ContextParams and UpstreamRemote to EnsurePrimaryClone

Tests: DeliveryMode constants, fork validation, EnsurePrimaryClone upstream,
prepareDropletWorktree with baseRemote, CONTEXT.md fork section.
…ee tracking

Two reviewer issues addressed:

1. drought_hooks.go hookGitSync hardcodes origin/main — fork-mode repos
   won't fetch upstream refs or reset _primary to upstream/main, causing
   stale upstream state. Fix: select primary remote and ref based on
   DeliveryMode (origin/main for direct, upstream/main for fork). Also
   fetch origin in fork mode so the fork's own refs stay current for
   delivery.

2. prepareDropletWorktreeWithLogger new-branch path lacks tracking setup
   for fork mode, creating inconsistency with the resume path which does
   set --set-upstream-to=upstream/main. Fix: add --set-upstream-to
   tracking for fresh worktrees when baseRemote is "upstream".

Tests added:
- TestHookGitSync_ForkMode_FetchesFromUpstream
- TestHookGitSync_ForkMode_NonPrimaryNotReset
- TestHookGitSync_DirectMode_ResetsToOriginMain
- TestPrepareDropletWorktree_ForkMode_NewBranchTrackingSet
- TestPrepareDropletWorktree_DirectMode_NewBranchNoUpstreamTracking
- Fixed existing test to use for-each-ref for tracking verification
1. drought_hooks.go: move syncSkillsFromRepo inside _primary block
   (2-tab indent). Previously at 1-tab indent (for-loop level),
   visually misleading as it appeared outside the for-loop. Skills
   only need syncing from _primary, not every worktree.

2. fork-delivery/INSTRUCTIONS.md: convert UPSTREAM_URL to
   OWNER/REPO format for gh CLI. gh pr create --repo expects
   OWNER/REPO, not a git URL. Added sed conversion supporting
   both https:// and git@ URL formats.

3. fork-delivery/INSTRUCTIONS.md: add --repo flag to gh pr view
   for cross-repo PR lookup. Without it, gh pr view only searches
   the fork repo, not the upstream where the PR was created.
- README: add fork-mode pipeline variant (fork-delivery cataractae)
- README: add Delivery Mode section with config field docs and table
- README: add fork-mode repo config example with delivery_mode/upstream_remote
- README: update git_sync drought hook description for fork-mode behavior
- README: update git_sync positioning note to reference primary remote
- README: update delivery cataractae description to mention fork mode
- CHANGELOG: add entry for fork-based delivery mode feature
@MichielDean MichielDean merged commit aff1231 into main May 12, 2026
3 checks passed
@MichielDean MichielDean deleted the feat/ci-0pbgd branch May 12, 2026 23:41
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