Skip to content

Commit 1c3bc82

Browse files
objectstack-devclaude
andcommitted
ci: hourly Spec Shape Gate on main -- objectui main compiled against the spec built from the commit, read by the release gate, red attributed to the changing lane
Ruling B (comment 6145029395): the spec shape gate moves from objectui to objectstack. A new scheduled workflow clones objectui at main, injects the spec built and packed from this commit into its pnpm virtual store, runs objectui's type check, and reports which objectui file fails against which objectstack commit. An intentional retirement registered in scripts/ci/spec-shape-retirements.json reads as known instead of red; a new break is attributed to the objectstack commits since the last green run and the domain lane of the card each pull fixes. scheduled-full-run.mjs registers the workflow in RELEASE_GATE_WORKFLOWS so the publish lane reads it. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013zGKMG1cRedVzWtqGGGZW9
1 parent b4d573a commit 1c3bc82

5 files changed

Lines changed: 2050 additions & 14 deletions

File tree

Lines changed: 303 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,303 @@
1+
name: Spec Shape Gate
2+
3+
# Compile the downstream consumer -- objectstack-ai/objectui at `main` -- against
4+
# `@objectstack/spec` built from THIS commit, and name the objectui file, the
5+
# objectstack commit and the owning lane when it does not compile.
6+
#
7+
# ## The ruling this executes
8+
#
9+
# Ruling B on the decision card for the spec shape gate (#23238, comment
10+
# 6145029395, batch 336 item 3, 2026-10-13): the gate MOVES to objectstack --
11+
# hourly on `main` with the two-speed full battery, read by the release gate,
12+
# a red attributed to the lane that moved the shape; objectui drops its copy
13+
# once two consecutive hourly runs here agree with objectui's. The MECHANISM of
14+
# ruling C on #19011 (consumer compilation as the ONE shape gate for the spec's
15+
# public surface) is kept unchanged; what moved is where it runs and who owns a
16+
# red. ⛔ Neither direction is re-adjudicated here.
17+
#
18+
# The objectui half -- `.github/workflows/spec-main-shape-gate.yml` there, its
19+
# script `scripts/spec-main-shape-gate.mjs` and its three pins -- is the
20+
# objectui `domain:devx` lane's card, filed once two consecutive hourly runs of
21+
# THIS workflow agree with objectui's hourly run; both run in parallel until
22+
# then. This file is the objectstack port of that workflow with the direction
23+
# reversed: the spec is built from the checkout the run is in, the CLONE is the
24+
# downstream, and there is no artifact reuse -- the spec is always the one from
25+
# the tree under test.
26+
#
27+
# ## Its place in the two speeds (#22998)
28+
#
29+
# `schedule`, hourly on `main`, is this gate's place in the FULL BATTERY. A PR
30+
# or queue build carries the fast set; this job never runs on an ordinary pull
31+
# request (two-speed rule 1) and is NOT subscribed to `merge_group`. The one
32+
# `pull_request` trigger below is path-filtered to this gate's own three files,
33+
# so a change to the gate -- the workflow, the script, or a REGISTRATION in
34+
# the retirement registry -- is exercised before it merges and proves on its
35+
# own pull request that the registered diagnosis reads `known`; no other pull
36+
# request pays the roughly thirteen minutes of a downstream compile.
37+
#
38+
# `scripts/ci/scheduled-full-run.mjs --release-gate` reads this workflow's
39+
# newest `schedule` run at or before the version commit, beside `CI`'s and
40+
# `Lint & Type Check`'s, and the publish lane refuses unless all conclude
41+
# `success` (`RELEASE_GATE_WORKFLOWS` there is the registration). A run whose
42+
# every diagnostic is a registered retirement concludes `success`.
43+
#
44+
# ## Who owns a red
45+
#
46+
# ⭐ A red on the hourly run is a MAIN-RED under #22998 rule 3: it is the FIRST
47+
# WORK of the lane the report names. The report step attributes it to the
48+
# objectstack commits since this workflow's last green run on `main`, the pull
49+
# request each landed in, and the `domain:*` lane of the card that pull fixes;
50+
# a lane it cannot read is written `unattributed` -- a reading this gate could
51+
# not take, never a lane with no owner. An INTENTIONAL retirement is not a red
52+
# for long: the accepting seat files the downstream card and registers the
53+
# retirement in `scripts/ci/spec-shape-retirements.json` in the same act
54+
# (cross-repo rule 3), and the next run reads the matching diagnostics as
55+
# `known (registered: <card>)` and does not red. ⛔ The registry is one line per
56+
# retirement with a per-diagnostic pattern; it is not, and must never become,
57+
# an ignore-all switch -- `scripts/ci/spec-shape-gate.mjs` (THE REGISTRY)
58+
# refuses an entry that would be one.
59+
#
60+
# ⭐ WHAT A RED MUST SAY is the acceptance criterion, not decoration: which
61+
# objectui file fails against which objectstack commit, so that the objectstack
62+
# pull request which moved the shape is the one that answers. The script owns
63+
# that half -- it attributes every diagnostic to a repo-relative objectui path
64+
# paired with the objectstack sha, in the run summary and in annotations -- and
65+
# it refuses (exit 2, loudly) to report an unattributable failure as a shape
66+
# break or as a pass.
67+
#
68+
# ## Why the clone is objectui `main`, not the pin
69+
#
70+
# The question this gate asks is "does TODAY'S downstream compile against this
71+
# commit". `.objectui-sha` is the release artifact's pin and stays the Console
72+
# Pin Gate's question (ci.yml `console-pin`); the two gates are not the same
73+
# question and neither replaces the other.
74+
#
75+
# ## ⛔ The turbo cache is a FALSE GREEN here
76+
#
77+
# `turbo`'s hash covers objectui's sources, lockfile and a declared env list,
78+
# not the CONTENT of `node_modules`, which is the only thing this job changes,
79+
# so a cached `type-check` could replay a verdict taken against the PUBLISHED
80+
# spec. The typecheck runs with `TURBO_FORCE=true` and no turbo cache action.
81+
# `--continue` is part of the READING: without it turbo stops scheduling at the
82+
# first failed task and the log holds one package's diagnostics instead of
83+
# every package's.
84+
#
85+
# ## Two runner details that change what a reader sees
86+
#
87+
# `actions/setup-node` registers a `tsc` problem matcher; left on, the runner
88+
# parses the echoed typecheck log and mints a second annotation per diagnostic
89+
# with a path that does not resolve in this repository (measured on objectui's
90+
# own runs: ten extra annotations re-homed onto `.github`). The compile step
91+
# removes that matcher before echoing the log, so the only annotations are the
92+
# report's, each naming the objectui path and the objectstack sha in its title.
93+
# The exit code of the compile is captured with NO PIPE in between.
94+
#
95+
# The downstream's install runs its lifecycle scripts, as any consumer compile
96+
# must; the token this job holds is read-only (`permissions` below) and nothing
97+
# here writes through it.
98+
99+
on:
100+
# The full battery's hourly run on `main`. Off the hour on purpose -- ci.yml
101+
# and lint.yml take `:00`, and scheduled workflows queue behind everyone's
102+
# `:00` cron -- and on a minute no sibling here uses.
103+
schedule:
104+
- cron: '52 * * * *'
105+
# The same reading on demand: an operator who has just registered a
106+
# retirement or landed a fix should not wait an hour to see it answered.
107+
workflow_dispatch: {}
108+
# This gate's own files only. See "Its place in the two speeds" above.
109+
pull_request:
110+
paths:
111+
- '.github/workflows/spec-shape-gate.yml'
112+
- 'scripts/ci/spec-shape-gate.mjs'
113+
- 'scripts/ci/spec-shape-retirements.json'
114+
115+
# Least privilege, all reads: `contents` for the two checkouts, `actions` for
116+
# the report's lookup of this workflow's own earlier runs (the last green),
117+
# `pull-requests` and `issues` for the lane attribution (a pull's labels and
118+
# body, a card's labels). Nothing writes through the token.
119+
permissions:
120+
contents: read
121+
actions: read
122+
pull-requests: read
123+
issues: read
124+
125+
# `github.event_name` is in the key on purpose: a `schedule` run and a
126+
# `workflow_dispatch` run on `main` carry the same `github.ref`, and neither
127+
# may cancel the other -- the hourly run is the reading the release gate waits
128+
# on, so a cancellation there is a missing reading rather than a saved minute.
129+
# Superseded pull-request runs are cancelled; runs on `main` never are.
130+
concurrency:
131+
group: spec-shape-gate-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
132+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
133+
134+
jobs:
135+
shape-gate:
136+
name: Spec Shape Gate
137+
runs-on: ubuntu-latest
138+
# Sized against objectui's measured runs (about thirteen minutes, of which
139+
# the forced, uncached downstream build + typecheck is eleven) with room
140+
# for a cold runner; a ceiling this job can reach turns a verdict into
141+
# `cancelled`, which reports nothing a reader can act on.
142+
timeout-minutes: 45
143+
144+
steps:
145+
- name: Checkout objectstack (the commit under test)
146+
uses: actions/checkout@v7
147+
148+
# The downstream, at `main`, inside the workspace (actions/checkout
149+
# refuses a path outside it). objectstack's workspace globs are rooted at
150+
# `packages/`, `apps/` and `examples/`, so nothing under `objectui/` is
151+
# swept into this repository's install, and pnpm run inside `objectui/`
152+
# finds objectui's own `pnpm-workspace.yaml` first.
153+
- name: Checkout objectui main (the downstream under test)
154+
uses: actions/checkout@v7
155+
with:
156+
repository: objectstack-ai/objectui
157+
ref: main
158+
path: objectui
159+
fetch-depth: 1
160+
161+
# Resolved ONCE, into outputs every later step and the report quote, so
162+
# the sha in the summary is provably the sha that was built.
163+
- name: Resolve the two commits under test
164+
id: subjects
165+
run: |
166+
set -euo pipefail
167+
upstream=$(git rev-parse HEAD)
168+
downstream=$(git -C objectui rev-parse HEAD)
169+
subject=$(git log -1 --format=%s HEAD)
170+
committed=$(git log -1 --format=%cI HEAD)
171+
echo "upstream=$upstream" >> "$GITHUB_OUTPUT"
172+
echo "downstream=$downstream" >> "$GITHUB_OUTPUT"
173+
echo "commit=${upstream:0:12} -- $committed -- $subject" >> "$GITHUB_OUTPUT"
174+
echo "objectstack@$upstream ($committed) against objectui@$downstream"
175+
176+
- name: Setup Node.js
177+
uses: actions/setup-node@v7
178+
with:
179+
node-version: '22'
180+
181+
- name: Setup pnpm
182+
uses: ./.github/actions/setup-pnpm
183+
184+
- name: Get pnpm store directory
185+
shell: bash
186+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
187+
188+
# One store for both installs (same pnpm, same store path), keyed on both
189+
# lockfiles. Restore here; the save below runs only on `main` runs, so an
190+
# hourly run seeds the next hour and a pull-request run spends nothing
191+
# from the cache pool. ci.yml's store entries are the cold fallback.
192+
- name: Restore the pnpm store
193+
id: store
194+
uses: actions/cache/restore@v6
195+
with:
196+
path: ${{ env.STORE_PATH }}
197+
key: ${{ runner.os }}-spec-shape-gate-pnpm-store-${{ hashFiles('pnpm-lock.yaml', 'objectui/pnpm-lock.yaml') }}
198+
restore-keys: |
199+
${{ runner.os }}-spec-shape-gate-pnpm-store-
200+
${{ runner.os }}-pnpm-store-v3-
201+
202+
# "A change to the gate runs the gate's self-test": offline, no install.
203+
- name: Self-test the gate script
204+
run: pnpm check:spec-shape-gate
205+
206+
# ── Build the spec from THIS commit, and PACK it ──────────────────────
207+
# `--filter @objectstack/spec...` installs the spec and its dependencies
208+
# only; `inject` later reads the dependencies this install resolved
209+
# (`packages/spec/node_modules`) to re-point a store sibling the packed
210+
# manifest's range refuses.
211+
- name: Install the spec's dependency closure
212+
run: pnpm install --frozen-lockfile --filter @objectstack/spec...
213+
214+
- name: Build @objectstack/spec from this commit
215+
run: pnpm --filter @objectstack/spec build
216+
217+
# What gets injected is what a RELEASE from this commit would ship -- the
218+
# `files` field's file set, not a working tree. `--ignore-scripts`
219+
# because the build above already ran.
220+
- name: Pack the built spec (the file set a release from this commit would ship)
221+
id: pack
222+
working-directory: packages/spec
223+
run: |
224+
set -euo pipefail
225+
mkdir -p "$RUNNER_TEMP/spec-built"
226+
packed=$(npm pack --ignore-scripts --pack-destination "$RUNNER_TEMP/spec-built" | tail -n 1)
227+
echo "tarball=$RUNNER_TEMP/spec-built/$packed" >> "$GITHUB_OUTPUT"
228+
ls -l "$RUNNER_TEMP/spec-built/$packed"
229+
230+
# ── The downstream's install ─────────────────────────────────────────
231+
# Corepack reads the nearest `packageManager` pin, so pnpm invoked inside
232+
# `objectui/` is objectui's pinned version (downloaded here, once, when
233+
# it differs from this repository's). A named step so a toolchain
234+
# download that fails is answerable from the checks list alone.
235+
- name: Materialise objectui's pinned pnpm
236+
working-directory: objectui
237+
run: pnpm --version
238+
239+
- name: Install objectui dependencies
240+
working-directory: objectui
241+
run: pnpm install --frozen-lockfile
242+
243+
- name: Save the pnpm store
244+
if: github.event_name != 'pull_request' && steps.store.outputs.cache-hit != 'true'
245+
uses: actions/cache/save@v6
246+
with:
247+
path: ${{ env.STORE_PATH }}
248+
key: ${{ runner.os }}-spec-shape-gate-pnpm-store-${{ hashFiles('pnpm-lock.yaml', 'objectui/pnpm-lock.yaml') }}
249+
250+
# Replaces the installed spec in objectui's pnpm virtual store -- REMOVE
251+
# then copy, because those files are hardlinks into the global store --
252+
# re-points a store sibling the packed manifest's range refuses at the
253+
# copy this tree's spec build resolved, and proves every workspace
254+
# consumer resolves the injected copy before returning. Nothing tracked
255+
# by git is touched in either checkout.
256+
- name: Inject the source-built spec into objectui's install
257+
env:
258+
UPSTREAM_SHA: ${{ steps.subjects.outputs.upstream }}
259+
TARBALL: ${{ steps.pack.outputs.tarball }}
260+
run: node scripts/ci/spec-shape-gate.mjs inject --tarball "$TARBALL" --sha "$UPSTREAM_SHA" --upstream-checkout "$GITHUB_WORKSPACE" --downstream "$GITHUB_WORKSPACE/objectui"
261+
262+
# ── The compile ──────────────────────────────────────────────────────
263+
# `pnpm type-check` is objectui's `turbo run type-check`, whose task
264+
# dependsOn `^build`: every objectui package is built against the
265+
# injected spec and then type-checked against those declarations. See the
266+
# header for `TURBO_FORCE`, `--continue`, the matcher and the no-pipe
267+
# capture. The step itself always exits 0; the verdict is the report's.
268+
- name: Type-check objectui against it
269+
id: compile
270+
working-directory: objectui
271+
run: |
272+
set +e
273+
echo "::remove-matcher owner=tsc::"
274+
TURBO_FORCE=true pnpm type-check --continue > "$RUNNER_TEMP/typecheck.log" 2>&1
275+
code=$?
276+
set -e
277+
echo "status=$code" >> "$GITHUB_OUTPUT"
278+
cat "$RUNNER_TEMP/typecheck.log"
279+
exit 0
280+
281+
# ALWAYS: this step IS the delivery. It reads the registry, writes the
282+
# summary (new diagnostics, known ones with their registration, the
283+
# commit range and lanes), emits one annotation per NEW diagnostic naming
284+
# the objectui file and the objectstack commit, and carries the verdict:
285+
# exit 0 green or known-only, exit 1 a new shape break, exit 2 a reading
286+
# it could not take (never a pass, never a shape break).
287+
- name: Report which objectui file fails against which objectstack commit, known or new, and whose lane
288+
if: always()
289+
env:
290+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
291+
UPSTREAM_SHA: ${{ steps.subjects.outputs.upstream }}
292+
DOWNSTREAM_SHA: ${{ steps.subjects.outputs.downstream }}
293+
UPSTREAM_COMMIT: ${{ steps.subjects.outputs.commit }}
294+
COMPILE_STATUS: ${{ steps.compile.outputs.status }}
295+
run: |
296+
node scripts/ci/spec-shape-gate.mjs report \
297+
--log "$RUNNER_TEMP/typecheck.log" \
298+
--sha "$UPSTREAM_SHA" \
299+
--downstream "$GITHUB_WORKSPACE/objectui" \
300+
--downstream-sha "$DOWNSTREAM_SHA" \
301+
--commit "$UPSTREAM_COMMIT" \
302+
--event "$GITHUB_EVENT_NAME" \
303+
--status "${COMPILE_STATUS:-2}"

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"check:pm-governed-prose": "node scripts/pm/check-governed-prose.mjs --self-test && node scripts/pm/check-governed-prose.mjs",
103103
"check:pm-settings-deny-roster": "node scripts/pm/check-settings-deny-roster.mjs --self-test && node scripts/pm/check-settings-deny-roster.mjs",
104104
"check:pm-expected-skips": "node scripts/pm/check-expected-skips.mjs --self-test",
105+
"check:spec-shape-gate": "node scripts/ci/spec-shape-gate.mjs --self-test",
105106
"check:publish-smoke-pin": "node scripts/publish-smoke-pack.mjs --self-test",
106107
"check:partof-closing-keyword": "node scripts/check-partof-closing-keyword.mjs --self-test",
107108
"check:commit-card-trailers": "node scripts/check-commit-card-trailers.mjs --self-test",

0 commit comments

Comments
 (0)