Compare commits

...

7 Commits
v2.2.1 ... main

Author SHA1 Message Date
ac0b9b4ea3 fix(action): allow forward sync from trailer commits 2026-06-08 13:29:31 +01:00
427cc4c3f1 Merge remote-tracking branch 'origin/auto-sync/mono-main-20260602-120147'
# Conflicts:
#	CHANGELOG.md
2026-06-02 16:28:21 +01:00
8776ccf2d2 test: remove bidirectional sync smoke-test markers
Drops the test markers added during the 2026-05-28 onboarding-verification
round-trip (forward + reverse leg). The adopt strategy is live and the
CHANGELOG is back to its 2.2.0-release state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 05:30:33 +01:00
b82311829c Merge pull request '[Subrepo Sync] main → main' (#5) from auto-sync/subrepo-main-20260528-042619 into main
Reviewed-on: sdlc/sdlc#5
2026-05-28 04:28:06 +00:00
9071e17d31 Update CHANGELOG.md 2026-05-28 05:25:22 +01:00
sync-bot
5f942bced4 Sync from monorepo 2026-05-28T04:24:11Z
Sync-Origin: forward/main/2026-05-28T04:24:11Z
2026-05-28 04:24:11 +00:00
sync-bot
4df4044f20 Adopt josh-sync for josh-sync
Sync-Origin: adopt/main/2026-05-28T03:19:12Z
2026-05-28 04:19:12 +01:00
6 changed files with 28 additions and 21 deletions

View File

@@ -1,8 +1,10 @@
# Changelog
## Unreleased - REACHED the standalone repo
## 2.2.2
- Bidirectional sync smoke-test marker — forward leg (monorepo → subrepo), 2026-05-28.
### Fixes
- Forward sync no longer skips the entire action when the checked-out HEAD commit has the configured sync trailer. This allows valid multi-hop setups where one repo receives sync commits from an upstream repository and forwards its filtered subtree to another repository. Reverse sync still filters bot commits by trailer for loop prevention.
## 2.2.1

View File

@@ -1 +1 @@
2.2.1
2.2.2

View File

@@ -38,21 +38,7 @@ runs:
command -v "$cmd" &>/dev/null || { echo "::error::Missing required tool: $cmd"; exit 1; }
done
- name: Loop guard (forward)
id: guard
if: inputs.direction == 'forward' || inputs.direction == 'both'
shell: bash
run: |
TRAILER=$(yq '.bot.trailer' "${{ inputs.config }}" 2>/dev/null || echo "Josh-Sync-Origin")
if git log -1 --format=%B | grep -q "^${TRAILER}:"; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "::notice::Skipping sync — HEAD commit has sync trailer (loop prevention)"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Sync
if: steps.guard.outputs.skip != 'true'
shell: bash
env:
JOSH_SYNC_DEBUG: ${{ inputs.debug == 'true' && '1' || '0' }}

View File

@@ -17,7 +17,7 @@ Bidirectional sync creates an infinite loop risk: forward sync pushes commit A t
## Decision
All bot commits include a git trailer with a configurable key (default: `Josh-Sync-Origin`). Both sync directions filter out commits containing this trailer.
All bot commits include a git trailer with a configurable key (default: `Josh-Sync-Origin`). Reverse sync filters out commits containing this trailer so bot-generated forward-sync commits are not proposed back to the monorepo.
### Format
@@ -32,7 +32,7 @@ The trailer value encodes: direction, branch, and timestamp. This aids debugging
### Filtering
- **Reverse sync**: `git log --invert-grep --grep="^${BOT_TRAILER}:"` excludes all commits with the trailer
- **CI loop guard**: The composite action checks if HEAD commit has the trailer before running sync at all
- **Forward sync**: the composite action still runs even when HEAD has the trailer; forward sync uses tree comparison, sync state, and merge checks to decide whether to push
### Configuration
@@ -44,7 +44,7 @@ The trailer key is set in `.josh-sync.yml` under `bot.trailer`. This allows mult
- Reliable loop prevention — trailer is part of the immutable commit object
- Configurable key avoids conflicts between multiple sync bots
- Human-readable — `git log` shows the trailer in commit messages
- CI loop guard prevents unnecessary sync runs entirely
- Repositories can act as middle hops, receiving a sync commit from one relationship and forwarding relevant changes to another
**Negative:**
- Commits with manually-added trailers matching the key would be incorrectly filtered

View File

@@ -554,7 +554,9 @@ Runs on a cron schedule (never triggered by subrepo pushes):
### Loop prevention
Bot commits include a git trailer like `Josh-Sync-Origin: forward/main/2024-02-12T10:30:00Z`. Each sync direction filters out commits with this trailer, preventing changes from bouncing back and forth. The CI action also has a loop guard that skips entirely if the HEAD commit has the trailer.
Bot commits include a git trailer like `Josh-Sync-Origin: forward/main/2024-02-12T10:30:00Z`. Reverse sync filters out commits with this trailer, preventing changes from bouncing back from the target repo into the source repo.
The CI action does not skip forward sync solely because the checked-out HEAD commit has a sync trailer. A repo can be a valid middle hop: it may receive a sync commit from one repository and still need to forward its filtered subtree to another repository. Forward sync relies on tree comparison, sync state, and merge checks to decide whether anything should be pushed.
### State tracking

17
tests/unit/action.bats Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bats
# tests/unit/action.bats — Composite action regression tests
setup() {
JOSH_SYNC_ROOT="$(cd "$BATS_TEST_DIRNAME/../.." && pwd)"
ACTION_FILE="${JOSH_SYNC_ROOT}/action.yml"
}
@test "forward sync is not globally skipped when HEAD has the sync trailer" {
! grep -q "Loop guard (forward)" "$ACTION_FILE"
! grep -q "HEAD commit has sync trailer" "$ACTION_FILE"
! grep -q "steps.guard.outputs.skip" "$ACTION_FILE"
}
@test "composite action still invokes the josh-sync CLI" {
grep -q "josh-sync sync" "$ACTION_FILE"
}