@soleur/opencode 3.388.2 → 3.388.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleur/opencode",
3
- "version": "3.388.2",
3
+ "version": "3.388.3",
4
4
  "description": "Soleur AI organization plugin for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env bash
2
+ # changed-paths.sh -- print the changed-path list of a `git diff` as EXACT, repo-root-relative names.
3
+ #
4
+ # USAGE
5
+ # changed-paths.sh [--match ERE] <git diff args...>
6
+ #
7
+ # changed-paths.sh origin/main...HEAD every changed path, one per line
8
+ # changed-paths.sh --cached the staged set
9
+ # changed-paths.sh --match '^docs/' origin/main...HEAD only the paths matching the ERE
10
+ #
11
+ # CONTRACT
12
+ # Plain mode exit 0 = the list (possibly empty) is on stdout; exit 2 = git failed or usage was wrong. On a
13
+ # non-zero exit stdout is NOT a list and must not be read as "nothing changed".
14
+ # --match ERE grep exit semantics: 0 = at least one path matches (the matches are printed), 1 = none match,
15
+ # 2 = git or usage failure. A git failure is NEVER folded into "none match".
16
+ # No arguments, or a flag this helper owns but does not support, exits 2 with a usage line on stderr; the helper never
17
+ # defaults to a diff target of its own.
18
+ #
19
+ # WHY THIS CONSTRUCTION (#12332, reference fix #12326). A plain `git diff --name-only` is wrong for a `^`-anchored
20
+ # regex in four ways: (1) git C-quotes a name holding a non-ASCII byte, tab, `"` or `\`, so the quoted form never starts
21
+ # with the anchored prefix (`core.quotePath=false` fixes only bytes >= 0x80); (2) default rename detection lists only a
22
+ # rename's NEW path, so a rename AWAY from a gated surface is invisible; (3) a gitlink hidden by `diff.ignoreSubmodules`
23
+ # or a committed `ignore=all` is not listed; (4) a bare `$(git diff | tr)` pipe turns a git failure into an empty list.
24
+ # So: NUL-delimited (`-z`), `--no-renames`, `--ignore-submodules=none`, `git -C <top>` (so `diff.relative=true` cannot
25
+ # make the names cwd-relative), and `set -o pipefail` so a git failure is a failure. In `--match` mode git runs FIRST and
26
+ # its status is checked, then grep reads a here-string: never `grep -q` on a pipe (SIGPIPE 141 would read as failure).
27
+ #
28
+ # A name holding a newline cannot be one line of a one-name-per-line list (it would split into extra "paths", and a
29
+ # gate that ALLOWS on a match can be satisfied by a fragment), so such a diff exits 2: callers treat 2 as unknown and
30
+ # fail closed. Output-format flags (-s, --output, -q, --exit-code, ...) are refused for the same reason: they leave
31
+ # stdout empty at rc 0, which a caller would read as "nothing changed".
32
+ #
33
+ # WHEN TO USE THIS VERSUS THE INLINE FORM. Skill prose (preflight, ship, review) calls this helper: the inline form costs
34
+ # about twice the body bytes against ceilings that only ratchet down. Workflow steps and hooks stay INLINE
35
+ # (`git diff -z --no-renames --ignore-submodules=none --name-only ... | tr '\0' '\n'` inside a scoped pipefail capture)
36
+ # so a path-filtered gate never depends on a plugin script being present in the checkout it is judging.
37
+ #
38
+ # Pathspecs after `--` are relative to the repository root (the helper runs `git -C <top>`).
39
+ set -uo pipefail
40
+
41
+ usage() {
42
+ printf 'usage: changed-paths.sh [--match ERE] <git diff args...> (e.g. origin/main...HEAD, --cached)\n' >&2
43
+ exit 2
44
+ }
45
+
46
+ match=""
47
+ have_match=0
48
+ if [ "$#" -eq 0 ]; then usage; fi
49
+ if [ "${1:-}" = "--match" ]; then
50
+ [ "$#" -ge 3 ] || usage
51
+ match="$2"
52
+ have_match=1
53
+ shift 2
54
+ fi
55
+
56
+ # ALLOWLIST of options: revs and paths (anything not starting with `-`), `--cached`/`--staged`/`--merge-base`/`--diff-filter=*`,
57
+ # and everything after `--`. Every other option is refused (exit 2): output-format flags leave stdout empty or corrupt the
58
+ # list at rc 0 (-s, --output, -q, --exit-code, bundled `-ps`), and flags appended after the baked-in ones win in git, so
59
+ # `-M`/`-C`/`--find-renames`/`--ignore-submodules=all` would silently re-enable the rename and submodule hiding this helper
60
+ # exists to remove.
61
+ for a in "$@"; do
62
+ case "$a" in
63
+ --) break ;;
64
+ --cached|--staged|--merge-base|--diff-filter=*) ;;
65
+ -*) usage ;;
66
+ esac
67
+ done
68
+
69
+ if ! top="$(git rev-parse --show-toplevel 2>/dev/null)" || [ -z "$top" ]; then
70
+ printf 'changed-paths: not inside a git work tree\n' >&2
71
+ exit 2
72
+ fi
73
+
74
+ # The raw NUL stream goes to a temp file FIRST, so a git failure is a failure (never an empty list) and the bytes can be
75
+ # inspected before any LF-splitting. An unwritable TMPDIR is also rc 2: unknown, never "none match".
76
+ if ! tmp="$(mktemp 2>/dev/null)" || [ -z "$tmp" ]; then
77
+ printf 'changed-paths: cannot create a temp file\n' >&2
78
+ exit 2
79
+ fi
80
+ trap 'rm -f "$tmp"' EXIT
81
+ if ! git -C "$top" diff -z --no-renames --ignore-submodules=none --name-only "$@" >"$tmp"; then
82
+ printf 'changed-paths: git diff failed\n' >&2
83
+ exit 2
84
+ fi
85
+
86
+ # Byte locale throughout: the list is raw bytes now, and under a UTF-8 locale GNU grep reports a name holding an
87
+ # invalid UTF-8 byte as "binary file matches" instead of printing it.
88
+ if [ "$(LC_ALL=C tr -dc '\n' <"$tmp" | wc -c)" -gt 0 ]; then
89
+ printf 'changed-paths: a changed path contains a newline; it cannot be listed one per line\n' >&2
90
+ exit 2
91
+ fi
92
+ out="$(LC_ALL=C tr '\0' '\n' <"$tmp")"
93
+
94
+ if [ "$have_match" -eq 0 ]; then
95
+ # A failed write (full disk, closed pipe) is a failure: a truncated list at rc 0 reads as a shorter diff.
96
+ [ -z "$out" ] || printf '%s\n' "$out" || exit 2
97
+ exit 0
98
+ fi
99
+
100
+ [ -n "$out" ] || exit 1
101
+ # printf into grep (no -q, so grep reads everything and never SIGPIPEs the writer); a here-string would spill to a
102
+ # temp file for a large list and an unwritable TMPDIR would skip grep entirely and read as rc 1.
103
+ printf '%s\n' "$out" | LC_ALL=C grep -E -e "$match"
104
+ exit $?
@@ -43,7 +43,10 @@ jobs:
43
43
  # making the three-dot diff fail under `set -e` and redden every
