Skip to content

feat: first-party Azure DevOps support with provider-agnostic SCM layer - #394

Closed
davidkydd wants to merge 3 commits into
kunchenguid:mainfrom
davidkydd:fm/fm-fork-bootstrap
Closed

davidkydd wants to merge 3 commits into
kunchenguid:mainfrom
davidkydd:fm/fm-fork-bootstrap

Conversation

@davidkydd

Copy link
Copy Markdown

Intent

Repoint the davidkydd/firstmate fork's no-mistakes installer reference from upstream kunchenguid/no-mistakes to the davidkydd/no-mistakes fork, so a fresh davidkydd/firstmate user installs the ADO-capable fork rather than upstream (which lacks the ADO fix). Surgical two-line change: bin/fm-bootstrap.sh install_cmd case for no-mistakes now emits the davidkydd/no-mistakes raw install.sh URL, and the matching assertion string in tests/fm-bootstrap.test.sh was updated to keep the suite green. Deliberately left untouched: CONTRIBUTING.md's canonical project link and the .github/workflows/no-mistakes-required.yml CI marker string, since neither is an install/download source. Only the no-mistakes install source was changed; firstmate's own repo identity and CI references were left alone. Delivery target: PR must be into davidkydd/firstmate (the fork), not kunchenguid.

What Changed

  • Added a new bin/fm-scm-lib.sh provider abstraction plus docs/ado-backend.md, and reworked fm-pr-check.sh, fm-pr-merge.sh, fm-review-diff.sh, and fm-teardown.sh to detect GitHub vs Azure DevOps from the origin remote and route PR/merge/diff/teardown operations accordingly (with NEEDS_AZ_AUTH bootstrap detection for ADO-origin projects).
  • Replaced bin/fm-pi-watch-extension.sh with a .pi/extensions/fm-primary-pi-watch.ts extension and simplified the pi primary session launch and supervision instructions.
  • Pointed the bootstrap no-mistakes installer at the davidkydd fork's raw install.sh URL and updated the matching bootstrap test assertion, leaving the CONTRIBUTING canonical link and CI marker untouched.

Risk Assessment

✅ Low: The branch's new work is a single self-consistent two-line URL swap (bootstrap install command plus its matching test assertion), with deliberately-untouched non-install references correctly left alone.

Testing

The configured baseline suite already passed; I ran the change-relevant tests/fm-bootstrap.test.sh in a single clean run (all 11 tests green) and additionally exercised the real fm-bootstrap.sh script end-to-end in a hermetic sandbox to capture the install line a fresh davidkydd/firstmate user is actually shown, which now points at the davidkydd/no-mistakes fork. The Round 1 failure was the timing-sensitive fleet-sync timeout tests flaking under 3x concurrent load (timeout=7s elapsed=8s), not a product defect — they pass reliably in a non-concurrent run. This is a CLI/install-source change with no UI surface, so evidence is CLI transcript output rather than visual artifacts.

Evidence: Bootstrap emits davidkydd/no-mistakes install URL (hermetic run)

