@futurelastic/colab-handbook 1.20.4-rc.6 → 1.20.4-rc.7

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
@@ -33,5 +33,5 @@
33
33
  "engines": {
34
34
  "node": ">=18"
35
35
  },
36
- "version": "1.20.4-rc.6"
36
+ "version": "1.20.4-rc.7"
37
37
  }
@@ -164,7 +164,14 @@ notice back and print the run they relied on. Three things to keep in a copy:
164
164
  name, edit all three. Until you do, the guard simply never fires on trunk — nothing breaks;
165
165
  but a trunk left out of `group:` and `cancel-in-progress:` has its runs cancelled.
166
166
  - **Never put a trunk-only job behind it.** Publish, deploy and release jobs must run whatever
167
- the guard says. Give them their own `if:` that does not read `needs.dedupe`.
167
+ the guard says. Give them their own `if:` that does not read `needs.dedupe` — and **name them
168
+ in the guard's `TRUNK_ONLY_JOBS`** (#717), or move them to a workflow of their own. A branch run
169
+ skips such a job, and an unlisted skip makes that run unusable on trunk (#511), so a workflow
170
+ that mixes trunk-only jobs with its suite otherwise never reuses anything.
171
+ - **A batch-landing ref gets the same tree mode** (#717): the first push of a `ship-batch/**`
172
+ ref skips the suite when a member branch already passed its exact tree. Nothing to edit.
173
+
174
+ The rule all of this keeps: [one verdict per tree](../CONVENTIONS.md#one-verdict-per-tree--quick-on-branches-full-once-719).
168
175
 
169
176
  Opt out with `tree-reuse: off` (`project.schema.md`) when trunk's run proves something a branch
170
177
  run cannot: secrets only trunk gets, `github.ref`-conditional steps, unpinned runner images.
@@ -7,7 +7,8 @@
7
7
  # HEAVY LANE (#607): the whole suite, including tests marked heavy, plus anything too slow for
8
8
  # every merge (integration, browser/e2e, load). The light lane (ci.yml) runs on every push and
9
9
  # is the only lane `colab ship` reads. This one runs:
10
- # - NIGHTLY, on trunk's tip. Skipped when trunk has not moved since the last green nightly.
10
+ # - NIGHTLY, on trunk's tip. Skipped when trunk has not moved since the last green nightly, or
11
+ # when a green dispatched run of this workflow already tested that exact sha (#719).
11
12
  # A red nightly opens one `trunk-red` issue naming the commit range that could have caused
12
13
  # it. It never blocks a merge.
13
14
  # - On every OFFICIAL BUILD: release-tag.yml calls this file and publishes only when it is
@@ -22,6 +23,8 @@
22
23
  # the Pest/PHPUnit group `heavy` (`->group('heavy')`, `#[Group('heavy')]`). The light
23
24
  # lane excludes it; this lane runs the whole suite.
24
25
  #
26
+ # One verdict per sha: never test a commit this workflow already passed (CONVENTIONS.md §7,
27
+ # "One verdict per tree").
25
28
  # Deliberately NOT triggered by push or pull_request: a run of this workflow must never count as
26
29
  # a merge verdict (tools/lib/verify-runs.js sets schedule and dispatch runs aside).
27
30
  # No concurrency block: a heavy run is never cancelled — a release may be waiting on it.
@@ -101,6 +104,20 @@ jobs:
101
104
  if [ "$since" = "$sha" ]; then
102
105
  run=false
103
106
  echo "::notice title=heavy-skipped::$TRUNK has not moved since the last green nightly ($sha)"
107
+ else
108
+ # One verdict per sha (#719): a green DISPATCHED run of this workflow already tested this
109
+ # exact commit (a gated landing, a release candidate) — the nightly does not test it again.
110
+ # `since` stays the last green NIGHTLY: the trunk-red range is read from nightlies only.
111
+ for id in $(gh api "repos/$REPO/actions/workflows/$wf/runs?event=workflow_dispatch&status=success&per_page=10" \
112
+ --jq '.workflow_runs[].id' 2>/dev/null); do
113
+ done_at="$(gh api "repos/$REPO/actions/runs/$id/jobs" \
114
+ --jq '[.jobs[] | select(.conclusion == "success" and (.name | startswith("Full suite @ "))) | .name | ltrimstr("Full suite @ ")][0] // ""' 2>/dev/null || true)"
115
+ if [ "$done_at" = "$sha" ]; then
116
+ run=false
117
+ echo "::notice title=heavy-skipped::$sha already passed this workflow in dispatched run $id"
118
+ break
119
+ fi
120
+ done
104
121
  fi
105
122
  fi
106
123
  echo "run=$run" >> "$GITHUB_OUTPUT"
@@ -127,11 +127,15 @@ jobs:
127
127
  # run whose jobs ALL skip concludes `skipped`, which `colab ship` reads as not-green.
128
128
  # - At this SHA (#418): on a ref's first push (a claim push), a green non-PR run of this
129
129
  # workflow at the same sha means the suite already ran.
130
- # - At this TREE (#493): on a push to trunk, a green push run elsewhere whose commit has the
131
- # byte-identical tree (a squash of a branch that already contained its base) is reused and
132
- # cited in a `tree-already-green` notice. `tree-reuse: off` in .github/project.yml opts out.
133
- # A run that skipped a job (a trunk-only job skips on branches) is never reused (#511), so
134
- # never put a trunk-only job (publish, deploy, release) behind this gate.
130
+ # - At this TREE (#493): on a push to trunk, and on the first push of a batch-landing ref
131
+ # (`ship-batch/**`, #717), a green push run elsewhere whose commit has the byte-identical tree
132
+ # (a squash of a branch that already contained its base) is reused and cited in a
133
+ # `tree-already-green` notice. `tree-reuse: off` in .github/project.yml opts out.
134
+ # A run that skipped a job (a trunk-only job skips on branches) is never reused (#511) — except
135
+ # a job named in TRUNK_ONLY_JOBS below, which sits outside this gate and runs on trunk anyway.
136
+ # So a trunk-only job (publish, deploy, release) never sits behind this gate: put it in a
137
+ # workflow of its own, or keep it here ungated and list it (#717).
138
+ # The rule this keeps: one CI verdict per git tree (CONVENTIONS.md §7, "One verdict per tree").
135
139
  # Any doubt — no run, red, an API error — runs the full suite; this job never fails the run.
136
140
  dedupe:
137
141
  name: Already tested at this sha or tree?
@@ -156,15 +160,23 @@ jobs:
156
160
  CREATED: ${{ github.event.created }}
157
161
  REF_NAME: ${{ github.ref_name }}
158
162
  GUARD_NAME: Already tested at this sha or tree? # EDIT: this job's `name:`, if you rename it (#511).
163
+ # EDIT (#717): the `name:` of every job here that is trunk-only (publish, deploy, release) and
164
+ # sits OUTSIDE this gate — its `if:` never reads `needs.dedupe.outputs.tested`, so it runs on
165
+ # trunk whatever this guard decides. Comma-separated, exact names as a run lists them. A cited
166
+ # branch run may have skipped these and is still reused. Never list a suite job or any job
167
+ # behind the gate: it would then be skipped on trunk twice. Empty = #511 unchanged. Simpler
168
+ # still: keep trunk-only jobs in a workflow of their own (CONVENTIONS.md §7, "One verdict per tree").
169
+ TRUNK_ONLY_JOBS: ""
159
170
  run: |
160
171
  tested=false
161
172
  cited=
162
173
  # #511: a cited run is reusable only if it skipped no job but this guard. A job gated on
163
174
  # the trunk ref is `skipped` on every branch push and a skipped job does not fail the
164
- # run, so citing that run would skip the trunk-only job on trunk a second time.
175
+ # run, so citing that run would skip the trunk-only job on trunk a second time — unless
176
+ # the job is named in TRUNK_ONLY_JOBS: it sits outside the gate and runs here anyway (#717).
165
177
  reusable() {
166
178
  if ! SK="$(gh api "repos/$REPO/actions/runs/$1/jobs?per_page=100" \
167
- --jq 'if .total_count > (.jobs | length) then "(more than 100 jobs)" else [.jobs[] | select(.conclusion == "skipped" and .name != env.GUARD_NAME) | .name] | join(", ") end' 2>/dev/null)"; then
179
+ --jq 'if .total_count > (.jobs | length) then "(more than 100 jobs)" else [.jobs[] | select(.conclusion == "skipped" and .name != env.GUARD_NAME) | .name | select(. as $n | any((env.TRUNK_ONLY_JOBS // "") | split(",")[] | gsub("^\\s+|\\s+$"; ""); . == $n) | not)] | join(", ") end' 2>/dev/null)"; then
168
180
  echo "::notice::Could not list the jobs of run $1 — running the full suite (#511)."
169
181
  return 1
170
182
  elif [ -n "$SK" ]; then
@@ -211,13 +223,16 @@ jobs:
211
223
  echo "::notice::gh is not installed on this runner — running the full suite (#418)."
212
224
  elif ! WFID="$(gh api "repos/$REPO/actions/runs/$RUN_ID" --jq .workflow_id 2>/dev/null)" || [ -z "$WFID" ]; then
213
225
  echo "::notice::Could not read this run's workflow id — running the full suite (#418)."
214
- elif [ "${CREATED:-}" = "false" ]; then
215
- # A non-creating push: trunk tree mode (#493). Every branch below but one runs the suite.
226
+ elif [ "${CREATED:-}" = "false" ] || [[ "$REF_NAME" == ship-batch/* ]]; then
227
+ # Tree mode (#493): a non-creating push to trunk, or the creating push of a batch-landing
228
+ # ref (#717), whose new sha often carries a tree a member branch already passed. Same
229
+ # checks either way; only the trunk check is the ref's own. Every branch below but one
230
+ # runs the suite.
216
231
  if ! DESC="$(gh api "repos/$REPO/contents/.github/project.yml?ref=$SHA" -H 'Accept: application/vnd.github.raw' 2>/dev/null)" || [ -z "$DESC" ]; then
217
232
  echo "::notice::Could not read .github/project.yml at $SHA — running the full suite (#493)."
218
233
  elif grep -Eq '^tree-reuse[[:space:]]*:' <<< "$DESC"; then
219
234
  echo "::notice::tree-reuse is declared in .github/project.yml — running the full suite (#493)."
220
- elif [ "$(printf '%s\n' "$DESC" | sed -nE "s/^trunk:[[:space:]]*[\"']?([A-Za-z0-9._/-]+).*/\\1/p" | head -n 1)" != "$REF_NAME" ]; then
235
+ elif [ "${CREATED:-}" = "false" ] && [ "$(printf '%s\n' "$DESC" | sed -nE "s/^trunk:[[:space:]]*[\"']?([A-Za-z0-9._/-]+).*/\\1/p" | head -n 1)" != "$REF_NAME" ]; then
221
236
  echo "::notice::$REF_NAME is not this repo's trunk — running the full suite (#493)."
222
237
  elif ! OURS="$(gh api "repos/$REPO/git/commits/$SHA" --jq .tree.sha 2>/dev/null)" || [ -z "$OURS" ]; then
223
238
  echo "::notice::Could not read the tree of $SHA — running the full suite (#493)."
@@ -7,7 +7,8 @@
7
7
  # HEAVY LANE (#607): the whole suite, including tests marked heavy, plus anything too slow for
8
8
  # every merge (integration, browser/e2e, load). The light lane (ci.yml) runs on every push and
9
9
  # is the only lane `colab ship` reads. This one runs:
10
- # - NIGHTLY, on trunk's tip. Skipped when trunk has not moved since the last green nightly.
10
+ # - NIGHTLY, on trunk's tip. Skipped when trunk has not moved since the last green nightly, or
11
+ # when a green dispatched run of this workflow already tested that exact sha (#719).
11
12
  # A red nightly opens one `trunk-red` issue naming the commit range that could have caused
12
13
  # it. It never blocks a merge.
13
14
  # - On every OFFICIAL BUILD: release-tag.yml calls this file and publishes only when it is
@@ -22,6 +23,8 @@
22
23
  # a `test:heavy` script in package.json (e.g. over `*.heavy.test.*` files). `npm test`
23
24
  # stays light; this lane runs both.
24
25
  #
26
+ # One verdict per sha: never test a commit this workflow already passed (CONVENTIONS.md §7,
27
+ # "One verdict per tree").
25
28
  # Deliberately NOT triggered by push or pull_request: a run of this workflow must never count as
26
29
  # a merge verdict (tools/lib/verify-runs.js sets schedule and dispatch runs aside).
27
30
  # No concurrency block: a heavy run is never cancelled — a release may be waiting on it.
@@ -98,6 +101,20 @@ jobs:
98
101
  if [ "$since" = "$sha" ]; then
99
102
  run=false
100
103
  echo "::notice title=heavy-skipped::$TRUNK has not moved since the last green nightly ($sha)"
104
+ else
105
+ # One verdict per sha (#719): a green DISPATCHED run of this workflow already tested this
106
+ # exact commit (a gated landing, a release candidate) — the nightly does not test it again.
107
+ # `since` stays the last green NIGHTLY: the trunk-red range is read from nightlies only.
108
+ for id in $(gh api "repos/$REPO/actions/workflows/$wf/runs?event=workflow_dispatch&status=success&per_page=10" \
109
+ --jq '.workflow_runs[].id' 2>/dev/null); do
110
+ done_at="$(gh api "repos/$REPO/actions/runs/$id/jobs" \
111
+ --jq '[.jobs[] | select(.conclusion == "success" and (.name | startswith("Full suite @ "))) | .name | ltrimstr("Full suite @ ")][0] // ""' 2>/dev/null || true)"
112
+ if [ "$done_at" = "$sha" ]; then
113
+ run=false
114
+ echo "::notice title=heavy-skipped::$sha already passed this workflow in dispatched run $id"
115
+ break
116
+ fi
117
+ done
101
118
  fi
102
119
  fi
103
120
  echo "run=$run" >> "$GITHUB_OUTPUT"
@@ -112,11 +112,15 @@ jobs:
112
112
  # run whose jobs ALL skip concludes `skipped`, which `colab ship` reads as not-green.
113
113
  # - At this SHA (#418): on a ref's first push (a claim push), a green non-PR run of this
114
114
  # workflow at the same sha means the suite already ran.
115
- # - At this TREE (#493): on a push to trunk, a green push run elsewhere whose commit has the
116
- # byte-identical tree (a squash of a branch that already contained its base) is reused and
117
- # cited in a `tree-already-green` notice. `tree-reuse: off` in .github/project.yml opts out.
118
- # A run that skipped a job (a trunk-only job skips on branches) is never reused (#511), so
119
- # never put a trunk-only job (publish, deploy, release) behind this gate.
115
+ # - At this TREE (#493): on a push to trunk, and on the first push of a batch-landing ref
116
+ # (`ship-batch/**`, #717), a green push run elsewhere whose commit has the byte-identical tree
117
+ # (a squash of a branch that already contained its base) is reused and cited in a
118
+ # `tree-already-green` notice. `tree-reuse: off` in .github/project.yml opts out.
119
+ # A run that skipped a job (a trunk-only job skips on branches) is never reused (#511) — except
120
+ # a job named in TRUNK_ONLY_JOBS below, which sits outside this gate and runs on trunk anyway.
121
+ # So a trunk-only job (publish, deploy, release) never sits behind this gate: put it in a
122
+ # workflow of its own, or keep it here ungated and list it (#717).
123
+ # The rule this keeps: one CI verdict per git tree (CONVENTIONS.md §7, "One verdict per tree").
120
124
  # Any doubt — no run, red, an API error — runs the full suite; this job never fails the run.
121
125
  dedupe:
122
126
  name: Already tested at this sha or tree?
@@ -141,15 +145,23 @@ jobs:
141
145
  CREATED: ${{ github.event.created }}
142
146
  REF_NAME: ${{ github.ref_name }}
143
147
  GUARD_NAME: Already tested at this sha or tree? # EDIT: this job's `name:`, if you rename it (#511).
148
+ # EDIT (#717): the `name:` of every job here that is trunk-only (publish, deploy, release) and
149
+ # sits OUTSIDE this gate — its `if:` never reads `needs.dedupe.outputs.tested`, so it runs on
150
+ # trunk whatever this guard decides. Comma-separated, exact names as a run lists them. A cited
151
+ # branch run may have skipped these and is still reused. Never list a suite job or any job
152
+ # behind the gate: it would then be skipped on trunk twice. Empty = #511 unchanged. Simpler
153
+ # still: keep trunk-only jobs in a workflow of their own (CONVENTIONS.md §7, "One verdict per tree").
154
+ TRUNK_ONLY_JOBS: ""
144
155
  run: |
145
156
  tested=false
146
157
  cited=
147
158
  # #511: a cited run is reusable only if it skipped no job but this guard. A job gated on
148
159
  # the trunk ref is `skipped` on every branch push and a skipped job does not fail the
149
- # run, so citing that run would skip the trunk-only job on trunk a second time.
160
+ # run, so citing that run would skip the trunk-only job on trunk a second time — unless
161
+ # the job is named in TRUNK_ONLY_JOBS: it sits outside the gate and runs here anyway (#717).
150
162
  reusable() {
151
163
  if ! SK="$(gh api "repos/$REPO/actions/runs/$1/jobs?per_page=100" \
152
- --jq 'if .total_count > (.jobs | length) then "(more than 100 jobs)" else [.jobs[] | select(.conclusion == "skipped" and .name != env.GUARD_NAME) | .name] | join(", ") end' 2>/dev/null)"; then
164
+ --jq 'if .total_count > (.jobs | length) then "(more than 100 jobs)" else [.jobs[] | select(.conclusion == "skipped" and .name != env.GUARD_NAME) | .name | select(. as $n | any((env.TRUNK_ONLY_JOBS // "") | split(",")[] | gsub("^\\s+|\\s+$"; ""); . == $n) | not)] | join(", ") end' 2>/dev/null)"; then
153
165
  echo "::notice::Could not list the jobs of run $1 — running the full suite (#511)."
154
166
  return 1
155
167
  elif [ -n "$SK" ]; then
@@ -196,13 +208,16 @@ jobs:
196
208
  echo "::notice::gh is not installed on this runner — running the full suite (#418)."
197
209
  elif ! WFID="$(gh api "repos/$REPO/actions/runs/$RUN_ID" --jq .workflow_id 2>/dev/null)" || [ -z "$WFID" ]; then
198
210
  echo "::notice::Could not read this run's workflow id — running the full suite (#418)."
199
- elif [ "${CREATED:-}" = "false" ]; then
200
- # A non-creating push: trunk tree mode (#493). Every branch below but one runs the suite.
211
+ elif [ "${CREATED:-}" = "false" ] || [[ "$REF_NAME" == ship-batch/* ]]; then
212
+ # Tree mode (#493): a non-creating push to trunk, or the creating push of a batch-landing
213
+ # ref (#717), whose new sha often carries a tree a member branch already passed. Same
214
+ # checks either way; only the trunk check is the ref's own. Every branch below but one
215
+ # runs the suite.
201
216
  if ! DESC="$(gh api "repos/$REPO/contents/.github/project.yml?ref=$SHA" -H 'Accept: application/vnd.github.raw' 2>/dev/null)" || [ -z "$DESC" ]; then
202
217
  echo "::notice::Could not read .github/project.yml at $SHA — running the full suite (#493)."
203
218
  elif grep -Eq '^tree-reuse[[:space:]]*:' <<< "$DESC"; then
204
219
  echo "::notice::tree-reuse is declared in .github/project.yml — running the full suite (#493)."
205
- elif [ "$(printf '%s\n' "$DESC" | sed -nE "s/^trunk:[[:space:]]*[\"']?([A-Za-z0-9._/-]+).*/\\1/p" | head -n 1)" != "$REF_NAME" ]; then
220
+ elif [ "${CREATED:-}" = "false" ] && [ "$(printf '%s\n' "$DESC" | sed -nE "s/^trunk:[[:space:]]*[\"']?([A-Za-z0-9._/-]+).*/\\1/p" | head -n 1)" != "$REF_NAME" ]; then
206
221
  echo "::notice::$REF_NAME is not this repo's trunk — running the full suite (#493)."
207
222
  elif ! OURS="$(gh api "repos/$REPO/git/commits/$SHA" --jq .tree.sha 2>/dev/null)" || [ -z "$OURS" ]; then
208
223
  echo "::notice::Could not read the tree of $SHA — running the full suite (#493)."
@@ -7,7 +7,8 @@
7
7
  # HEAVY LANE (#607): the whole suite, including tests marked heavy, plus anything too slow for
8
8
  # every merge (integration, browser/e2e, load). The light lane (ci.yml) runs on every push and
9
9
  # is the only lane `colab ship` reads. This one runs:
10
- # - NIGHTLY, on trunk's tip. Skipped when trunk has not moved since the last green nightly.
10
+ # - NIGHTLY, on trunk's tip. Skipped when trunk has not moved since the last green nightly, or
11
+ # when a green dispatched run of this workflow already tested that exact sha (#719).
11
12
  # A red nightly opens one `trunk-red` issue naming the commit range that could have caused
12
13
  # it. It never blocks a merge.
13
14
  # - On every OFFICIAL BUILD: release-tag.yml calls this file and publishes only when it is
@@ -22,6 +23,8 @@
22
23
  # the pytest marker `heavy` (`@pytest.mark.heavy`, registered in pytest.ini or
23
24
  # pyproject.toml). The light lane deselects it; this lane runs everything.
24
25
  #
26
+ # One verdict per sha: never test a commit this workflow already passed (CONVENTIONS.md §7,
27
+ # "One verdict per tree").
25
28
  # Deliberately NOT triggered by push or pull_request: a run of this workflow must never count as
26
29
  # a merge verdict (tools/lib/verify-runs.js sets schedule and dispatch runs aside).
27
30
  # No concurrency block: a heavy run is never cancelled — a release may be waiting on it.
@@ -100,6 +103,20 @@ jobs:
100
103
  if [ "$since" = "$sha" ]; then
101
104
  run=false
102
105
  echo "::notice title=heavy-skipped::$TRUNK has not moved since the last green nightly ($sha)"
106
+ else
107
+ # One verdict per sha (#719): a green DISPATCHED run of this workflow already tested this
108
+ # exact commit (a gated landing, a release candidate) — the nightly does not test it again.
109
+ # `since` stays the last green NIGHTLY: the trunk-red range is read from nightlies only.
110
+ for id in $(gh api "repos/$REPO/actions/workflows/$wf/runs?event=workflow_dispatch&status=success&per_page=10" \
111
+ --jq '.workflow_runs[].id' 2>/dev/null); do
112
+ done_at="$(gh api "repos/$REPO/actions/runs/$id/jobs" \
113
+ --jq '[.jobs[] | select(.conclusion == "success" and (.name | startswith("Full suite @ "))) | .name | ltrimstr("Full suite @ ")][0] // ""' 2>/dev/null || true)"
114
+ if [ "$done_at" = "$sha" ]; then
115
+ run=false
116
+ echo "::notice title=heavy-skipped::$sha already passed this workflow in dispatched run $id"
117
+ break
118
+ fi
119
+ done
103
120
  fi
104
121
  fi
105
122
  echo "run=$run" >> "$GITHUB_OUTPUT"
@@ -123,11 +123,15 @@ jobs:
123
123
  # run whose jobs ALL skip concludes `skipped`, which `colab ship` reads as not-green.
124
124
  # - At this SHA (#418): on a ref's first push (a claim push), a green non-PR run of this
125
125
  # workflow at the same sha means the suite already ran.
126
- # - At this TREE (#493): on a push to trunk, a green push run elsewhere whose commit has the
127
- # byte-identical tree (a squash of a branch that already contained its base) is reused and
128
- # cited in a `tree-already-green` notice. `tree-reuse: off` in .github/project.yml opts out.
129
- # A run that skipped a job (a trunk-only job skips on branches) is never reused (#511), so
130
- # never put a trunk-only job (publish, deploy, release) behind this gate.
126
+ # - At this TREE (#493): on a push to trunk, and on the first push of a batch-landing ref
127
+ # (`ship-batch/**`, #717), a green push run elsewhere whose commit has the byte-identical tree
128
+ # (a squash of a branch that already contained its base) is reused and cited in a
129
+ # `tree-already-green` notice. `tree-reuse: off` in .github/project.yml opts out.
130
+ # A run that skipped a job (a trunk-only job skips on branches) is never reused (#511) — except
131
+ # a job named in TRUNK_ONLY_JOBS below, which sits outside this gate and runs on trunk anyway.
132
+ # So a trunk-only job (publish, deploy, release) never sits behind this gate: put it in a
133
+ # workflow of its own, or keep it here ungated and list it (#717).
134
+ # The rule this keeps: one CI verdict per git tree (CONVENTIONS.md §7, "One verdict per tree").
131
135
  # Any doubt — no run, red, an API error — runs the full suite; this job never fails the run.
132
136
  dedupe:
133
137
  name: Already tested at this sha or tree?
@@ -152,15 +156,23 @@ jobs:
152
156
  CREATED: ${{ github.event.created }}
153
157
  REF_NAME: ${{ github.ref_name }}
154
158
  GUARD_NAME: Already tested at this sha or tree? # EDIT: this job's `name:`, if you rename it (#511).
159
+ # EDIT (#717): the `name:` of every job here that is trunk-only (publish, deploy, release) and
160
+ # sits OUTSIDE this gate — its `if:` never reads `needs.dedupe.outputs.tested`, so it runs on
161
+ # trunk whatever this guard decides. Comma-separated, exact names as a run lists them. A cited
162
+ # branch run may have skipped these and is still reused. Never list a suite job or any job
163
+ # behind the gate: it would then be skipped on trunk twice. Empty = #511 unchanged. Simpler
164
+ # still: keep trunk-only jobs in a workflow of their own (CONVENTIONS.md §7, "One verdict per tree").
165
+ TRUNK_ONLY_JOBS: ""
155
166
  run: |
156
167
  tested=false
157
168
  cited=
158
169
  # #511: a cited run is reusable only if it skipped no job but this guard. A job gated on
159
170
  # the trunk ref is `skipped` on every branch push and a skipped job does not fail the
160
- # run, so citing that run would skip the trunk-only job on trunk a second time.
171
+ # run, so citing that run would skip the trunk-only job on trunk a second time — unless
172
+ # the job is named in TRUNK_ONLY_JOBS: it sits outside the gate and runs here anyway (#717).
161
173
  reusable() {
162
174
  if ! SK="$(gh api "repos/$REPO/actions/runs/$1/jobs?per_page=100" \
163
- --jq 'if .total_count > (.jobs | length) then "(more than 100 jobs)" else [.jobs[] | select(.conclusion == "skipped" and .name != env.GUARD_NAME) | .name] | join(", ") end' 2>/dev/null)"; then
175
+ --jq 'if .total_count > (.jobs | length) then "(more than 100 jobs)" else [.jobs[] | select(.conclusion == "skipped" and .name != env.GUARD_NAME) | .name | select(. as $n | any((env.TRUNK_ONLY_JOBS // "") | split(",")[] | gsub("^\\s+|\\s+$"; ""); . == $n) | not)] | join(", ") end' 2>/dev/null)"; then
164
176
  echo "::notice::Could not list the jobs of run $1 — running the full suite (#511)."
165
177
  return 1
166
178
  elif [ -n "$SK" ]; then
@@ -207,13 +219,16 @@ jobs:
207
219
  echo "::notice::gh is not installed on this runner — running the full suite (#418)."
208
220
  elif ! WFID="$(gh api "repos/$REPO/actions/runs/$RUN_ID" --jq .workflow_id 2>/dev/null)" || [ -z "$WFID" ]; then
209
221
  echo "::notice::Could not read this run's workflow id — running the full suite (#418)."
210
- elif [ "${CREATED:-}" = "false" ]; then
211
- # A non-creating push: trunk tree mode (#493). Every branch below but one runs the suite.
222
+ elif [ "${CREATED:-}" = "false" ] || [[ "$REF_NAME" == ship-batch/* ]]; then
223
+ # Tree mode (#493): a non-creating push to trunk, or the creating push of a batch-landing
224
+ # ref (#717), whose new sha often carries a tree a member branch already passed. Same
225
+ # checks either way; only the trunk check is the ref's own. Every branch below but one
226
+ # runs the suite.
212
227
  if ! DESC="$(gh api "repos/$REPO/contents/.github/project.yml?ref=$SHA" -H 'Accept: application/vnd.github.raw' 2>/dev/null)" || [ -z "$DESC" ]; then
213
228
  echo "::notice::Could not read .github/project.yml at $SHA — running the full suite (#493)."
214
229
  elif grep -Eq '^tree-reuse[[:space:]]*:' <<< "$DESC"; then
215
230
  echo "::notice::tree-reuse is declared in .github/project.yml — running the full suite (#493)."
216
- elif [ "$(printf '%s\n' "$DESC" | sed -nE "s/^trunk:[[:space:]]*[\"']?([A-Za-z0-9._/-]+).*/\\1/p" | head -n 1)" != "$REF_NAME" ]; then
231
+ elif [ "${CREATED:-}" = "false" ] && [ "$(printf '%s\n' "$DESC" | sed -nE "s/^trunk:[[:space:]]*[\"']?([A-Za-z0-9._/-]+).*/\\1/p" | head -n 1)" != "$REF_NAME" ]; then
217
232
  echo "::notice::$REF_NAME is not this repo's trunk — running the full suite (#493)."
218
233
  elif ! OURS="$(gh api "repos/$REPO/git/commits/$SHA" --jq .tree.sha 2>/dev/null)" || [ -z "$OURS" ]; then
219
234
  echo "::notice::Could not read the tree of $SHA — running the full suite (#493)."