44
44
  # non-target PR. checkout already used fetch-depth: 0 (full history).
45
45
  git fetch --no-tags origin "$BASE_REF"
46
- changed_files=$(git -c core.quotePath=false diff --name-only "origin/${BASE_REF}...HEAD")
46
+ # (#12332) NUL-delimited and rename-free: a tab, `"` or `\` name stays under the anchor
47
+ # (core.quotePath=false never covered those), a rename away from __TARGET_DIR__/ lists its
48
+ # old path, and `set -o pipefail` above makes a failed diff fail the step, not read as "no change".
49
+ changed_files=$(git diff -z --no-renames --ignore-submodules=none --name-only "origin/${BASE_REF}...HEAD" | tr '\0' '\n')
47
50
  if grep -qE '^__TARGET_DIR__/' <<<"$changed_files"; then
48
51
  echo "changed=true" >> "$GITHUB_OUTPUT"
49
52
  else
@@ -42,22 +42,22 @@ Run `git rev-parse --abbrev-ref HEAD` to get the current branch name.
42
42
 
43
43
  ### Step 0.1: Compute changed-file path-set (diff classifier)
44
44
 
45
- Run `git diff --name-only origin/main...HEAD` ONCE up-front and cache the result so each path-gated check re-uses the same path-set instead of re-running diff. Skill convention forbids `$()` command substitution — write the diff to a tmpfile so checks can `grep -E` the predicate they care about.
45
+ Run the helper below (NUL-delimited, rename-free, submodule-honest; rc 2 on failure) ONCE up-front and cache the result so each path-gated check re-uses the same path-set instead of re-running diff. Skill convention forbids `$()` command substitution — write the diff to a tmpfile so checks can `grep -E` the predicate they care about.
46
46
 
47
47
  Use `git rev-parse --git-dir` to resolve a writable tmp path that works in both regular checkouts and worktrees: in a worktree `.git` is a file (gitdir pointer), not a directory, so `> .git/<filename>` fails with `Not a directory (os error 20)`. The resolver returns the worktree's actual gitdir (e.g., `<bare>/worktrees/<name>/`):
48
48
 
49
49
  ```bash
50
50
  PREFLIGHT_TMP="$(git rev-parse --git-dir)"
51
- git diff --name-only origin/main...HEAD > "$PREFLIGHT_TMP/preflight-diff-files.txt"
51
+ bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD > "$PREFLIGHT_TMP/preflight-diff-files.txt" || { rm -f "$PREFLIGHT_TMP/preflight-diff-files.txt"; echo "PREFLIGHT-CACHE-MISSING: helper failed"; }
52
52
  ```
53
53
 
54
54
  All downstream `cat .git/<filename>` references in the predicates below must use `"$PREFLIGHT_TMP/<filename>"` instead. The pre-existing `.git/...` literals worked in non-worktree checkouts but silently broke in worktrees (where every preflight increasingly happens by default).
55
55
 
56
- If the command fails (e.g., offline, no remote), every path-gated check falls back to its existing `git diff` form — operators do not need to handle this case explicitly. Between Phase 0 and Phase 1 nothing mutates the working tree or fetches `origin/main`, so the cache is valid for the duration of one preflight invocation. The cache lives under the per-worktree gitdir (user-owned, scoped to one worktree) — this isolates concurrent preflight runs across sibling worktrees and avoids the `/tmp/` symlink-clobber class that affects fixed-name shared paths on multi-user hosts.
56
+ **Cache-missing rule.** On helper failure (offline, no remote) the cache file is removed and `PREFLIGHT-CACHE-MISSING` printed; a MISSING cache means RUN every path-gated check, never SKIP (an existing empty file is a real empty diff). Every SKIP predicate below reads: cache file absent => RUN; `grep` rc 1 => SKIP; rc 2 (or any other) => RUN. Never SKIP on "non-zero" or on empty output of a read that errored. Between Phase 0 and Phase 1 nothing mutates the working tree or fetches `origin/main`, so the cache is valid for the duration of one preflight invocation. The cache lives under the per-worktree gitdir (user-owned, scoped to one worktree) — this isolates concurrent preflight runs across sibling worktrees and avoids the `/tmp/` symlink-clobber class that affects fixed-name shared paths on multi-user hosts.
57
57
 
58
58
  **Fast-path SKIP overview.** For diffs whose path-set matches a recognized "guaranteed-SKIP" shape, the relevant check returns SKIP at its first step without further work. The predicates below are the existing inner predicates of each check — only the diff source is changed.
59
59
 
60
- | Check | Fast-path SKIP predicate (against `"$PREFLIGHT_TMP/preflight-diff-files.txt"`) |
60
+ | Check | Fast-path SKIP predicate (against `"$PREFLIGHT_TMP/preflight-diff-files.txt"`; cache-missing rule: missing = RUN) |
61
61
  | --- | --- |
62
62
  | 1 (Migrations) | Zero matches for `(^\|/)supabase/migrations/.*\.sql$`. |
63
63
  | 2 (Sec headers) | Zero matches for `\.(tsx\|css\|html)$`, `middleware\.ts$`, `next\.config\.`, `\.tf$`, `Dockerfile`, `nginx`, `\.github/workflows/`. |