=== The no-mistakes install source line the user is shown === MISSING: no-mistakes (install: curl -fsSL https://raw.githubusercontent.com/davidkydd/no-mistakes/main/docs/install.sh | sh)

=== Full bootstrap detect output (fresh davidkydd/firstmate user, no-mistakes absent) ===
MISSING: treehouse (install: curl -fsSL https://kunchenguid.github.io/treehouse/install.sh | sh)
MISSING: no-mistakes (install: curl -fsSL https://raw.githubusercontent.com/davidkydd/no-mistakes/main/docs/install.sh | sh)
MISSING: gh-axi (install: npm install -g gh-axi && gh-axi setup hooks)
MISSING: chrome-devtools-axi (install: npm install -g chrome-devtools-axi && chrome-devtools-axi setup hooks)
MISSING: lavish-axi (install: npm install -g lavish-axi && lavish-axi setup hooks)
MISSING: tasks-axi (install: npm install -g tasks-axi)
MISSING: quota-axi (install: npm install -g quota-axi)

=== The no-mistakes install source line the user is shown ===
MISSING: no-mistakes (install: curl -fsSL https://raw.githubusercontent.com/davidkydd/no-mistakes/main/docs/install.sh | sh)
Evidence: Change-relevant test results

ok - bootstrap enforces no-mistakes minimum version ok - bootstrap requires az (and az login) for an Azure DevOps-origin project

### Test: no-mistakes install source repoints to davidkydd fork

ok - bootstrap enforces no-mistakes minimum version
ok - bootstrap requires az (and az login) for an Azure DevOps-origin project
- Outcome: 🔧 1 issue found → auto-fixed ✅ across 2 runs (1h27m12s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

⚠️ **Rebase** - 1 warning

Push main to origin, or rebase your branch onto origin/main, before gating.

✅ **Review** - passed

✅ No issues found.

🔧 **Test** - 1 issue found → auto-fixed ✅
  • 🚨 tests failed with exit code 1
  • command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"

🔧 Fix: no code change; failing watcher test is a load-timing flake
✅ Re-checked - no issues remain.

  • command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"
  • bash tests/fm-bootstrap.test.sh — full suite, single clean run: all 11 tests pass including test_no_mistakes_min_version (asserts davidkydd URL) and test_ado_project_requires_az
  • Hermetic end-to-end run of bin/fm-bootstrap.sh with FM_BOOTSTRAP_DETECT_ONLY=1 and no-mistakes absent from PATH — captured the emitted MISSING: no-mistakes (install: curl -fsSL https://raw.githubusercontent.com/davidkydd/no-mistakes/main/docs/install.sh | sh) line a fresh user sees
  • grep -rn 'kunchenguid/no-mistakes' bin/ tests/ — confirmed no stray upstream install references remain
  • Verified CONTRIBUTING.md canonical link and .github/workflows/no-mistakes-required.yml CI marker were intentionally left pointing at kunchenguid
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

davidkydd and others added 3 commits July 10, 2026 09:32
* Add SCM provider abstraction and route lifecycle scripts through it

Introduce bin/fm-scm-lib.sh: detect github/ado/unknown from a URL or origin
remote, with normalized PR helpers (state, head, state+head, number-for-branch,
ensure-commit-object, resolve-pr-head). Only a provably-ADO provider takes the
az path; github and unknown keep the exact gh/gh-axi/git path, so GitHub
behaviour is byte-for-byte preserved.

Rewire fm-pr-check, fm-review-diff, fm-teardown, and fm-fleet-snapshot to the
library; refuse ADO PR URLs in fm-pr-merge (captain completes in the ADO UI);
add the az dependency and NEEDS_AZ_AUTH prompt for ADO-origin projects in
fm-bootstrap.

* Make crewmate brief wording provider-aware

fm-brief detects the project's PR host from its origin remote via fm-scm-lib.sh
and renders GitHub or Azure DevOps tooling in the host-operations rule and the
direct-PR done-line. GitHub briefs are unchanged.

* Add fm-scm-lib provider-detection tests

* Add fm-scm-lib parse and PR-operation tests

Cover GitHub and Azure DevOps PR URL parsing, normalized pr_state/pr_head/
pr_state_head, and ado pr_number_for_branch against gh and az mocks.

* Test: fm-pr-merge refuses Azure DevOps PR URLs

* Test: fm-review-diff resolves an ADO PR head via az

* Test: fm-teardown ADO landed-work parity via az path

* Add docs/ado-backend.md reference

* Make AGENTS.md PR-host wording provider-neutral and document ADO

Provider-neutral wording for pr_head recording, direct-PR host, review-diff PR
head resolution, and teardown landed-work checks; note fm-pr-merge refuses ADO
PRs; add NEEDS_AZ_AUTH handling. Point to docs/ado-backend.md.

* Index ADO test coverage in CONTRIBUTING.md

* Test: fleet snapshot extracts Azure DevOps PR URLs

* Test: bootstrap requires az and az login for ADO-origin projects

* Test: symlink fm-scm-lib.sh into fm-gotmp teardown fixtures

fm-teardown.sh now sources fm-scm-lib.sh; the gotmp fixtures build an
isolated bin/ that must include every sourced sibling.

* no-mistakes(test): trap watcher signals so checkpoint SIGTERM releases singleton lock

* no-mistakes(document): sync docs with first-party Azure DevOps support

* Document which ADO gates firstmate gates on

Codify the content-readiness rule: firstmate waits only on content-influenced
automation gates (build/test/e2e, coverage, Component Governance) and ignores
human review/sign-off/attestation gates even when blocking. Expired content
build gates are re-queued via PR-native policy evaluation, never treated as
vacuously green.

* no-mistakes(document): docs: index ADO backend doc and note provider-aware briefs

* no-mistakes(test): disarm terminating-signal traps during watcher lock release to prevent leak

* no-mistakes(document): docs: add GitHub/Azure DevOps feature bullet to README

* ci: trigger fork Actions

* Test: make ADO az-absent bootstrap case hermetic

The az-absent sub-case removed az from the fake toolchain but relied on az
being absent from BASE_PATH, which fails on hosts that ship azure-cli (GitHub's
ubuntu runners). Prepending a fakebin can add a stub but cannot hide a real tool
further down PATH, so bootstrap found the system az and emitted NEEDS_AZ_AUTH
instead of MISSING: az. Run that sub-case against a base PATH scrubbed of any
real az via symlinks so the assertion is hermetic everywhere.

* Test: fix fork CI lint and scm-lib test exec bit

Two CI-surfaced issues on the ADO test additions:
- tests/fm-scm-lib.test.sh was committed mode 100644, so CI's direct
  invocation ("$test_script") failed with Permission denied (exit 126).
  Mark it executable to match every other test.
- The az-scrub helper used `[ -x ] && [ ! -d ] || continue`, which
  shellcheck flags as SC2015 (A && B || C is not if-then-else). Split into
  explicit guards.
* docs(readme): reformat Quick Start and recommend Grok equally with Claude Code

* no-mistakes(review): Captain: align harness launch guidance

* no-mistakes(review): Captain, clarify Pi supervised launch

* no-mistakes(review): Captain, document Pi first-launch bridge

* feat(pi): track primary watcher extension for plain-pi launch

Move Pi's primary watcher bridge from a generated state/ file to a
tracked .pi/extensions/fm-primary-pi-watch.ts, matching how the turn-end
guard extension already works: self-hashing version, project-local
auto-discovery after one-time Pi trust. This drops the state/-generation
step and dual -e requirement from the happy path, so Pi's Quick Start
launch becomes plain 'pi', the same friction class as 'claude' and
'grok --trust'.

- bin/fm-pi-watch-extension.sh is removed; nothing generates the
  extension anymore since it is committed.
- fm-session-start.sh and fm-supervision-instructions.sh resolve the
  watcher extension path from FM_ROOT instead of state/, and the
  session-start diagnostic now points at restarting plain pi after
  trust, with -e as a documented fallback.
- fm-spawn.sh points Pi secondmate launches at the tracked extension
  path in the secondmate home instead of generating a state/ copy.
- README Quick Start Pi block is now just 'pi' plus a trust note.
- Tests, docs, and the harness-adapters skill updated to match.

* fix(pi): drop backticks from session-start diagnostic to satisfy shellcheck SC2016
The fork carries the ADO support fix; upstream kunchenguid/no-mistakes
lacks it. Repoint the bootstrap install command and its test assertion.
@davidkydd
davidkydd force-pushed the fm/fm-fork-bootstrap branch 2 times, most recently from 3142866 to 387d913 Compare July 10, 2026 00:36
@davidkydd

Copy link
Copy Markdown
Author

Closing: opened against the wrong base repo (kunchenguid/firstmate). This firstmate fleet ships to the davidkydd/firstmate fork; reopening a fork-internal PR with just the intended 2-line bootstrap change.

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.

2 participants