Skip to content

Pipeline Design inline

ezigus edited this page Mar 3, 2026 · 2 revisions

Now I have full context. Here is the ADR:


Design: chore: close issue #45 - merge goal complete

Context

Issue #45 tracks the completion of an autonomous delivery pipeline cycle. The branch ci/chore-close-issue-45-merge-goal-complete accumulated 5 commits across autonomous iterations 3–5, producing a net delta of +18/−14 lines across 10 files. The changes address two concrete bugs discovered during autonomous pipeline execution:

  1. Git credential blockinggit fetch in sw-pipeline.sh:auto_rebase() could hang indefinitely in CI/headless environments when HTTPS credential prompts fired.
  2. Chaos test HEAD corruptionsw-chaos-test.sh (Chaos Test 8) wrote a fake .git/HEAD into $REPO_DIR, which could be the real test repo directory, corrupting its git state and causing cascading test failures.

Secondary changes include GIT_TERMINAL_PROMPT=0 propagation to sw-pipeline-test.sh, stdin redirection (< /dev/null) in sw-e2e-smoke-test.sh, silent cleanup failure tolerance, documentation auto-sync, and updated AI agent standard configs.

No new features or architectural changes are introduced. This is a stabilization and merge task.

Decision

Squash-merge the 5-commit branch into main via a single PR, then close issue #45 with a merge reference.

Specific patterns applied in the changeset:

  • Credential prompt prevention: Set GIT_TERMINAL_PROMPT=0 at call site (sw-pipeline.sh:1297) rather than globally, scoping the fix to the one git fetch that can block. This avoids masking legitimate credential failures elsewhere.
  • Test isolation via separate directory: Chaos Test 8 now uses $TEST_TEMP_DIR/chaos-clone (sw-chaos-test.sh:281) instead of $REPO_DIR for fake .git creation. This eliminates the class of bug where test setup destroys the repo under test.
  • Stdin redirection: sw-e2e-smoke-test.sh:348 pipes /dev/null to stdin when invoking the pipeline subprocess, preventing interactive prompts from blocking CI.
  • Cleanup hardening: sw-pipeline-test.sh:374 uses rm -rf ... 2>/dev/null || true to avoid set -e exits when temp directories are already removed or locked.
  • Squash merge strategy: Collapses 5 incremental "loop: iteration N" commits into a single coherent commit on main, keeping history clean. The individual iteration history is preserved on the branch (and in the PR body) for audit.

Alternatives Considered

  1. Rebase-merge (preserve individual commits) — Pros: full iteration history on main; easier bisect if a regression surfaces. Cons: 3 of 5 commits are "loop: iteration N" with mixed changes — poor signal-to-noise on main; clutters git log.
  2. Cherry-pick only the bug fixes — Pros: smallest possible diff on main. Cons: leaves docs/config updates orphaned on the branch; issue #45 scope includes the full pipeline cycle, not just bug fixes; creates drift between branch and main.
  3. Manual merge commit (no squash) — Pros: preserves branch topology. Cons: merge commit + 5 parent commits is noisier than a single squashed commit for a chore task of this size.

Implementation Plan

  • Files to create: None
  • Files to modify: None — all code changes are already committed on the branch
  • Dependencies: None — no new packages or version bumps
  • Risk areas:
    • sw-chaos-test.sh changes the variable used in Chaos Test 8; if other tests reference $REPO_DIR/.git state created by Test 8, they could break. Mitigated: $CHAOS_CLONE_DIR is fully isolated under $TEST_TEMP_DIR.
    • GIT_TERMINAL_PROMPT=0 on git fetch in sw-pipeline.sh suppresses credential prompts. If a legitimate credential flow is needed (e.g., private fork), the fetch will fail silently and fall through to the warn + return 0 path. This is the existing fallback behavior — no new failure mode introduced.
    • Squash merge loses individual commit SHAs. If future debugging needs to trace a specific iteration, the PR body and branch (if retained) are the reference.

Validation Criteria

  • git diff origin/main...HEAD shows exactly 10 files, +18/−14 lines — no unintended changes
  • Working tree is clean (only .claude/pipeline-tasks.md and .claude/tasks.md are modified, neither tracked by the PR)
  • PR targets main from ci/chore-close-issue-45-merge-goal-complete with Closes #45 in the body
  • GitHub Actions status checks pass on the PR (CI green)
  • Squash merge produces a single commit on main with the chore prefix
  • Issue #45 transitions to closed state after merge
  • Post-merge: git log --oneline -1 on main shows the squashed commit
  • Post-merge: scripts/sw-chaos-test.sh runs without corrupting the test repo's .git directory
  • Post-merge: scripts/sw-pipeline-test.sh completes without hanging on credential prompts

Clone this wiki locally