@@ -129,9 +129,9 @@ Re-use the cached path-set from Phase 0 Step 0.1 (`"$PREFLIGHT_TMP/preflight-dif
129
129
  grep -E '(^|/)supabase/migrations/.*\.sql$' "$PREFLIGHT_TMP/preflight-diff-files.txt"
130
130
  ```
131
131
 
132
- The regex anchors are intentional: `(^|/)` accepts both top-level (`supabase/migrations/X.sql`) and nested-under-app-dir paths (`apps/web-platform/supabase/migrations/X.sql`); `.*\.sql$` accepts files at any depth under the migrations directory (matching git pathspec's `*` which crosses `/`). Verify at edit time via `_v=$(mktemp -d -t soleur-run.$$.XXXXXXXX) && a=$(mktemp -p "$_v") && b=$(mktemp -p "$_v") && git diff --name-only origin/main...HEAD -- '*/supabase/migrations/*.sql' supabase/migrations/*.sql > "$a" && grep -E '(^|/)supabase/migrations/.*\.sql$' "$PREFLIGHT_TMP/preflight-diff-files.txt" > "$b" && diff -u "$a" "$b"`.
132
+ The regex anchors are intentional: `(^|/)` accepts both top-level (`supabase/migrations/X.sql`) and nested-under-app-dir paths (`apps/web-platform/supabase/migrations/X.sql`); `.*\.sql$` accepts files at any depth under the migrations directory (matching git pathspec's `*` which crosses `/`). Verify at edit time via `_v=$(mktemp -d -t soleur-run.$$.XXXXXXXX) && a=$(mktemp -p "$_v") && b=$(mktemp -p "$_v") && bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '(^|/)supabase/migrations/.*\.sql$' origin/main...HEAD > "$a" && grep -E '(^|/)supabase/migrations/.*\.sql$' "$PREFLIGHT_TMP/preflight-diff-files.txt" > "$b" && diff -u "$a" "$b"`.
133
133
 
134
- If no migration files are found (grep rc=1), return **SKIP**.
134
+ If the cache file is absent, RUN the check. Otherwise `grep` rc 1 (no migration files) => return **SKIP**; rc 2 => RUN.
135
135
 
136
136
  **Step 1.1b: Detect documented prd-apply deferral (early SKIP).**
137
137
 
@@ -228,7 +228,7 @@ curl --disable --proto '=https' -m 30 -fsS --config - "${SUPABASE_URL}/rest/v1/<
228
228
 
229
229
  **Step 2.1: Detect relevant file changes.**
230
230
 
231
- Re-use the cached path-set from Phase 0 Step 0.1:
231
+ Re-use the cached path-set from Phase 0 Step 0.1. If the cache file is absent, RUN the check (skip Step 2.1's read); otherwise:
232
232
 
233
233
  ```bash
234
234
  cat "$PREFLIGHT_TMP/preflight-diff-files.txt"
@@ -236,7 +236,7 @@ cat "$PREFLIGHT_TMP/preflight-diff-files.txt"
236
236
 
237
237
  Check if any changed files match these patterns: `.tsx`, `.css`, `.html`, `middleware.ts`, `next.config.*`, `.tf`, `Dockerfile`, `nginx*`, `.github/workflows/*`.
238
238
 
239
- If no relevant files changed, return **SKIP** (fast-path — no Doppler fetch needed when the diff has no client-bundle, infra, or workflow surface).
239
+ If the cache exists, `cat` succeeded, and no relevant files changed, return **SKIP** (fast-path — no Doppler fetch needed when the diff has no client-bundle, infra, or workflow surface).
240
240
 
241
241
  **Step 2.2: Get production URL from Doppler.**
242
242
 
@@ -385,7 +385,7 @@ Otherwise **PASS**.
385
385
 
386
386
  ### Check 5: Production Bundle Supabase Host
387
387
 
388
- **Path-gated:** only runs when the cached path-set from Phase 0 Step 0.1 (`"$PREFLIGHT_TMP/preflight-diff-files.txt"`) contains any of `apps/web-platform/lib/supabase/client.ts`, `apps/web-platform/lib/supabase/validate-url.ts`, `apps/web-platform/lib/supabase/validate-anon-key.ts`, `apps/web-platform/Dockerfile`, `.github/workflows/reusable-release.yml`, or `apps/web-platform/scripts/verify-required-secrets.sh`. Otherwise return **SKIP** with note: "No build-arg surface changes detected." The path predicate is identical to the original `git diff --name-only origin/main...HEAD` form — only the diff source is changed.
388
+ **Path-gated:** only runs when the cached path-set from Phase 0 Step 0.1 (`"$PREFLIGHT_TMP/preflight-diff-files.txt"`) contains any of `apps/web-platform/lib/supabase/client.ts`, `apps/web-platform/lib/supabase/validate-url.ts`, `apps/web-platform/lib/supabase/validate-anon-key.ts`, `apps/web-platform/Dockerfile`, `.github/workflows/reusable-release.yml`, or `apps/web-platform/scripts/verify-required-secrets.sh`. Otherwise (cache file present, `grep` rc 1) return **SKIP** with note: "No build-arg surface changes detected." A missing cache or `grep` rc 2 => RUN. The path set is the helper's exact-name list (NUL-delimited, rename-free, submodule-honest).
389
389
 
390
390
  **Note:** Complements Check 4. Check 4 enforces Doppler dev/prd isolation; Check 5 covers the GitHub-repo-secrets surface that feeds the prod Docker build (`secrets.NEXT_PUBLIC_SUPABASE_URL` and `secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY` in `reusable-release.yml`). The two sources can drift — see `knowledge-base/project/learnings/bug-fixes/2026-04-28-oauth-supabase-url-test-fixture-leaked-into-prod-build.md` (URL class) and `knowledge-base/project/learnings/bug-fixes/2026-04-28-anon-key-test-fixture-leaked-into-prod-build.md` (anon-key class).
391
391
 
@@ -510,9 +510,9 @@ set -uo pipefail
510
510
  grep -E "$SENSITIVE_PATH_RE" "$PREFLIGHT_TMP/preflight-diff-files.txt"
511
511
  ```
512
512
 
513
- Run as two separate Bash calls (assignment, then the `grep`). The path-set comes from the cached file written by Phase 0 Step 0.1 — the regex itself is byte-identical to the form previously consumed by `git diff --name-only origin/main...HEAD | grep -E "$SENSITIVE_PATH_RE"`. The regex covers every Next.js attack surface (`middleware.ts`, every `app/api/**` route, security/CSP/auth/session/legal libraries, infra Terraform under `apps/*/infra/`, all Doppler-aware shell scripts, and every credential-handling workflow even when `doppler` is not in the filename).
513
+ Run as two separate Bash calls (assignment, then the `grep`). The path-set comes from the cached file written by Phase 0 Step 0.1 — the helper's list is exact (NUL-delimited, rename-free, submodule-honest), so the `^`-anchored regex sees real names. The regex covers every Next.js attack surface (`middleware.ts`, every `app/api/**` route, security/CSP/auth/session/legal libraries, infra Terraform under `apps/*/infra/`, all Doppler-aware shell scripts, and every credential-handling workflow even when `doppler` is not in the filename).
514
514
 
515
- If `grep` exits non-zero (no match), return **SKIP** with note: "No sensitive paths touched."
515
+ If the cache file is absent, RUN. Otherwise `grep` rc 1 (no match) => return **SKIP** with note: "No sensitive paths touched."; rc 2 => RUN.
516
516
 
517
517
  **Step 6.2: Resolve the canonical compliance source (Shared Plan-File Resolution).**
518
518
 
@@ -582,7 +582,7 @@ If `RESULT=PASS_INCIDENT` or `RESULT=PASS_AGGREGATE`: **PASS**.
582
582
 
583
583
  ### Check 8: Service Worker Cache Bump on Client-Bundle Regression Fix
584
584
 
585
- **Path-gated:** only runs when the cached path-set from Phase 0 Step 0.1 (`"$PREFLIGHT_TMP/preflight-diff-files.txt"`) AND the commit log together satisfy BOTH a regression-fix marker (a commit subject starting with `fix(`, `fix:`, or `hotfix`) AND any file under `apps/web-platform/lib/supabase/`, `apps/web-platform/sentry.client.config.ts`, `apps/web-platform/lib/auth/`, `apps/web-platform/lib/byok/`, or `apps/web-platform/components/error-boundary-view.tsx`. Otherwise return **SKIP** with note: "No client-bundle regression-fix surface detected." The path predicate is identical to the original `git diff --name-only origin/main...HEAD` form — only the diff source is changed.
585
+ **Path-gated:** only runs when the cached path-set from Phase 0 Step 0.1 (`"$PREFLIGHT_TMP/preflight-diff-files.txt"`) AND the commit log together satisfy BOTH a regression-fix marker (a commit subject starting with `fix(`, `fix:`, or `hotfix`) AND any file under `apps/web-platform/lib/supabase/`, `apps/web-platform/sentry.client.config.ts`, `apps/web-platform/lib/auth/`, `apps/web-platform/lib/byok/`, or `apps/web-platform/components/error-boundary-view.tsx`. Otherwise return **SKIP** with note: "No client-bundle regression-fix surface detected." A missing cache => RUN the path half (never SKIP on it). The path set is the helper's exact-name list.
586
586
 
587
587
  **Rationale:** Content-hashed Next.js chunks normally invalidate cache automatically — new content → new filename → SW cache miss → fresh fetch. But the SW at `apps/web-platform/public/sw.js` uses a cache-first strategy under a single `CACHE_NAME` for `/_next/static/**`, and old broken chunks remain cached under their old filenames until either (a) browser eviction, or (b) the activate handler purges them via a `CACHE_NAME` bump. After PR #3014 deployed v0.58.0 with a corrected validator, users still saw the dashboard error.tsx because their SW was serving cached PR #3007 chunks. Without bumping `CACHE_NAME`, a regression fix to the inlined client bundle relies on every user manually clearing site data — unacceptable for an auth-tree outage.
588
588
 
@@ -602,7 +602,7 @@ Re-use the cached path-set from Phase 0 Step 0.1:
602
602
  grep -E '^apps/web-platform/(lib/(supabase|auth|byok)/|sentry\.client\.config\.ts|components/error-boundary-view\.tsx)' "$PREFLIGHT_TMP/preflight-diff-files.txt" | head -1
603
603
  ```
604
604
 
605
- The regex is byte-identical to the form previously piped from `git diff --name-only origin/main...HEAD`. If empty, return **SKIP** with note: "No client-bundle surface touched."
605
+ If the cache file is absent, RUN. If present and `grep` rc is 1, return **SKIP** with note: "No client-bundle surface touched."; rc 2 => RUN.
606
606
 
607
607
  **Step 8.3: Compare `CACHE_NAME` against `origin/main`.**
608
608
 
@@ -694,7 +694,7 @@ SENSITIVE_PATH_RE='^(apps/web-platform/(server|supabase|app/api|middleware\.ts$)
694
694
  grep -E "$SENSITIVE_PATH_RE" "$PREFLIGHT_TMP/preflight-diff-files.txt"
695
695
  ```
696
696
 
697
- If `grep` exits non-zero, return **SKIP** with note: "No sensitive paths touched."
697
+ If the cache file is absent, RUN. Otherwise `grep` rc 1 => return **SKIP** with note: "No sensitive paths touched."; rc 2 => RUN.
698
698
 
699
699
  **Step 10.2: Resolve the plan file (Shared Plan-File Resolution).**
700
700
 
@@ -1345,7 +1345,7 @@ On **FAIL**, present the failure reason + sanitized command + diagnostic and off
1345
1345
 
1346
1346
  ### Check 7: Canary Probe Set Covers Authenticated Surface
1347
1347
 
1348
- **Path-gated:** only runs when the cached path-set from Phase 0 Step 0.1 (`"$PREFLIGHT_TMP/preflight-diff-files.txt"`) contains `apps/web-platform/infra/ci-deploy.sh`. Otherwise return **SKIP** with note: "ci-deploy.sh untouched." The path predicate is identical to the original `git diff --name-only origin/main...HEAD` form — only the diff source is changed.
1348
+ **Path-gated:** only runs when the cached path-set from Phase 0 Step 0.1 (`"$PREFLIGHT_TMP/preflight-diff-files.txt"`) contains `apps/web-platform/infra/ci-deploy.sh`. Otherwise (cache file present, no match) return **SKIP** with note: "ci-deploy.sh untouched." A missing cache => RUN. The path set is the helper's exact-name list.
1349
1349
 
1350
1350
  **Rationale:** The legacy canary probed only `/health`, which is middleware-bypassed and never imports `lib/supabase/client.ts`. A broken inlined `NEXT_PUBLIC_SUPABASE_*` value would pass canary and ship to prod (PR #3014 incident class). The canary contract — documented in `knowledge-base/engineering/operations/runbooks/canary-probe-set.md` — requires probes for every public route (`/login`) AND auth-gated entry (`/dashboard`) PLUS a body-content sentinel rejection.
1351
1351
 
@@ -1394,9 +1394,10 @@ that no longer resolves). Consumes the deterministic analyzer `domain-model-drif
1394
1394
  ```bash
1395
1395
  DIFF="$PREFLIGHT_TMP/preflight-diff-files.txt"
1396
1396
  # Fail-safe: never SKIP on a missing/empty cache — recompute inline, then run if still empty.
1397
- if [[ ! -s "$DIFF" ]]; then git diff --name-only origin/main...HEAD > "$DIFF" 2>/dev/null || true; fi
1398
- if [[ -s "$DIFF" ]] && ! grep -qE '(^|/)apps/web-platform/supabase/migrations/.*\.sql$|(^|/)apps/web-platform/server/workspace-resolver\.ts$|(^|/)knowledge-base/engineering/architecture/domain-model\.md$' "$DIFF"; then
1399
- echo "SKIP — no business-rule surface (migration/workspace-resolver/register) in diff"; exit 0
1397
+ if [[ ! -s "$DIFF" ]]; then if bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD > "$DIFF.new" 2>/dev/null; then mv -f "$DIFF.new" "$DIFF"; else rm -f "$DIFF.new" "$DIFF"; fi; fi
1398
+ if [[ -s "$DIFF" ]]; then
1399
+ grep -qE '(^|/)apps/web-platform/supabase/migrations/.*\.sql$|(^|/)apps/web-platform/server/workspace-resolver\.ts$|(^|/)knowledge-base/engineering/architecture/domain-model\.md$' "$DIFF"; rc=$?
1400
+ if [[ $rc -eq 1 ]]; then echo "SKIP — no business-rule surface (migration/workspace-resolver/register) in diff"; exit 0; fi # rc 1 = no match => SKIP; rc 2 (grep error) => run
1400
1401
  fi
1401
1402
  ```
1402
1403
 
@@ -1448,9 +1449,10 @@ prose; it shells out and relays the exit code.
1448
1449
  ```bash
1449
1450
  DIFF="$PREFLIGHT_TMP/preflight-diff-files.txt"
1450
1451
  # Fail-safe: never SKIP on a missing/empty cache — recompute inline, then run if still empty.
1451
- if [[ ! -s "$DIFF" ]]; then git diff --name-only origin/main...HEAD > "$DIFF" 2>/dev/null || true; fi
1452
- if [[ -s "$DIFF" ]] && ! grep -qE '\.tf$|supabase/migrations/.*\.sql$|cloud-init.*\.ya?ml$|docker-compose.*\.ya?ml$' "$DIFF"; then
1453
- echo "SKIP — no store-class or connection-class surface (*.tf / migration / cloud-init / docker-compose) in diff"; exit 0
1452
+ if [[ ! -s "$DIFF" ]]; then if bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD > "$DIFF.new" 2>/dev/null; then mv -f "$DIFF.new" "$DIFF"; else rm -f "$DIFF.new" "$DIFF"; fi; fi
1453
+ if [[ -s "$DIFF" ]]; then
1454
+ grep -qE '\.tf$|supabase/migrations/.*\.sql$|cloud-init.*\.ya?ml$|docker-compose.*\.ya?ml$' "$DIFF"; rc=$?
1455
+ if [[ $rc -eq 1 ]]; then echo "SKIP — no store-class or connection-class surface (*.tf / migration / cloud-init / docker-compose) in diff"; exit 0; fi # rc 1 = no match => SKIP; rc 2 (grep error) => run
1454
1456
  fi
1455
1457
  ```
1456
1458
 
@@ -110,16 +110,18 @@ Proceed once the tree is ready (worktree or current branch).
110
110
 
111
111
  Before spawning review agents, classify the PR to right-size the panel.
112
112
 
113
- 1. Run `git diff --name-only origin/main...HEAD | head -n 200` to get the list of changed files. Also capture status letters and line counts. Use `git rev-parse --git-dir` to resolve a writable tmp path that works in both regular checkouts and worktrees: in a worktree `.git` is a file (gitdir pointer), not a directory, so `> .git/review-*.txt` fails with `Not a directory (os error 20)`. The resolver returns the worktree's actual gitdir (e.g., `<bare>/worktrees/<name>/`):
113
+ 1. Run the helper below (NUL-delimited, rename-free, submodule-honest; rc 2 on failure) to write the list of changed files; show `head -n 200 "$REVIEW_TMP/review-changed.txt"`. Also capture status letters and line counts. Resolve the tmp path with `git rev-parse --git-dir` (in a worktree `.git` is a file, so `> .git/review-*.txt` fails with `Not a directory`):
114
114
 
115
115
  ```bash
116
116
  REVIEW_TMP="$(git rev-parse --git-dir)"
117
- git diff --name-only origin/main...HEAD > "$REVIEW_TMP/review-changed.txt"
117
+ bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" origin/main...HEAD > "$REVIEW_TMP/review-changed.txt" || { rc=$?; rm -f "$REVIEW_TMP/review-changed.txt"; echo "REVIEW-CLASSIFY-UNKNOWN: helper rc=$rc"; }
118
118
  git diff --name-status origin/main...HEAD > "$REVIEW_TMP/review-status.txt"
119
119
  git diff --numstat origin/main...HEAD > "$REVIEW_TMP/review-numstat.txt"
120
120
  ```
121
121
 
122
- All downstream `cat .git/review-*.txt` references in the predicates below must use `"$REVIEW_TMP/review-*.txt"` instead. The pre-existing `.git/...` literals work in non-worktree checkouts but silently break in worktrees (where every PR review increasingly happens by default).
122
+ If the helper fails (rc 2/127; marker printed, file removed), skip the decision tree: class = code (full panel) and run gdpr-gate (fail toward more review).
123
+
124
+ All downstream `cat .git/review-*.txt` references in the predicates below must use `"$REVIEW_TMP/review-*.txt"` instead.
123
125
 
124
126
  2. Check for override: scan `$ARGUMENTS` for "deep review" or "full review". Also run `gh pr view --json body,title --jq '.body + " " + .title'` and check for the same phrases. If override detected, skip classification and spawn all 8 agents.
125
127
  3. Apply the four-class decision tree below in order; **first match wins** (override always trumps):
@@ -380,7 +382,7 @@ Tier resolution + the no-double-invoke rule: [risk-tier-and-fix-rounds.md](refer
380
382
 
381
383
  **When to run gdpr-gate at review time:**
382
384
 
383
- - `git diff main...HEAD --name-only | grep -E "$CANONICAL_REGEX"` returns at least one match (mirrored regex source: `plugins/soleur/skills/gdpr-gate/SKILL.md` §"Path globs (canonical)").
385
+ - `bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match "$CANONICAL_REGEX" origin/main...HEAD` exits 0 (a match) or 2/127 (unknown: treat as a match) (mirrored regex source: `plugins/soleur/skills/gdpr-gate/SKILL.md` §"Path globs (canonical)").
384
386
 
385
387
  **What this agent checks:**
386
388
 
@@ -936,7 +936,7 @@ SIGNAL=$(grep -niE "$SIGNAL_RE" "$PR_BODY_FILE" || true)
936
936
  **Detection:**
937
937
 
938
938
  ```bash
939
- gdpr_gate_touch=$(git diff main...HEAD --name-only | grep -E '^plugins/soleur/skills/gdpr-gate/' | head -n 1)
939
+ gdpr_gate_touch=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '^plugins/soleur/skills/gdpr-gate/' origin/main...HEAD) || { [ $? -eq 1 ] || gdpr_gate_touch=unknown; }
940
940
  sui_plan=$(gh pr view --json body --jq .body \
941
941
  | grep -oE 'knowledge-base/project/(plans|specs)/[^[:space:])]+' | head -n 1 || true)
942
942
  sui_threshold=""
@@ -945,12 +945,12 @@ if [[ -n "$sui_plan" && -f "$sui_plan" ]]; then
945
945
  fi
946
946
  ```
947
947
 
948
- **If triggered AND PR is not already labeled `compliance/critical`:**
948
+ **If triggered (`unknown` counts as triggered) AND PR is not already labeled `compliance/critical`:**
949
949
 
950
950
  1. Apply the label: `gh pr edit <N> --add-label compliance/critical` (idempotent — `gh` silently no-ops if already applied).
951
- 2. Announce: "Auto-applied `compliance/critical` to PR #<N> (gdpr-gate diff match) — `soleur:engineering:review:user-impact-reviewer` will be invoked at PR-review time per `review/SKILL.md` conditional-agent block."
951
+ 2. Announce: "Auto-applied `compliance/critical` to PR #<N> (gdpr-gate diff match); `soleur:engineering:review:user-impact-reviewer` runs at PR-review time."
952
952
 
953
- **Why:** AC10 of any `single-user incident` plan requires PR co-label. Operator-attested labels are a workflow-gap class (see #3521 review user-impact #7) — auto-application closes the gap. Idempotent + reversible (operator can remove if false-positive).
953
+ **Why:** AC10 of any `single-user incident` plan requires the PR co-label; operator-attested labels are a workflow-gap class (#3521).
954
954
 
955
955
  ### gdpr-gate Critical-Finding Acknowledgment Gate
956
956
 
@@ -960,13 +960,13 @@ fi
960
960
 
961
961
  ```bash
962
962
  CANONICAL_REGEX='^(apps/web-platform/supabase/migrations/|apps/web-platform/lib/auth/|apps/web-platform/server/.*auth.*\.(ts|tsx|js)|apps/web-platform/app/api/.*\.(ts|tsx)$|.*\.sql$)'
963
- diff_match=$(git diff main...HEAD --name-only | grep -E "$CANONICAL_REGEX" | head -n 1)
963
+ diff_match=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match "$CANONICAL_REGEX" origin/main...HEAD) || { [ $? -eq 1 ] || diff_match=unknown; }
964
964
  crit_refs=$(gh pr view --json body --jq .body | grep -oE '(Closes|Ref) #[0-9]+' | head -n 5)
965
965
  ```
966
966
 
967
967
  For each `crit_ref`, check `gh issue view <N> --json labels --jq '.labels[].name'` for `compliance/critical`.
968
968
 
969
- **If triggered:**
969
+ **If triggered (`unknown` counts as triggered):**
970
970
 
971
971
  1. Verify each `compliance/critical` issue referenced has a corresponding row in `knowledge-base/legal/compliance-posture.md` Active Items.
972
972
  2. **Interactive mode:** Ask "Critical finding #N has no Active Items row. File the row now via `soleur:compound`, or proceed with operator acknowledgment recorded inline?" Options: (a) File row, (b) Acknowledge inline, (c) Halt.
@@ -1044,18 +1044,18 @@ DEPLOY_PIPELINE_FIX_TRIGGERS=(
1044
1044
  )
1045
1045
  DPF_REGEX='^apps/web-platform/infra/(ci-deploy\.sh|ci-deploy-wrapper\.sh|webhook\.service|cat-deploy-state\.sh|canary-bundle-claim-check\.sh|hooks\.json\.tmpl|deploy-inngest-bootstrap\.sudoers|infra-config-apply\.sh|infra-config-install\.sh|push-infra-config\.sh|cat-infra-config-state\.sh|inngest-enumerate-reminders\.sh|inngest-rearm-reminders\.sh|inngest-wiped-volume-verify\.sh|cat-inngest-verify-state\.sh|inngest-inventory\.sh|git-lock-chardevice-sweep\.sh|inngest-registry-probe\.sh|inngest-doublefire-probe\.sh|inngest-redis-bootstrap\.sh|inngest-cutover-flip\.sh|inngest-server-flip-guard\.sh|cat-inngest-cutover-state\.sh|soleur-doppler-token\.tmpl|10-vector-doppler-token\.conf|10-inngest-heartbeat-doppler-token\.conf|10-inngest-server-doppler-token\.conf|10-inngest-redis-doppler-token\.conf)$'
1046
1046
 
1047
- git diff --name-only origin/main...HEAD | grep -E "$DPF_REGEX"
1047
+ dpf_match=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match "$DPF_REGEX" origin/main...HEAD) || { [ $? -eq 1 ] || dpf_match=unknown; }
1048
1048
  ```
1049
1049
 
1050
- If the grep matches at least one path, the gate fires. Trigger condition is "≥1 match" — the gate fires once for the PR, not once per matched file.
1050
+ If `dpf_match` is non-empty, the gate fires; `unknown` (rc 2/127) also fires it (fail closed). Trigger condition is "≥1 match" — the gate fires once for the PR, not once per matched file.
1051
1051
 
1052
1052
  **If triggered:**
1053
1053
 
1054
- The PR's diff will produce drift on `terraform_data.deploy_pipeline_fix` — by design, because `hcloud_server.web` has `lifecycle.ignore_changes = [user_data]` (per `#967`) so cloud-init can't re-apply.
1054
+ The PR's diff will produce drift on `terraform_data.deploy_pipeline_fix` by design: `hcloud_server.web` has `lifecycle.ignore_changes = [user_data]` (`#967`), so cloud-init can't re-apply.
1055
1055
 
1056
- **Auto-apply on merge.** The [`apply-deploy-pipeline-fix.yml`](../../../../.github/workflows/apply-deploy-pipeline-fix.yml) workflow auto-fires on push to `main` when any trigger file changes. It runs the targeted `terraform apply` from Doppler `prd_terraform`, verifies the post-apply `files_written == files_total` invariant, and auto-closes any open `infra: drift detected in web-platform` issue. **Zero operator action required** post-merge — the PR review is the human authorization. Kill switch: include `[skip-deploy-fix-apply]` in any commit message on the PR to suppress the apply for that merge.
1056
+ **Auto-apply on merge.** The [`apply-deploy-pipeline-fix.yml`](../../../../.github/workflows/apply-deploy-pipeline-fix.yml) workflow auto-fires on push to `main` when any trigger file changes. It runs the targeted `terraform apply` from Doppler `prd_terraform`, verifies the post-apply `files_written == files_total` invariant, and auto-closes any open `infra: drift detected in web-platform` issue. **Zero operator action required** post-merge (the PR review is the authorization). Kill switch: include `[skip-deploy-fix-apply]` in any commit message on the PR to suppress the apply for that merge.
1057
1057
 
1058
- **Both resources auto-apply (#4829).** The workflow's `-target=` set now lists BOTH `terraform_data.deploy_pipeline_fix` (HTTPS webhook push) AND `terraform_data.infra_config_handler_bootstrap` (the root-SSH bridge that delivers the handler + the `infra-config-install` escalation helper + the sudoers grant). The runner reaches the SSH bridge over the existing Cloudflare Tunnel SSH route — it opens a `cloudflared access tcp` localhost forward authenticated by the CF Access `ci_ssh` service token. The firewall `admin_ips` allowlist is unchanged (the tunnel is the access path, not an IP grant). A handler/helper/sudoers change therefore lands on prod with **zero operator `terraform apply`** — eliminating the manual step that left #4827 dormant. **One-time precondition:** the live host must already trust the current CI key (`terraform_data.root_authorized_keys`, applied on the operator's most recent full `terraform apply`); a first-apply `Permission denied (publickey)` means the key is not on-host, not a bridge defect (the CI path cannot self-apply `root_authorized_keys` — same firewall reason).
1058
+ **Both resources auto-apply (#4829).** The workflow's `-target=` set now lists BOTH `terraform_data.deploy_pipeline_fix` (HTTPS webhook push) AND `terraform_data.infra_config_handler_bootstrap` (the root-SSH bridge that delivers the handler + the `infra-config-install` escalation helper + the sudoers grant). The runner reaches the SSH bridge over the existing Cloudflare Tunnel SSH route — it opens a `cloudflared access tcp` localhost forward authenticated by the CF Access `ci_ssh` service token. The firewall `admin_ips` allowlist is unchanged (the tunnel is the access path, not an IP grant). A handler/helper/sudoers change therefore lands on prod with **zero operator `terraform apply`** — eliminating the manual step that left #4827 dormant. **One-time precondition:** the live host must already trust the current CI key (`terraform_data.root_authorized_keys`, applied on the operator's most recent full `terraform apply`); a first-apply `Permission denied (publickey)` means the key is not on-host, not a bridge defect.
1059
1059
 
1060
1060
  **In-session apply (operator-machine fallback, #4829).** When `soleur:ship` runs on the operator's own machine rather than CI — detect via `[[ -z "${CI:-}" && -z "${GITHUB_ACTIONS:-}" ]]` AND `ssh-add -l` listing a key — the agent CAN apply the bridge in-session over the operator's direct SSH (their IP is in `admin_ips`, their ssh-agent key is in root's `authorized_keys`) instead of deferring to the CI auto-apply. This is the rare fallback (transient CI failure, or shipping a handler change you want live immediately); the CI auto-apply above is the default. Run:
1061
1061
 
@@ -2176,7 +2176,7 @@ K=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/ci-head-verdict.sh" ready-count PR_NUMBE
2176
2176
 
2177
2177
  Arm (`gh pr merge --squash --auto`) ONLY on exit 0; else report "readied but unarmed" with the last stdout line and follow [ready-run-wait.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/ready-run-wait.md) (a failed `ready-count` or `api-error` needs no undo). A non-draft PR goes straight to the arm.
2178
2178
 
2179
- If `git diff --no-renames --name-only origin/main...HEAD | grep -E '^\.github/(workflows|actions)/'` prints anything, tell the operator in chat now: auto-merge is queued and polled as usual, but this PR has no agent `--admin` fallback (`UNTRUSTED-CI`), so if a BEHIND livelock sets in they will be asked to merge it. See [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md). **Why:** #8611.
2179
+ If `bash "${CLAUDE_PLUGIN_ROOT}/scripts/changed-paths.sh" --match '^\.github/(workflows|actions)/' origin/main...HEAD` prints anything or exits 2/127, tell the operator in chat now: auto-merge is queued and polled as usual, but this PR has no agent `--admin` fallback (`UNTRUSTED-CI`), so if a BEHIND livelock sets in they will be asked to merge it. See [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md). **Why:** #8611.
2180
2180
 
2181
2181
  Wrap the `gh pr merge` call in the merge-main lock so parallel sessions don't queue auto-merges in the same window:
2182
2182
 
@@ -5,3 +5,5 @@ The Queue mode paragraph below was moved out of `ship/SKILL.md` Phase 7 to stay
5
5
  **Queue mode (#9710).** When `main` has a `merge_queue` rule (read once at loop entry by `.type == "merge_queue"`, never by position; this reads `main`'s rules, as the required-check read already does) and the required-check set is non-empty, AND auto-merge is armed (read each BEHIND tick), a BEHIND reading that GitHub itself reported is not a reason to push: each push restarts the whole required-check set, and the queue builds every candidate against the projected `main`, so an armed PR is made current by the queue. GitHub enqueues an armed PR whose head is behind `main` on its own (measured, ADR-270 canary addendum 2026-10-07), so the poll prints `[ship.phase7.queue_wait]` once and keeps polling (informational: take no action, and never sync, update-branch or merge it by hand until `[ship.phase7.queue_wait_expired]`, a push line, MERGED, a dequeue or any poll exit), prints `[ship.phase7.queued]` once, at the first every-5th-tick read that finds the PR in the queue (a queued reading also restarts the idle count, so while each 5th-tick read answers queued the PR does not expire), and stops on a dequeue as above. The wait is bounded two ways. More than 5 consecutive wait ticks (the 6th) with no pending REQUIRED check (a required check that does not exist yet, such as the `test` aggregate before its shards finish, counts as pending while any check is still running) print `[ship.phase7.queue_wait_expired]` and fall back to the BEHIND auto-sync for the rest of that poll (this poll's last queue read did not show the PR queued: keep the Monitor running, diagnose with the dequeue reference and the PR timeline, record the strict up-to-date question in the final report, and do not change the ruleset; the fallback `--step` itself skips a PR that is in the queue and fails closed on an unreadable queue read). `MAX_POLL_MIN` caps a PR whose required checks never settle or whose state keeps flapping (any tick that is not a wait tick restarts the idle count). Every unreadable answer falls toward today's sync (in the fence; the standalone script's rules read is the one new exception, see Standalone guard below): a failed rules read or an empty required-check set leaves queue mode off for the poll, a failed armed read ends the wait for that tick (that tick syncs as today), and a failed checks read counts as idle. A DIRTY-derived BEHIND, a repo with no queue rule and a poll with auto-sync disabled behave exactly as before. Waiting does not consume `MAX_BEHIND_SYNCS`. Accepted residuals (ADR-270 amendment 2026-10-07): some required contexts (`tenant-integration-required`, `vendor-pin-required`) post a PASS on `merge_group` without re-running their suites, so in queue mode their only real run is the PR-time one against the PR-time base (the sync used to re-run the PR-event versions on a fresher base); and a dequeue during the wait is found by a current removal event on the next 5th-tick read, because the seen-queued marker is only written by `--step`.
6
6
 
7
7
  **Standalone guard (2026-10-09, PR 9839).** `sync-pr-behind.sh <PR>` (the standalone loop) now enforces the rule above itself: when GitHub reports the PR BEHIND (not DIRTY), auto-merge is armed and the PR's base branch has a `merge_queue` rule (`main` for a main-based PR; boundary (2) covers another base; selected by `.type`, one read of up to 100 rules), it prints `kind=queue_wait rc=0` and exits 0 with nothing fetched, merged or pushed. A rules read that still fails after `PR_QUEUE_ATTEMPTS` tries (default 2, as for the queue read) or answers non-numeric is `kind=gh` (exit 4) with the cause in the line. This is the one place the script FAILS CLOSED on an unreadable rules answer: the fence above falls toward sync, but a standalone run has no poll behind it and an unknown answer is not a yes (the cost is a visible, named stop on a host whose token cannot read repository rules; for a main-based PR the sanctioned sync is then the Phase 7 poll's own sync; for another base, a hand sync against that base). The incident: an agent hand-wrote a poll loop that treated BEHIND as an error and ran the script after `gh pr merge --auto` and before the enqueue (one push landed after the arm, 12 minutes in), restarting PR CI for nothing; the old prose scoped the ban to a poll that had already emitted `[ship.phase7.queue_wait]`, a marker a hand-written loop never emits, so the executable now refuses on the facts. Boundaries, stated so they are not rediscovered: (1) `--step` and the pre-merge hook are guarded too since 2026-10-20 (#9869): see the ADR-270 addendum of that date (a flagless `--step` exits 14 `kind=queue_wait`, the fences' own call opts out, the hook asks the read-only `--queue-wait` verdict). (2) The rules read uses the PR's own base branch (`baseRefName`) since 2026-10-24; while the PR is armed and BEHIND (or UNKNOWN at the flagless step and in the read-only `--queue-wait` verdict only), a non-`main` base with no merge queue, or a base name outside the script's allowlist (`badbase`, which also refuses a git-legal name such as `rel+1` even when that base has a queue), is refused (`kind=gh`, exit 4 at the loop and the flagless step) and not synced, because the sync itself still merges `origin/main`; the pre-merge hook's `--queue-wait` answer for the same PR is `queue_wait`, which its `queue_wait` arm turns into a skip, not a sync (see the ADR-270 addendum of that date). (3) The script does not read required checks: the fence sets `QUEUE_RULE=0` on a repo with no required checks and exits on a red required check, but the script answers `queue_wait` for any armed BEHIND PR; the refusal text therefore says to push a fix for a red check and routes to the sibling reference merge-queue-dequeue.md ("Armed and green but never enqueued") instead of promising a merge. (4) A DIRTY that is only GitHub's recompute lag after `main` moved still syncs. (5) The standalone answer has no expiry: the bound is re-arming the Phase 7 poll, whose fallback sync is the sanctioned one for a main-based PR only. The text surfaces say the same thing in one phrase: "when `main` has a merge queue and the PR is armed (the Phase 7 poll prints `[ship.phase7.queue_wait]`)" — a fact, not a marker only the Phase 7 fence prints; it holds for a BEHIND reading only. Surfaces not edited because they sit in the byte-ceilinged fences or outside the armed-BEHIND class: the fence `behind_no_sync` line (its standalone call now answers `queue_wait` on an armed PR, which is correct: fix the poll precondition and re-arm), `monitor-pr-checks.sh`, and `review/SKILL.md`'s DIRTY recovery.
8
+
9
+ **Known gap (2026-11-07, #12332).** The expiry count above treats only NAMED required contexts as pending, so when the `test` aggregate is itself waiting on non-required test-scripts shards it reads "nothing pending", expires after 6 ticks and auto-syncs `main` into an armed PR, restarting CI; not fixed here.
@@ -265,6 +265,9 @@ rc=$?
265
265
  if [[ -z "${CHANGED//[[:space:]]/}" ]] && ! git merge-base --is-ancestor HEAD refs/remotes/origin/main 2>/dev/null; then
266
266
  undecidable "${OPERATOR_CI_WORDS:+operator ci-is-the-gate set but }the branch diff is empty but HEAD is not an ancestor of origin/main; cannot scope the infra check"
267
267
  fi
268
+ # INFRA_RE is deliberately NARROWER than infra-validation.yml's trigger set (#12332): it tracks what the LOCAL infra shard
269
+ # can test (apps/web-platform/infra/run-registered-suites.sh globs only apps/web-platform/infra/) plus the apply workflow;
270
+ # widening it would demand a local battery that cannot exercise the added paths. The wider trigger set is #6480's concern.
268
271
  INFRA_RE='^(apps/web-platform/infra/|\.github/workflows/apply-web-platform-infra\.yml$)'
269
272
 
270
273
  # The operator-token arm. Condition 1 no longer guarantees a clean tree, so it builds its OWN path list from four
@@ -59,7 +59,11 @@
59
59
  # gate and a deferral there would delete the only blocking one. The predicate follows
60
60
  # scripts/test-all.sh (the `_diff_names` assembly and `_infra_in_diff`): the same two triggers,
61
61
  # rename SOURCES included (`--name-status -M`), untracked files included, unanchored substring
62
- # match. It is STRICTER on failure: any git read that fails, a grep that errors, or an empty
62
+ # match. Each `git diff` read ends in --ignore-submodules=none (a gitlink hidden by config or a
63
+ # committed ignore=all is still listed; #12332). The NUL-delimited form (-z --no-renames) is
64
+ # deliberately NOT used here: the unanchored substring match is blind to C-quoting and
65
+ # `--name-status -M` already lists rename sources, so the predicate keeps following test-all.sh.
66
+ # It is STRICTER on failure: any git read that fails, a grep that errors, or an empty
63
67
  # change set is "unresolved". Git runs from the repo root with the same GIT_* variables cleared
64
68
  # as the runner. The suite pins both trigger literals against the live runner.
65
69
  #
@@ -270,16 +274,16 @@ done
270
274
  infra_state() { # echoes clean | infra | unresolved
271
275
  local top names="" out lit rc hit=0
272
276
  top="$(git rev-parse --show-toplevel 2>/dev/null)" || { echo unresolved; return 0; }
273
- out="$(git -C "$top" -c core.quotePath=false diff --name-only origin/main...HEAD 2>/dev/null)" || { echo unresolved; return 0; }
277
+ out="$(git -C "$top" -c core.quotePath=false diff --name-only origin/main...HEAD --ignore-submodules=none 2>/dev/null)" || { echo unresolved; return 0; }
274
278
  names="${names}
275
279
  ${out}"
276
- out="$(git -C "$top" -c core.quotePath=false diff --name-only HEAD 2>/dev/null)" || { echo unresolved; return 0; }
280
+ out="$(git -C "$top" -c core.quotePath=false diff --name-only HEAD --ignore-submodules=none 2>/dev/null)" || { echo unresolved; return 0; }
277
281
  names="${names}
278
282
  ${out}"
279
- out="$(git -C "$top" -c core.quotePath=false diff --name-status -M HEAD 2>/dev/null)" || { echo unresolved; return 0; }
283
+ out="$(git -C "$top" -c core.quotePath=false diff --name-status -M HEAD --ignore-submodules=none 2>/dev/null)" || { echo unresolved; return 0; }
280
284
  names="${names}
281
285
  ${out}"
282
- out="$(git -C "$top" -c core.quotePath=false diff --name-status -M origin/main...HEAD 2>/dev/null)" || { echo unresolved; return 0; }
286
+ out="$(git -C "$top" -c core.quotePath=false diff --name-status -M origin/main...HEAD --ignore-submodules=none 2>/dev/null)" || { echo unresolved; return 0; }
283
287
  names="${names}
284
288
  ${out}"
285
289
  out="$(git -C "$top" ls-files --others --exclude-standard 2>/dev/null)" || { echo unresolved; return 0; }