From fd52a8fa65439791be364b3be16e3118efd8d552 Mon Sep 17 00:00:00 2001 From: fullstackjam Date: Tue, 17 Nov 2026 22:28:00 +0800 Subject: [PATCH 1/4] chore: remove Claude Code integration --- .claude/hooks/post-tool-use.sh | 53 --------- .claude/hooks/session-start.sh | 25 ----- .claude/hooks/stop.sh | 44 -------- .claude/settings.json | 39 ------- .claude/skills/architecture-review/SKILL.md | 1 - .claude/skills/bootstrap-feature/SKILL.md | 1 - .claude/skills/ship-pr/SKILL.md | 1 - .github/workflows/release.yml | 2 +- .gitignore | 5 - AGENTS.md | 19 +--- CHANGELOG.md | 2 +- CLAUDE.md | 10 -- docs/HARNESS.md | 10 +- internal/archtest/README.md | 1 - internal/archtest/agentconfig_test.go | 114 -------------------- internal/snapshot/capture_test.go | 4 +- internal/snapshot/snapshot_test.go | 4 +- 17 files changed, 11 insertions(+), 324 deletions(-) delete mode 100755 .claude/hooks/post-tool-use.sh delete mode 100755 .claude/hooks/session-start.sh delete mode 100755 .claude/hooks/stop.sh delete mode 100644 .claude/settings.json delete mode 120000 .claude/skills/architecture-review/SKILL.md delete mode 120000 .claude/skills/bootstrap-feature/SKILL.md delete mode 120000 .claude/skills/ship-pr/SKILL.md delete mode 100644 CLAUDE.md delete mode 100644 internal/archtest/agentconfig_test.go diff --git a/.claude/hooks/post-tool-use.sh b/.claude/hooks/post-tool-use.sh deleted file mode 100755 index ad17ff63..00000000 --- a/.claude/hooks/post-tool-use.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# PostToolUse hook — fires after every Edit / Write / MultiEdit. -# -# For .go file edits: runs `go vet` on the touched package so Claude -# gets immediate feedback if the edit didn't compile / vet cleanly. -# -# Exit code semantics (per Claude Code hook contract): -# 0 → success, stdout shown in transcript (Claude sees it on subsequent turns) -# 2 → blocks: stderr is fed to Claude as feedback to self-correct -# -# We choose exit 2 on vet failure so the agent can fix without waiting -# for Stop. Exit 0 on success — silent path, no noise. - -set -uo pipefail - -project_dir="${CLAUDE_PROJECT_DIR:-$(pwd)}" -cd "$project_dir" - -# Read tool input JSON from stdin and extract the file_path. -input=$(cat) -file_path=$(printf '%s' "$input" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('tool_input',{}).get('file_path',''))" 2>/dev/null || true) - -# No path / non-Go file → exit silently. -[ -z "$file_path" ] && exit 0 -case "$file_path" in - *.go) ;; - *) exit 0 ;; -esac - -# Normalise to a path relative to the project root. Anything outside the -# project (e.g. an edit to ~/.claude/...) is ignored. -case "$file_path" in - "$project_dir"/*) rel_path="${file_path#"$project_dir"/}" ;; - /*) exit 0 ;; - *) rel_path="$file_path" ;; -esac - -pkg_dir=$(dirname "$rel_path") -[ -d "$project_dir/$pkg_dir" ] || exit 0 - -# Run go vet on just the touched package — fast (<1s warm). -if ! out=$(go vet "./$pkg_dir/..." 2>&1); then - # "matched no packages" means the package uses build constraints that exclude - # the default build (e.g. //go:build e2e && vm). Not a real vet failure. - case "$out" in - *"matched no packages"*) exit 0 ;; - esac - printf '[openboot post-tool-use] go vet failed for ./%s:\n%s\n' "$pkg_dir" "$out" >&2 - exit 2 -fi - -exit 0 diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.sh deleted file mode 100755 index ad2fab0d..00000000 --- a/.claude/hooks/session-start.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# Only run in Claude Code on the web; skip on local machines. -if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; then - exit 0 -fi - -cd "${CLAUDE_PROJECT_DIR:-$(pwd)}" - -echo "[openboot session-start] Go version: $(go version)" - -# Pre-fetch and verify Go module deps so tests/builds are fast and offline-safe. -echo "[openboot session-start] Downloading Go modules..." -go mod download - -# Warm the build cache so the first `go build` / `go test` is fast. -echo "[openboot session-start] Warming build cache (go build ./...)..." -go build ./... >/dev/null - -# Warm the test binary cache without executing tests. -echo "[openboot session-start] Warming test cache (go test -count=0 ./...)..." -go test -count=0 ./... >/dev/null - -echo "[openboot session-start] Done." diff --git a/.claude/hooks/stop.sh b/.claude/hooks/stop.sh deleted file mode 100755 index 6202e68c..00000000 --- a/.claude/hooks/stop.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# Stop hook — fires when Claude finishes its turn. -# -# If any .go files in the working tree differ from HEAD, run the cheap -# end-of-turn sensors: -# - go vet ./... (catches obvious correctness errors) -# - archtest (catches new architecture-fitness violations) -# -# Skips the full L1 race test — that's pre-push's job. The point here is -# fast: <3s on a warm cache. -# -# Exit code semantics: -# 0 → allow stop -# 2 → prevent stop; stderr is fed back to Claude so it can fix -# -# Skip via OPENBOOT_SKIP_STOP_HOOK=1 if iterating. - -set -uo pipefail - -[ "${OPENBOOT_SKIP_STOP_HOOK:-}" = "1" ] && exit 0 - -cd "${CLAUDE_PROJECT_DIR:-$(pwd)}" - -# Cheap gate: only fire if any tracked .go file is dirty or any untracked .go -# file exists. Skip otherwise — most turns don't touch Go. -dirty_go=$(git status --porcelain 2>/dev/null | grep -E '\.go$' | head -1 || true) -[ -z "$dirty_go" ] && exit 0 - -echo "[openboot stop] running end-of-turn sensors..." >&2 - -if ! vet_out=$(go vet ./... 2>&1); then - printf '[openboot stop] go vet ./... failed:\n%s\n' "$vet_out" >&2 - exit 2 -fi - -# archtest catches new violations of project invariants (exec.Command outside -# system/, raw http outside httputil, os.Getenv("HOME"), etc.). -if ! arch_out=$(go test -count=1 ./internal/archtest/... 2>&1); then - printf '[openboot stop] archtest failed:\n%s\n' "$arch_out" >&2 - exit 2 -fi - -exit 0 diff --git a/.claude/settings.json b/.claude/settings.json deleted file mode 100644 index 76a4e509..00000000 --- a/.claude/settings.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "attribution": { - "commit": "", - "pr": "" - }, - "hooks": { - "SessionStart": [ - { - "hooks": [ - { - "type": "command", - "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh" - } - ] - } - ], - "PostToolUse": [ - { - "matcher": "Edit|Write|MultiEdit", - "hooks": [ - { - "type": "command", - "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/post-tool-use.sh" - } - ] - } - ], - "Stop": [ - { - "hooks": [ - { - "type": "command", - "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/stop.sh" - } - ] - } - ] - } -} diff --git a/.claude/skills/architecture-review/SKILL.md b/.claude/skills/architecture-review/SKILL.md deleted file mode 120000 index a6e6a8bf..00000000 --- a/.claude/skills/architecture-review/SKILL.md +++ /dev/null @@ -1 +0,0 @@ -../../../.agents/skills/architecture-review/SKILL.md \ No newline at end of file diff --git a/.claude/skills/bootstrap-feature/SKILL.md b/.claude/skills/bootstrap-feature/SKILL.md deleted file mode 120000 index 4ea3a47b..00000000 --- a/.claude/skills/bootstrap-feature/SKILL.md +++ /dev/null @@ -1 +0,0 @@ -../../../.agents/skills/bootstrap-feature/SKILL.md \ No newline at end of file diff --git a/.claude/skills/ship-pr/SKILL.md b/.claude/skills/ship-pr/SKILL.md deleted file mode 120000 index 44f0db4c..00000000 --- a/.claude/skills/ship-pr/SKILL.md +++ /dev/null @@ -1 +0,0 @@ -../../../.agents/skills/ship-pr/SKILL.md \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6c562b1..59ba4321 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -169,7 +169,7 @@ jobs: # Auto-generated changelog from Conventional Commits since the # previous tag, grouped by type. Non-conventional commits are - # intentionally dropped — they should be rare (CLAUDE.md enforces + # intentionally dropped — they should be rare (AGENTS.md enforces # the convention) and silence is better than a misleading row. # Skipped entirely on the first release (no prior tag). VERSION="${{ needs.detect-release-type.outputs.version }}" diff --git a/.gitignore b/.gitignore index 29cfc337..40a4a58c 100644 --- a/.gitignore +++ b/.gitignore @@ -32,11 +32,6 @@ __pycache__/ .sisyphus/ docs/superpowers/ docs/openboot-linus-code-review.md -.claude/* -!.claude/hooks/ -!.claude/settings.json -!.claude/skills/ -.claude/settings.local.json # Go vendor (deps downloaded at build time) vendor/ diff --git a/AGENTS.md b/AGENTS.md index 885ae075..82b68fca 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # AGENTS.md Canonical, tool-neutral instructions for coding agents working on this repo. -Codex reads this file directly; Claude Code imports it from `CLAUDE.md`. +Codex reads this file directly. If you're a human, you probably want [README.md](README.md) or [CONTRIBUTING.md](CONTRIBUTING.md). @@ -9,25 +9,10 @@ If you're a human, you probably want [README.md](README.md) or - Keep shared repository guidance in this file. Do not duplicate it in a tool-specific instruction file. -- `CLAUDE.md` is a thin Claude Code adapter: it imports this file with - `@AGENTS.md` and may contain only Claude-specific additions. - Shared skills use the open Agent Skills format and live in - `.agents/skills//SKILL.md`. Claude Code discovers the same skills - through relative symlinks under `.claude/skills/`. + `.agents/skills//SKILL.md`. - Other tools that implement `AGENTS.md` or Agent Skills can consume the same canonical paths without another copy of the instructions. -- Tool-specific integration stays tool-specific. Claude Code hooks and - permissions remain in `.claude/settings.json` and `.claude/hooks/`. - -When adding a shared skill, create it under `.agents/skills/`, then expose it -to Claude Code without copying its contents: - -```bash -mkdir -p .claude/skills/ -ln -s ../../../.agents/skills//SKILL.md .claude/skills//SKILL.md -``` - -The `agent-config` architecture test verifies the import and skill adapters. ## Read first diff --git a/CHANGELOG.md b/CHANGELOG.md index af099d67..d6a11975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,7 @@ No aliases are kept — silent aliasing would regress behavior invisibly (the ol ### Versioning policy change -The previous `CLAUDE.md` rule "CLI changes must maintain backward compatibility" has been relaxed: +The previous repository rule "CLI changes must maintain backward compatibility" has been relaxed: - Breaking CLI changes are allowed, but require a **major version bump** and a migration entry here. - Same-name commands **must not** silently change behavior — either preserve semantics or remove the command. diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index a6852042..00000000 --- a/CLAUDE.md +++ /dev/null @@ -1,10 +0,0 @@ -# CLAUDE.md - -@AGENTS.md - -## Claude Code integration - -Shared repository instructions belong in `AGENTS.md`. Shared skills belong in -`.agents/skills/`; the entries under `.claude/skills/` are adapters to those -canonical files. Keep only Claude Code-specific hooks, permissions, and -settings under `.claude/`. diff --git a/docs/HARNESS.md b/docs/HARNESS.md index 6d3144f2..13c6fdae 100644 --- a/docs/HARNESS.md +++ b/docs/HARNESS.md @@ -58,12 +58,8 @@ Three regulation categories: | Behav. | Auto-release sensor — patch fast lane (`fix:`-only) auto-tags + dispatches `release.yml`; feat threshold opens a `release-ready` issue (check L4 CI green, then tag manually) | push to `main` | `.github/workflows/auto-release.yml` | | Behav. | Release notes — Conventional Commits since previous tag, grouped by type (Features / Bug Fixes / etc) + Full Changelog link, appended to the install-instructions template | tag push or `workflow_dispatch` | `.github/workflows/release.yml` (`Write release notes` step) | | Behav. | Old-CLI compat (previous release × current mock server) | every PR | `.github/workflows/test.yml` `cli-compat` job | -| Feedfwd. | Shared agent conventions | every AI turn | `AGENTS.md` (canonical); `CLAUDE.md` imports it for Claude Code | -| Feedfwd. | Shared skills | model-loaded | `.agents/skills/*` (canonical); `.claude/skills/*/SKILL.md` symlinks for Claude Code | -| Arch. | Multi-agent config must not drift | L1 | `internal/archtest/agentconfig_test.go` | -| Feedfwd. | Session-start hook (warm caches, fetch deps) | every Claude session | `.claude/hooks/session-start.sh` | -| Feedback (agent) | `go vet` on edited package | after every Edit/Write/MultiEdit | `.claude/hooks/post-tool-use.sh` | -| Feedback (agent) | `go vet ./...` + archtest | end of every Claude turn (if .go dirty) | `.claude/hooks/stop.sh` | +| Feedfwd. | Shared agent conventions | every AI turn | `AGENTS.md` (canonical) | +| Feedfwd. | Shared skills | model-loaded | `.agents/skills/*` (canonical) | | Maint. | `golangci-lint` on the staged diff | local git pre-commit | `scripts/hooks/pre-commit` | | Drift loop | Failed harness sensor → open/update GitHub issue | on main / nightly | `.github/workflows/drift-to-issue.yml` | @@ -101,7 +97,7 @@ it survives doc rot. decision from rule introduction. - **No session-start stale-branch sensor.** A previous iteration of the `ship-pr` skill used `gh pr merge --auto`, so the merge could happen - asynchronously after the Claude session ended — leaving a feature + asynchronously after the agent session ended — leaving a feature branch checked out next time. The sensor existed to nag the user to clean it up. Once the skill dropped `--auto` and made cleanup part of the in-session loop (Step 8), the sensor became dead code and was diff --git a/internal/archtest/README.md b/internal/archtest/README.md index 0c60dcae..e71cd14b 100644 --- a/internal/archtest/README.md +++ b/internal/archtest/README.md @@ -31,7 +31,6 @@ from the baseline) are logged but do not fail the test. | `dryrun` | `dryrun_test.go` | yes | "Destructive ops: check `cfg.DryRun` first. Always." | | `fmtprint` | `fmtprint_test.go` | yes | "UI output must go through `ui.*` helpers" | | `installsh` | `installsh_test.go` | no (hard rule) | "`install.sh` must not prompt on stdin" | -| `agent-config` | `agentconfig_test.go` | no (hard rule) | "Keep `AGENTS.md` and shared skills canonical across agent tools" | ## Workflow diff --git a/internal/archtest/agentconfig_test.go b/internal/archtest/agentconfig_test.go deleted file mode 100644 index 18016888..00000000 --- a/internal/archtest/agentconfig_test.go +++ /dev/null @@ -1,114 +0,0 @@ -package archtest - -import ( - "os" - "path/filepath" - "strings" - "testing" -) - -// TestAgentConfigSharedAcrossTools keeps AGENTS.md and each SKILL.md as a -// single source of truth while exposing them through the native discovery -// paths used by Codex and Claude Code. -func TestAgentConfigSharedAcrossTools(t *testing.T) { - root := repoRoot() - - claudeInstructions := filepath.Join(root, "CLAUDE.md") - src, err := os.ReadFile(claudeInstructions) // #nosec G304 -- path is inside the repo - if err != nil { - t.Fatalf("read CLAUDE.md: %v", err) - } - if !hasExactLine(string(src), "@AGENTS.md") { - t.Errorf("CLAUDE.md must import the canonical instructions with an exact @AGENTS.md line") - } - - canonicalRoot := filepath.Join(root, ".agents", "skills") - claudeRoot := filepath.Join(root, ".claude", "skills") - canonicalNames := skillNames(t, canonicalRoot) - claudeNames := skillNames(t, claudeRoot) - - for name := range canonicalNames { - if !claudeNames[name] { - t.Errorf("shared skill %q is missing its Claude Code adapter", name) - continue - } - - canonical := filepath.Join(canonicalRoot, name, "SKILL.md") - adapter := filepath.Join(claudeRoot, name, "SKILL.md") - info, err := os.Lstat(adapter) - if err != nil { - t.Errorf("inspect Claude Code adapter for skill %q: %v", name, err) - continue - } - if info.Mode()&os.ModeSymlink == 0 { - t.Errorf("%s must be a symlink to %s; do not copy shared skill instructions", - repoRelative(root, adapter), repoRelative(root, canonical)) - continue - } - target, err := os.Readlink(adapter) - if err != nil { - t.Errorf("read Claude Code adapter for skill %q: %v", name, err) - continue - } - if filepath.IsAbs(target) { - t.Errorf("%s must use a relative symlink so it works in every checkout", - repoRelative(root, adapter)) - continue - } - - resolved, err := filepath.EvalSymlinks(adapter) - if err != nil { - t.Errorf("resolve Claude Code adapter for skill %q: %v", name, err) - continue - } - if filepath.Clean(resolved) != filepath.Clean(canonical) { - t.Errorf("%s resolves to %s, want %s", - repoRelative(root, adapter), repoRelative(root, resolved), repoRelative(root, canonical)) - } - } - - for name := range claudeNames { - if !canonicalNames[name] { - t.Errorf("Claude-only skill %q has no canonical .agents/skills entry", name) - } - } -} - -func hasExactLine(src, want string) bool { - for _, line := range strings.Split(src, "\n") { - if strings.TrimSpace(line) == want { - return true - } - } - return false -} - -func skillNames(t *testing.T, root string) map[string]bool { - t.Helper() - entries, err := os.ReadDir(root) - if err != nil { - t.Fatalf("read skill directory %s: %v", root, err) - } - - names := make(map[string]bool) - for _, entry := range entries { - if !entry.IsDir() { - continue - } - name := entry.Name() - if _, err := os.Stat(filepath.Join(root, name, "SKILL.md")); err != nil { - t.Errorf("skill %q under %s has no readable SKILL.md: %v", name, root, err) - continue - } - names[name] = true - } - return names -} - -func repoRelative(root, path string) string { - rel, err := filepath.Rel(root, path) - if err != nil { - return path - } - return filepath.ToSlash(rel) -} diff --git a/internal/snapshot/capture_test.go b/internal/snapshot/capture_test.go index 1f438340..e562a8f3 100644 --- a/internal/snapshot/capture_test.go +++ b/internal/snapshot/capture_test.go @@ -167,10 +167,10 @@ func TestParseBunList(t *testing.T) { { name: "scoped and unscoped entries", input: "/Users/x/.bun/install/global node_modules (3)\n" + - "├── @anthropic-ai/claude-code@1.0.5\n" + + "├── @example/cli@1.0.5\n" + "├── prettier@3.2.5\n" + "└── typescript@5.4.3\n", - expected: []string{"@anthropic-ai/claude-code", "prettier", "typescript"}, + expected: []string{"@example/cli", "prettier", "typescript"}, }, { name: "bun itself is excluded", diff --git a/internal/snapshot/snapshot_test.go b/internal/snapshot/snapshot_test.go index 074f95df..d7ba3d4b 100644 --- a/internal/snapshot/snapshot_test.go +++ b/internal/snapshot/snapshot_test.go @@ -18,13 +18,13 @@ func TestPackageSnapshot_UnmarshalJSON(t *testing.T) { }{ { name: "object format", - input: `{"formulae":["git","go"],"casks":["docker"],"taps":["homebrew/core"],"npm":["typescript"],"bun":["@anthropic-ai/claude-code"]}`, + input: `{"formulae":["git","go"],"casks":["docker"],"taps":["homebrew/core"],"npm":["typescript"],"bun":["@example/cli"]}`, expected: PackageSnapshot{ Formulae: []string{"git", "go"}, Casks: []string{"docker"}, Taps: []string{"homebrew/core"}, Npm: []string{"typescript"}, - Bun: []string{"@anthropic-ai/claude-code"}, + Bun: []string{"@example/cli"}, }, }, { From 92bf3111a7f613002b5b3dd1613925fb6fbf879c Mon Sep 17 00:00:00 2001 From: fullstackjam Date: Tue, 17 Nov 2026 22:50:03 +0800 Subject: [PATCH 2/4] ci: pin lint runner to macos-15 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b4074b0f..5445fed6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ on: jobs: lint: name: lint - runs-on: macos-latest + runs-on: macos-15 steps: - uses: actions/checkout@v7 - uses: actions/setup-go@v7 From ab3e753ffbf4baa7889907003f4f8919ecbd9891 Mon Sep 17 00:00:00 2001 From: fullstackjam Date: Tue, 17 Nov 2026 22:57:42 +0800 Subject: [PATCH 3/4] ci: pin all macOS runners to macos-15 --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 6 +++--- .github/workflows/validate-catalog.yml | 2 +- .github/workflows/vm-e2e-spike.yml | 2 +- AGENTS.md | 2 +- CONTRIBUTING.md | 4 ++-- docs/HARNESS.md | 4 ++-- testutil/machost.go | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59ba4321..88699e88 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: gate-tests: needs: detect-release-type - runs-on: macos-latest + runs-on: macos-15 steps: - name: Checkout uses: actions/checkout@v7 @@ -67,7 +67,7 @@ jobs: vm-e2e: name: release vm-e2e (L4) needs: gate-tests - runs-on: macos-latest + runs-on: macos-15 timeout-minutes: 60 steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5445fed6..4e178c48 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: unit: name: unit (L1) - runs-on: macos-latest + runs-on: macos-15 permissions: id-token: write contents: read @@ -120,7 +120,7 @@ jobs: curl-bash-smoke: name: curl|bash smoke - runs-on: macos-latest + runs-on: macos-15 steps: - name: Checkout code uses: actions/checkout@v7 @@ -151,7 +151,7 @@ jobs: cli-compat: name: old-cli compat - runs-on: macos-latest + runs-on: macos-15 steps: - name: Checkout code uses: actions/checkout@v7 diff --git a/.github/workflows/validate-catalog.yml b/.github/workflows/validate-catalog.yml index f3e1fa33..061e1c2c 100644 --- a/.github/workflows/validate-catalog.yml +++ b/.github/workflows/validate-catalog.yml @@ -7,7 +7,7 @@ on: jobs: validate: - runs-on: macos-latest + runs-on: macos-15 steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/vm-e2e-spike.yml b/.github/workflows/vm-e2e-spike.yml index 04b25617..d8985823 100644 --- a/.github/workflows/vm-e2e-spike.yml +++ b/.github/workflows/vm-e2e-spike.yml @@ -9,7 +9,7 @@ on: jobs: vm-e2e: - runs-on: macos-latest + runs-on: macos-15 timeout-minutes: 60 steps: - uses: actions/checkout@v7 diff --git a/AGENTS.md b/AGENTS.md index 82b68fca..32b94677 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -48,7 +48,7 @@ make build-release VERSION=0.25.0 # optimized + UPX # Test — full tier table in CONTRIBUTING.md make test-unit # L1 (~75s) — unit + integration + contract; pre-push hook make test-e2e # L3 compiled binary - # L4 — destructive e2e runs in CI only (vm-e2e-spike.yml on macos-latest) + # L4 — destructive e2e runs in CI only (vm-e2e-spike.yml on macos-15) make test-coverage # coverage.out + coverage.html # Single test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e8cfba7..882bed51 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ Tests are split across four tiers. Which one runs where: | **L1 Unit + Integration + Contract** | Pure-Go logic with faked `Runner` *plus* real `brew` / `git` / `npm` against temp dirs and real `httptest` servers | `make test-unit` (~75s) | Every push (pre-push hook); CI on push/PR | | **L2 Contract schema** | JSON schema validation against [openboot-contract](https://github.com/openbootdotdev/openboot-contract) | (runs in CI only) | CI on push/PR | | **L3 E2E binary** | Compiled binary driven by scripts; `-tags=e2e` | `make test-e2e` | CI on release | -| **L4 VM e2e** | Full destructive suite (`-tags="e2e,vm"`). Installs real packages, modifies `~/.zshrc`, writes `defaults`. Each run requires a clean macOS host (Apple Silicon). | CI only — `vm-e2e-spike.yml` on `macos-latest` | Every PR as the required `vm-e2e` check. No local target. | +| **L4 VM e2e** | Full destructive suite (`-tags="e2e,vm"`). Installs real packages, modifies `~/.zshrc`, writes `defaults`. Each run requires a clean macOS host (Apple Silicon). | CI only — `vm-e2e-spike.yml` on `macos-15` | Every PR as the required `vm-e2e` check. No local target. | Rules of thumb: @@ -47,7 +47,7 @@ Rules of thumb: ## VM E2E -L4 tests run on GitHub Actions (`macos-latest` runner, Apple Silicon, `vm-e2e-spike.yml`). +L4 tests run on GitHub Actions (`macos-15` runner, Apple Silicon, `vm-e2e-spike.yml`). Each job gets a fresh macOS VM — no local setup or Makefile target required. ## Git Hooks diff --git a/docs/HARNESS.md b/docs/HARNESS.md index 13c6fdae..782da702 100644 --- a/docs/HARNESS.md +++ b/docs/HARNESS.md @@ -51,7 +51,7 @@ Three regulation categories: | Behav. | L1 unit + integration + contract (faked runners *and* real brew/git/npm in temp dirs) | pre-push, CI | `make test-unit` | | Behav. | L2 contract schema (against openboot-contract repo) | every PR | `.github/workflows/test.yml` `contract` job | | Behav. | L3 e2e binary | release | `make test-e2e` | -| Behav. | L4 VM e2e (`vm`) — required full destructive suite on a clean macOS host | every PR | `.github/workflows/vm-e2e-spike.yml` (`vm-e2e` required check on a macos-latest runner) | +| Behav. | L4 VM e2e (`vm`) — required full destructive suite on a clean macOS host | every PR | `.github/workflows/vm-e2e-spike.yml` (`vm-e2e` required check on a macos-15 runner) | | Behav. | `install.sh` upgrade over an existing install — tap refresh, upgrade, reinstall fallback, and resolved-version reporting with fake Homebrew/OpenBoot commands | L1 | `test/integration/install_script_test.go` | | Behav. | Install-wizard TUI on a real pty — L3: launch/quit smoke + full keyboard choreography (stops before confirm, installs nothing); L4: same key sequence through a real install via `expect(1)`, asserting brew/git system state | L3 at release, L4 every PR | `test/e2e/install_wizard_e2e_test.go`, `test/e2e/install_wizard_vm_test.go` | | Behav. | curl\|bash smoke — mock-served install script piped into `bash`, driving the built binary through a config install (**not** `scripts/install.sh`; that's the L1 row above) | every PR | `.github/workflows/test.yml` `curl-bash-smoke` job | @@ -113,7 +113,7 @@ it survives doc rot. the two apart from `TERM`/TTY/height alone. It now draws a plain in-place `\r\033[K` status line that trails top-to-bottom output on every terminal. Don't reintroduce the scroll region. -- **L4 runs on GitHub Actions, not a self-hosted runner.** `macos-latest` +- **L4 runs on GitHub Actions, not a self-hosted runner.** `macos-15` runners are Apple Silicon VMs — each job gets a fresh clean macOS environment, which is exactly what L4 needs. Tart is no longer required. The L4 workflow (`vm-e2e-spike.yml`) runs on every PR as the required diff --git a/testutil/machost.go b/testutil/machost.go index d6a329ea..33b61219 100644 --- a/testutil/machost.go +++ b/testutil/machost.go @@ -1,7 +1,7 @@ //go:build e2e && vm // MacHost runs destructive openboot E2E tests directly against the -// current macOS host. In CI this is a fresh GitHub Actions macos-latest runner; +// current macOS host. In CI this is a fresh GitHub Actions macos-15 runner; // locally it should only be used on a throwaway machine. // // A host refuses to activate unless CI=true, OPENBOOT_IN_VM=1, or From 067f0bbcc8f519421c53dc05a72a76eae9cc3ade Mon Sep 17 00:00:00 2001 From: fullstackjam Date: Tue, 17 Nov 2026 23:22:55 +0800 Subject: [PATCH 4/4] ci: share macOS runner for checks and cancel superseded PR runs --- .github/workflows/harness.yml | 5 + .github/workflows/test.yml | 147 +++++++++++++++-------------- .github/workflows/vm-e2e-spike.yml | 5 + docs/HARNESS.md | 5 + docs/MERGE_POLICY.md | 11 ++- 5 files changed, 103 insertions(+), 70 deletions(-) diff --git a/.github/workflows/harness.yml b/.github/workflows/harness.yml index 489670f5..0906119d 100644 --- a/.github/workflows/harness.yml +++ b/.github/workflows/harness.yml @@ -27,6 +27,11 @@ on: permissions: contents: read +# Superseded PR runs should not consume runner capacity. Other events stay independent. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: govulncheck: name: govulncheck (drift) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e178c48..31250aa6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,11 @@ on: types: [contract-updated] workflow_dispatch: +# Superseded PR runs should not consume runner capacity. Other events stay independent. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: lint: name: lint @@ -68,68 +73,6 @@ jobs: coverage.html retention-days: 7 - contract: - name: contract schema (L2) - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v7 - - - name: Checkout contract - uses: actions/checkout@v7 - with: - repository: openbootdotdev/openboot-contract - ref: ${{ github.event.client_payload.ref || 'main' }} - path: .contract - - - name: Set up Go - uses: actions/setup-go@v7 - with: - go-version-file: "go.mod" - - - name: Contract schema validation - run: | - pip3 install --break-system-packages jsonschema - - python3 -c " - import json, jsonschema, sys - - checks = [ - ('.contract/schemas/remote-config.json', '.contract/fixtures/config-v1.json'), - ('.contract/schemas/snapshot.json', '.contract/fixtures/snapshot-v1.json'), - ] - - failed = 0 - for schema_path, fixture_path in checks: - schema = json.load(open(schema_path)) - data = json.load(open(fixture_path)) - try: - jsonschema.validate(data, schema) - print(f' ✓ {fixture_path.split(\"/\")[-1]} matches {schema_path.split(\"/\")[-1]}') - except jsonschema.ValidationError as e: - print(f' ✗ {fixture_path.split(\"/\")[-1]}: {e.message}') - failed += 1 - - sys.exit(1 if failed else 0) - " - - - name: Verify CLI consumes canonical fixtures losslessly - env: - OPENBOOT_CONTRACT_DIR: ${{ github.workspace }}/.contract - run: go test -v -tags=contract ./test/contract - - curl-bash-smoke: - name: curl|bash smoke - runs-on: macos-15 - steps: - - name: Checkout code - uses: actions/checkout@v7 - - - name: Set up Go - uses: actions/setup-go@v7 - with: - go-version-file: "go.mod" - - name: Build run: make build @@ -149,13 +92,6 @@ jobs: if: always() run: kill $(cat /tmp/mock-pid) 2>/dev/null || true - cli-compat: - name: old-cli compat - runs-on: macos-15 - steps: - - name: Checkout code - uses: actions/checkout@v7 - - name: Get previous release version id: prev env: @@ -225,3 +161,76 @@ jobs: - name: Stop compat mock server if: always() run: kill $(cat /tmp/compat-mock-pid) 2>/dev/null || true + + contract: + name: contract schema (L2) + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Checkout contract + uses: actions/checkout@v7 + with: + repository: openbootdotdev/openboot-contract + ref: ${{ github.event.client_payload.ref || 'main' }} + path: .contract + + - name: Set up Go + uses: actions/setup-go@v7 + with: + go-version-file: "go.mod" + + - name: Contract schema validation + run: | + pip3 install --break-system-packages jsonschema + + python3 -c " + import json, jsonschema, sys + + checks = [ + ('.contract/schemas/remote-config.json', '.contract/fixtures/config-v1.json'), + ('.contract/schemas/snapshot.json', '.contract/fixtures/snapshot-v1.json'), + ] + + failed = 0 + for schema_path, fixture_path in checks: + schema = json.load(open(schema_path)) + data = json.load(open(fixture_path)) + try: + jsonschema.validate(data, schema) + print(f' ✓ {fixture_path.split(\"/\")[-1]} matches {schema_path.split(\"/\")[-1]}') + except jsonschema.ValidationError as e: + print(f' ✗ {fixture_path.split(\"/\")[-1]}: {e.message}') + failed += 1 + + sys.exit(1 if failed else 0) + " + + - name: Verify CLI consumes canonical fixtures losslessly + env: + OPENBOOT_CONTRACT_DIR: ${{ github.workspace }}/.contract + run: go test -v -tags=contract ./test/contract + + # Preserve required check names without requesting two more macOS runners. + curl-bash-smoke: + name: curl|bash smoke + needs: unit + if: always() + runs-on: ubuntu-latest + steps: + - name: Require combined macOS checks to pass + env: + MACOS_RESULT: ${{ needs.unit.result }} + run: test "$MACOS_RESULT" = success + + cli-compat: + name: old-cli compat + needs: unit + if: always() + runs-on: ubuntu-latest + steps: + - name: Require combined macOS checks to pass + env: + MACOS_RESULT: ${{ needs.unit.result }} + run: test "$MACOS_RESULT" = success diff --git a/.github/workflows/vm-e2e-spike.yml b/.github/workflows/vm-e2e-spike.yml index d8985823..563a037f 100644 --- a/.github/workflows/vm-e2e-spike.yml +++ b/.github/workflows/vm-e2e-spike.yml @@ -7,6 +7,11 @@ on: branches: [main, master] workflow_dispatch: +# Superseded PR runs should not consume runner capacity. Other events stay independent. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: vm-e2e: runs-on: macos-15 diff --git a/docs/HARNESS.md b/docs/HARNESS.md index 782da702..71ab70ee 100644 --- a/docs/HARNESS.md +++ b/docs/HARNESS.md @@ -63,6 +63,11 @@ Three regulation categories: | Maint. | `golangci-lint` on the staged diff | local git pre-commit | `scripts/hooks/pre-commit` | | Drift loop | Failed harness sensor → open/update GitHub issue | on main / nightly | `.github/workflows/drift-to-issue.yml` | +PR checks use three macOS runners: lint, combined L1/smoke/compat, and L4. +The smoke and compatibility check names remain as Linux result gates for +the combined job. New commits cancel superseded PR runs; see +[merge policy](MERGE_POLICY.md) for the gate semantics. + ## The steering loop When you observe a recurring issue, decide where to encode the fix: diff --git a/docs/MERGE_POLICY.md b/docs/MERGE_POLICY.md index d848d4d4..97336068 100644 --- a/docs/MERGE_POLICY.md +++ b/docs/MERGE_POLICY.md @@ -14,7 +14,16 @@ this doc to bring it back in sync. All six run on every PR. There is no post-merge-only tier: every job in `.github/workflows/test.yml` fires on `push` (to `main`/`master`), `pull_request`, `repository_dispatch` (`contract-updated`), and -`workflow_dispatch` alike, with no job-level `if:` gating. +`workflow_dispatch` alike, with no path-based filtering. The +`curl|bash smoke` and `old-cli compat` +checks are Linux result gates: their tests execute after L1 in the same +macOS job, and both gates require that whole job to succeed. They run even +when the macOS job fails or is cancelled, so a skipped dependency cannot +silently satisfy branch protection. + +Each PR requests three macOS runners: lint, the combined L1/smoke/compat +job, and L4. New commits cancel older runs of the same PR in Test, Harness, +and vm-e2e-spike; push, scheduled, and manual runs remain independent. `vm-e2e` is the exception in the other direction — it is **PR-only**. Its workflow's `push` trigger is scoped to the `test/vm-e2e-speed` spike