Skip to content

Commit b10f77d

Browse files
radroidclaude
authored andcommitted
fix(coil): compute the build-counter offset in bash, not in an expression (#71)
GitHub's expression syntax has NO arithmetic operators — the documented list stops at comparison and logic — so `${{ github.run_number + 100 }}` did not evaluate to 101, it failed to parse and took the whole workflow file down with it. The symptom is deliberately unhelpful: a run appears against the push, contains no jobs, and reports only "this run likely failed because of a workflow file issue". YAML parsers accept it, so nothing local catches it. The offset moves into the run block, where the step already has a shell. The step now also asserts the resolved counter is above 26, the last pre-rename published build, because the failure this offset exists to prevent — every installed client skipping forever — is silent, and an offset that silently resolved to 0 or empty would reproduce it exactly. Caught by CI on the first push of this branch. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent af7d90b commit b10f77d

2 files changed

Lines changed: 33 additions & 4 deletions

File tree

‎.github/workflows/coil-release.yml‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,31 @@ jobs:
9494
# 100 clears both the old high-water marks: 32 (the last run under the previous filename)
9595
# and 26 (the last published build). The first coil build is 101. Renaming this file
9696
# again would need a fresh offset above whatever is published by then.
97-
BUILD_COUNTER: ${{ github.run_number + 100 }}
97+
#
98+
# The addition happens in bash below, NOT here. GitHub's expression syntax has no
99+
# arithmetic operators at all — its operator list stops at comparison and logic — so
100+
# `${{ github.run_number + 100 }}` is not a wrong answer, it is a parse failure that
101+
# takes the whole file down: the run is created, no jobs exist, and the only diagnostic
102+
# is "this run likely failed because of a workflow file issue".
103+
BUILD_COUNTER_OFFSET: 100
104+
RUN_NUMBER: ${{ github.run_number }}
98105
run: |
99106
set -euo pipefail
100107
if [[ ! "$BUILD_SHA" =~ ^[0-9a-f]{40}$ ]]; then
101108
echo "::error::BUILD_SHA is not a 40-character commit sha." >&2
102109
exit 1
103110
fi
104111
112+
# See BUILD_COUNTER_OFFSET above for why this addition exists and why it is here rather
113+
# than in the expression. Asserted, not assumed: a counter that silently came out as 0 or
114+
# empty would publish a build every installed client treats as older than what it has.
115+
BUILD_COUNTER=$((RUN_NUMBER + BUILD_COUNTER_OFFSET))
116+
if [[ ! "$BUILD_COUNTER" =~ ^[0-9]+$ ]] || (( BUILD_COUNTER <= 26 )); then
117+
echo "::error::BUILD_COUNTER resolved to '$BUILD_COUNTER', which is not above the last" \
118+
"pre-rename published build (26). Clients would skip this release forever." >&2
119+
exit 1
120+
fi
121+
105122
sha="$(git rev-parse HEAD)"
106123
if [[ "$sha" != "$BUILD_SHA" ]]; then
107124
echo "::error::Checked out $sha but expected $BUILD_SHA." >&2

‎docs/superpowers/specs/2026-08-12-coil-rename-design.md‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,27 @@ Issue #71 names this hazard but attributes it to the _version string_, and concl
6363
change is safe because the updater never compares versions. Both halves of that are true and
6464
neither is the risk. The risk is the filename.
6565

66-
**Resolution.** Rename the file and offset the counter:
66+
**Resolution.** Rename the file and offset the counter, doing the addition in bash:
6767

6868
```yaml
69-
BUILD_COUNTER: ${{ github.run_number + 100 }}
69+
env:
70+
BUILD_COUNTER_OFFSET: 100
71+
RUN_NUMBER: ${{ github.run_number }}
72+
run: |
73+
BUILD_COUNTER=$((RUN_NUMBER + BUILD_COUNTER_OFFSET))
7074
```
7175
76+
Not in the expression. **GitHub's expression syntax has no arithmetic operators** — the operator
77+
list stops at comparison and logic — so `${{ github.run_number + 100 }}` is not a wrong value, it
78+
is a parse failure that takes the entire file down. The run appears, contains no jobs, and the only
79+
diagnostic offered is "this run likely failed because of a workflow file issue". Caught by CI on
80+
the first push of this branch, which is the only reason it is written down here rather than
81+
discovered on a release.
82+
7283
100 clears both the current run (32) and the published high-water mark (26) with room that no
7384
plausible backfill closes. The first coil build is 101. The offset is permanent and load-bearing —
74-
removing it later re-creates the same failure — so it carries a comment saying so.
85+
removing it later re-creates the same failure — so it carries a comment saying so, and the step
86+
asserts the resolved counter is above 26 rather than trusting the arithmetic.
7587

7688
Two smaller consequences of the same rename:
7789

0 commit comments

Comments
 (0)