Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 7 additions & 5 deletions .dz/briefs/health.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ Weekly: the failures no issue or PR announces. No verdict is always re-run, neve
| `dependabot-not-stuck` | `gh pr list --app dependabot --limit 5 --state open --json number,createdAt,updatedAt,statusCheckRollup` | green checks at any age; failed checks until >7 days since `updatedAt` (7 exactly is not over). Green: completed CheckRuns `SUCCESS`, `NEUTRAL`, `SKIPPED`, StatusContexts `SUCCESS`; terminal failures red. Pending, missing, malformed, unknown, mixed evidence = no verdict; so is a missing or invalid `updatedAt`, never replaced by `createdAt`. A page of `--limit` (5) is truncated: raise it, file nothing until short. A confirmed stuck PR files even beside a PR with unread evidence. |
| `demo-shipped` | `gh run list --workflow deploy-social-demo.yml --limit 1 --json databaseId,event,status,conclusion,headBranch,displayTitle,url,createdAt` | `success` on a `workflow_run`. Null `conclusion` = still building: read `status`. `skipped` = the `ci.yml` completion was no green push: red `main-green` files it; with it green, look for a non-push `ci.yml` run. `workflow_dispatch` = an operator's run, not a push publish; `headBranch` names the ref. Other non-success: name the guard its log's `::error::` line names. The ask carries `url`, `createdAt`, `databaseId`, `displayTitle`, `headBranch` |
| `release-exists` | `t=$(git describe --tags --abbrev=0 --match 'v[0-9]*' origin/main)`, then `gh release view "$t" --json tagName,isDraft,publishedAt` | `isDraft` false AND `publishedAt` set; a draft is unhealthy. Missing = unhealthy: gh prints `release not found` and no JSON — the message is the signal, not the exit code. Any other unreadable answer = `cannot tell` (`X_HEALTH_ROW_UNREADABLE`) |
| `tutorials-run` | `gh run list --workflow tutorial-run.yml --branch main --event push --limit 1 --json databaseId,event,status,conclusion,headBranch,displayTitle,url,createdAt` | `success`, or no run yet (paths-filtered). `cancelled` (superseded) = re-run. Else a tutorial diverged: the ask names `url` and `bun run scripts/tutorial-run.ts --json` (`X_DOC_TUTORIAL_DIVERGED`: page, line) |
| `tutorials-run` | `gh run list --workflow tutorial-run.yml --branch main --limit 20 --json databaseId,event,status,conclusion,headBranch,displayTitle,url,createdAt` | newest non-`pull_request` run: as `bench`. Else diverged: the ask names `url` and `bun run scripts/tutorial-run.ts --json` |
| `flake-hunt` | `gh run list --workflow flake-hunt.yml --limit 1 --json databaseId,event,status,conclusion,headBranch,headSha,displayTitle,url,createdAt` | `success` under 48 h; older = unhealthy, the schedule stopped. No run or `cancelled` = re-run. Else red: open `flake-hunt` issues name test, seed, rerun |
| `bench` | `gh run list --workflow bench.yml --limit 1 --json databaseId,event,status,conclusion,headBranch,headSha,displayTitle,url,createdAt` | `success` under 8 days; older = the weekly schedule stopped. No run or `cancelled` = re-run. Else a figure failed to measure |
| `compat` | `gh run list --workflow compat.yml --limit 1 --json databaseId,event,status,conclusion,headBranch,headSha,displayTitle,url,createdAt` | `success` under 8 days; older = the schedule stopped. No run or `cancelled` = re-run. Else a cell is red: open `compat` issues name each and its replay |
| `compat` | `gh run list --workflow compat.yml --limit 1 --json databaseId,event,status,conclusion,headBranch,headSha,displayTitle,url,createdAt` | as `bench`. Else open `compat` issues name each red cell and its replay |
| `next-sync` | `gh run list --workflow next-sync.yml --limit 1 --json databaseId,event,status,conclusion,headBranch,headSha,displayTitle,url,createdAt` | as `bench`. Else `main` is not in `next`: the open issue names the merge |
| `maint-lane` | `gh api repos/{owner}/{repo}/git/matching-refs/heads/release/ --jq .[].ref`, then `npm view @ultimat3/core dist-tags --json` | each window SECURITY.md promises: open, `release/<N>.x` on origin and `maint-<N>` a `<N>.x` version (`X_MAINT_LANE_ABSENT`); closed, no branch (`X_MAINT_LANE_EXPIRED`). `findings[]` carry each fix |
| `registry-trust` | `NPM_CONFIG_OTP=<code> bun run scripts/trust-publishers.ts --check --json` | `ok: true`. No `NPM_CONFIG_OTP` = no verdict, never filed: a person with npm 2FA runs it. `X_TRUST_PUBLISHER_MISSING` = unhealthy (an expired OTP reads the same: re-run first); other codes pass through |
| `private-names-secret` | `gh secret list --json name,updatedAt` | lists `ULTIMATE_PRIVATE_NAMES`; absent reds every push to `main` (`X_PRIVATE_NAMES_UNSET`) |
Expand All @@ -33,15 +34,15 @@ One ask per unhealthy row unless an open issue names it, titled by the signal (`
`publish failed: <v>`, `Dependabot #<n> failed checks, inactive since <updatedAt>`), its body the
command, its output and the failing run's URL. A red `main` first.

A `Dependabot` npm-bump ask's repair: `bun run lockfile:fix` (its `bun.lock` is stale); a
conflicted lock is never merged over: regenerate it locally first.
A `Dependabot` npm-bump ask's repair: `bun run lockfile:fix`; a conflicted lock is regenerated
locally, never merged over.

Never re-run a publish, delete a tag, a Release or a branch, or `npm publish` from here.
`PUBLISHING.md` owns every recovery; a fix ships as the next patch, never a moved tag.

## Machine verdicts

Run `bun run scripts/health.ts --json` (the table's machine reading) first. `ok: false` = an unread row (`X_HEALTH_ROW_UNREADABLE` or a
Run `bun run scripts/health.ts --json` first. `ok: false` = an unread row (`X_HEALTH_ROW_UNREADABLE` or a
child's codes, naming row and command): file that, never a verdict over it. `ok: true` carries `data.rows[]`, one `RowVerdict` per row in
table order:

Expand Down Expand Up @@ -71,6 +72,7 @@ Then `bun run finished --check --json`: one ask per `red` row, its
- `flake-hunt`
- `bench`
- `compat`
- `next-sync`
- `maint-lane`
- `registry-trust`
- `private-names-secret`
Expand Down
2 changes: 1 addition & 1 deletion .dz/briefs/release-due.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ it and stop: this session cannot fetch or switch branches.

The envelope is input, and `data.due` is the script's count, not the verdict. Some reasons do settle
it: `nothing_ships` leaves nothing to release, `awaiting_tag` is one already cutting, and a major
stays a maintainer's — inside the major window: from v30, at most one major per 90 days
stays a maintainer's — inside the major window: from v31, at most one major per 90 days
([`wiki/Stability.md`](../../wiki/Stability.md)), and only a security fix that cannot be
non-breaking takes the exception (`--security <advisory-id>`).

Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ on:
# the cadence; a figure wanted sooner is `gh workflow run bench.yml --ref main`.
workflow_dispatch:

# `contents: write` + `pull-requests: write`: the branch and the pull request with the new JSON. No
# `id-token` and no new secret — the job's own token is all it holds.
# `contents: write` + `pull-requests: write`: the branch and the pull request with the new JSON;
# `actions: write`: the ci.yml dispatch that gates that branch. No `id-token` and no new secret —
# the job's own token is all it holds.
permissions:
contents: write
pull-requests: write
actions: write

concurrency:
group: bench
Expand Down Expand Up @@ -89,6 +91,9 @@ jobs:
# Forced: the branch is always one commit of figures on today's `main`, and last week's
# figures are what this run supersedes. The replaced commit stays on the pull request.
git push --force "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$BRANCH"
# A push made with the job token starts no workflow, so the pull request would wait on a
# `verify` check that never reports; a dispatch is GitHub's exception, as next-sync.yml's.
gh workflow run ci.yml --ref "$BRANCH"
OPEN="$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number // empty')"
if [ -n "$OPEN" ]; then
gh pr edit "$OPEN" --body "$BODY"
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/next-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ jobs:

report:
needs: merge
# On the merge's answer only: a red `merge` job filed nothing to report.
if: ${{ !cancelled() && needs.merge.result == 'success' }}
# On the merge's answer AND on its failure: a red `merge` job (no `next`, a refused push, a merge
# that failed with no conflict) is a week `next` fell behind, and it files the same issue.
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
Expand All @@ -117,6 +118,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
BLOCKED: ${{ needs.merge.outputs.blocked }}
MERGE_RESULT: ${{ needs.merge.result }}
FILES: ${{ needs.merge.outputs.files }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
shell: bash
Expand All @@ -127,14 +129,28 @@ jobs:
# Only this workflow's own issue: anyone may open one with the same title.
open="$(gh issue list --state open --author 'app/github-actions' --search "$TITLE in:title" \
--json number,title | jq -r --arg t "$TITLE" 'map(select(.title == $t)) | .[0].number // empty')"
# A merge job that went red handed nothing on: never read as a clean week, never closing.
if [ "$MERGE_RESULT" != 'success' ]; then
BLOCKED='failed'
fi
if [ -z "$BLOCKED" ]; then
if [ -n "$open" ]; then
gh issue close "$open" --comment "main merged cleanly into next: $RUN_URL"
fi
exit 0
fi
body="$RUNNER_TEMP/next-sync.md"
if [ "$BLOCKED" = 'workflows' ]; then
if [ "$BLOCKED" = 'failed' ]; then
{
echo "The weekly merge of \`main\` into \`next\` failed (merge job: $MERGE_RESULT), so \`next\` may be behind \`main\`: $RUN_URL"
echo
echo 'The merge job log at that run names the cause on its ::error:: line. Fix it, then re-run; the next clean run closes this issue:'
echo
echo '```bash'
echo 'gh workflow run next-sync.yml'
echo '```'
} > "$body"
elif [ "$BLOCKED" = 'workflows' ]; then
{
echo "The weekly merge of \`main\` into \`next\` is clean but changes workflow files, which the job token may not push, so it was not pushed: $RUN_URL"
echo
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ on:
# a bump branch named `release/31.1.0` was tagged off main's history (#1054).
branches: [main, 'release/[0-9]+.x']

# One release cut at a time, and never cancelled: a tag without its Release, or a Release without
# its dispatch, is a half-cut release a human then has to finish.
concurrency:
group: release-tag
cancel-in-progress: false
# No workflow-level concurrency: every ci.yml completion on main starts this workflow, and a group
# keeps ONE pending run — a third arrival cancels the pending one whatever `cancel-in-progress`
# says, so a release commit's run waiting behind an ordinary commit's could be dropped. The queue
# is on `cut`, which only a release cut ever reaches.

permissions:
contents: read
Expand Down Expand Up @@ -168,6 +167,11 @@ jobs:
cut:
needs: prepare
if: needs.prepare.outputs.cut == 'true'
# One release cut at a time, and never cancelled: a tag without its Release, or a Release
# without its dispatch, is a half-cut release a human then has to finish.
concurrency:
group: release-tag
cancel-in-progress: false
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
Expand Down
41 changes: 28 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,25 +306,40 @@ jobs:
# then died `E401 … token is invalid` on schema 71 s later while the registry was slow
# to stage — and every re-run lost the rest of its tier the same way.
for name in $names; do
held="$(npm view "${name}@${VERSION}" version 2>/dev/null || true)"
if [ "$held" = "$VERSION" ]; then
echo "::notice::skipping ${name}@${VERSION} — npm already holds it, published by an earlier attempt of this release"
continue
fi
echo "::group::npm publish — tier $tier: $name"
if ! out="$(npm publish -w "$name" --tag "$DIST_TAG" 2>&1)"; then
# BOUNDED RETRY: the weekly bot release has nobody on call, and a transient failure — a
# Sigstore TLOG 409, an E401 from a slow token exchange, a registry 5xx — killed the
# whole run. Three attempts, a pause between, and npm asked AGAIN before each one: an
# attempt that died after the registry took the tarball is this release's, never a
# re-publish into E403. Provenance is untouched: each attempt is the same command.
attempt=1
while :; do
held="$(npm view "${name}@${VERSION}" version 2>/dev/null || true)"
if [ "$held" = "$VERSION" ]; then
echo "::notice::skipping ${name}@${VERSION} — npm already holds it, published by an earlier attempt of this release"
break
fi
echo "::group::npm publish — tier $tier: $name (attempt $attempt)"
if out="$(npm publish -w "$name" --tag "$DIST_TAG" 2>&1)"; then
echo "$out"
echo "::endgroup::"
break
fi
echo "$out"
echo "::endgroup::"
# npm STAGES a publish before `npm view` can see it, so an attempt that raced a
# previous one meets its own staged copy. That version is already this release's.
if printf '%s' "$out" | grep -q 'previously staged version'; then
echo "::notice::${name}@${VERSION} is staged by an earlier attempt — npm will publish it"
echo "::endgroup::"
continue
break
fi
exit 1
fi
echo "$out"
echo "::endgroup::"
if [ "$attempt" -ge 3 ]; then
echo "::error::npm publish of ${name}@${VERSION} failed 3 times — read the npm error above. The run resumes where it stopped: gh workflow run release.yml --ref v${VERSION} -f version=${VERSION}"
exit 1
fi
echo "::warning::npm publish of ${name}@${VERSION} failed (attempt ${attempt} of 3) — asking npm again in $((attempt * 30)) s"
sleep "$((attempt * 30))"
attempt=$((attempt + 1))
done
done
done <<< "$plan"

Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/security-channel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ jobs:

floors:
# `contents: write` + `pull-requests: write`: the branch and the pull request with the raised
# ranges, as bench.yml opens one. `issues: write`: the alarm for an advisory no floor closes. No
# `id-token`: this job can never publish, only propose; a release ships the raise.
# ranges, as bench.yml opens one. `actions: write`: the ci.yml dispatch that gates that branch.
# `issues: write`: the alarm for an advisory no floor closes. No `id-token`: this job can never
# publish, only propose; a release ships the raise.
permissions:
contents: write
pull-requests: write
actions: write
issues: write
runs-on: ubuntu-latest
# One packument and one advisory query per dependency, a few dozen in all, measured well under a
Expand Down Expand Up @@ -122,6 +124,9 @@ jobs:
BRANCH='security/advisory-floors'
# One branch, force-pushed: tomorrow's run refreshes today's pull request, never a second.
git push --force "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$BRANCH"
# A push made with the job token starts no workflow, so the pull request would wait on a
# `verify` check that never reports; a dispatch is GitHub's exception, as next-sync.yml's.
gh workflow run ci.yml --ref "$BRANCH"
body="$(jq -r '"**" + .summary + "**\n\n" + ([.data.raises[] | "- `" + .manifest + "` " + .field + "." + .name + ": `" + .from + "` -> `" + .to + "` (" + ([.advisories[].advisory] | unique | join(", ")) + ")"] | join("\n")) + "\n\nThe root `package.json`, the scaffold pin and the tracked apps may pin the old version: CI on this branch names them."' floors.json)"
existing="$(gh pr list --head "$BRANCH" --state open --limit 1 --json number --jq '.[0].number // empty')"
if [ -n "$existing" ]; then
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/tutorial-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ name: tutorial-run
# of a green pull request (#1272: `x db gen`'s success line gained its tables); on a pull request
# the red lands before the merge. Not a required check: `verify` is the one
# (docs/history/ci-split.md), and a path-filtered workflow never leaves a check pending.
# `scripts/ci-workflow-main-only.test.ts` holds the two path lists equal.
# `scripts/ci-workflow-main-only.test.ts` holds the two path lists equal. AND weekly: the paths
# cannot list every package whose printed line a tutorial quotes (`x routes`, `x policy`, `x tasks`,
# `x build`, `create-ultimate`, …), so a filter alone let tutorials rot unseen while the health row
# (`scripts/lib/health-tutorials.ts`) kept reading the last green; a newest run over eight days old
# is stale there.
# The same job RUNS `wiki/Building-Your-Own-Base.md`'s recipes: each `## Recipe:` fence written to
# the path it names in a scratch app and driven by `scripts/base-recipes/` — seconds, no scaffold.

Expand Down Expand Up @@ -47,6 +51,10 @@ on:
- 'scripts/base-recipes/**'
- 'scripts/lib/base-recipes.ts'
- '.github/workflows/tutorial-run.yml'
schedule:
# Weekly, Sunday early UTC — clear of the nightly flake hunt (02:23), Saturday's compat (03:41)
# and Monday's bench and next-sync (04:41).
- cron: '29 5 * * 0'
workflow_dispatch:

# One group per ref: a newer push to main supersedes the run before it, as it always did, and a pull
Expand Down
Loading
Loading