Skip to content

Commit c666aae

Browse files
committed
fix: wait longer for npm in drift
1 parent 9cb68bd commit c666aae

4 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎.github/workflows/drift.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
build:
3535
runs-on: ubuntu-latest
3636
# The 3.0.0 build took just under six minutes on a laptop. The rest is room for the pin
37-
# step's wait of up to 15 minutes for npm, for uv, and for the wiki API's retries.
38-
timeout-minutes: 60
37+
# step's wait of up to 45 minutes for npm, for uv, and for the wiki API's retries.
38+
timeout-minutes: 90
3939
# It runs the generator over content anyone can edit, so it can only read.
4040
permissions:
4141
contents: read
@@ -76,7 +76,7 @@ jobs:
7676
require-lockfile: true
7777
# The server this run builds and tests the index with, before the generator runs: the version
7878
# a server-release dispatch asks for, or the newest npm lists, as scripts/server-pin.ts
79-
# decides. A move waits up to 15 minutes, checking every 30 seconds, until npm lists the
79+
# decides. A move waits up to 45 minutes, checking every 30 seconds, until npm lists the
8080
# version and its tarball answers, since pnpm add fails on a version npm does not serve yet.
8181
# The step holds no token. The dispatch's version is data, checked whole before any use. The
8282
# hashes of the two manifests let the pr job require the ones this job built index.db with.
@@ -118,7 +118,7 @@ jobs:
118118
# How often and how long the wait polls, from the environment so the tests can
119119
# shorten them.
120120
poll=${POLL_SECONDS:-30}
121-
limit=${DEADLINE_SECONDS:-900}
121+
limit=${DEADLINE_SECONDS:-2700}
122122
for value in "$poll" "$limit"; do
123123
if [[ ! $value =~ ^[0-9]+$ ]]; then
124124
echo "Not a whole number of seconds: '$value'" >&2

‎docs/MAINTAINING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Before the generator runs, its `Pin the server` step decides which server builds
149149
- Any other run moves the pin to the version npm lists as `latest` when that is above the pin,
150150
so a release whose dispatch was lost is picked up by the next scheduled run.
151151

152-
A move waits up to 15 minutes, checking every 30 seconds, until `npm view` lists the version's
152+
A move waits up to 45 minutes, checking every 30 seconds, until `npm view` lists the version's
153153
tarball and a `HEAD` on it answers 200, then runs `pnpm add -D --save-exact`. The step holds no
154154
token. It hands the `pr` job the server, whether the pin moved, and the SHA-256 of
155155
`package.json` and `pnpm-lock.yaml` as it built with them.
@@ -237,7 +237,7 @@ refresh, comments on the issue `Automation needs a look`, or opens it assigned t
237237
[When automation needs a look](RELEASING.md#when-automation-needs-a-look) says what to do.
238238

239239
- A tripped gate, a failing test, a guard that cannot read an index, an unreadable registry, a
240-
dispatch that names no `x.y.z` version, a server npm does not serve within 15 minutes, a
240+
dispatch that names no `x.y.z` version, a server npm does not serve within 45 minutes, a
241241
build job output or a recomputed pin the `pr` job does not accept, or a `version` on `main`
242242
that npm does not list yet each end the run red before anything is pushed. A pull request closed without merging, merged at another commit, left with auto-merge
243243
off, or not merged within 60 minutes ends it red after the push.

‎docs/RELEASING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ dropped. Each comment links the run and says what happened:
213213

214214
| The comment says | What to do |
215215
|---|---|
216-
| `The build job did not succeed.` and its result | `cancelled` means the job hit its 60 minute bound, most often a slow wiki, or someone cancelled the run. Run drift again. For `failure`, open the run and read the red step. A tripped gate in `pnpm build-index`, a failing `pnpm test`, a wiki the build could not read, or `The guard could not compare the indexes.` each end it there, before anything is pushed. Fix the cause, or run drift again once the wiki is back. |
216+
| `The build job did not succeed.` and its result | `cancelled` means the job hit its 90 minute bound, most often a slow wiki, or someone cancelled the run. Run drift again. For `failure`, open the run and read the red step. A tripped gate in `pnpm build-index`, a failing `pnpm test`, a wiki the build could not read, or `The guard could not compare the indexes.` each end it there, before anything is pushed. Fix the cause, or run drift again once the wiki is back. |
217217
| `The pr job did not succeed.` and its result | `cancelled` means the job hit its 75 minute bound or someone cancelled the run. Auto-merge stays on, so check the drift pull request. For `failure`, open the run and read the red step. `npm does not list X.Y.Z from package.json yet` means the release of the version on `main` is still running or failed, so follow [When a release run fails](#when-a-release-run-fails) and run drift again once npm has it. `was closed without merging` means someone closed the pull request. `merged <commit>, not <commit>` means the pull request merged a commit other than the one this run pushed, so read `git log` on `main` for what landed. `is off. Merge it, or turn auto-merge on again, by hand` means someone or something turned auto-merge off during the wait: merge the pull request with Rebase and merge once its checks pass, or turn auto-merge on again with `gh pr merge <number> --auto --rebase`, and the merge publishes. `failed 3 times in a row` means `gh` could not read the pull request, so check it by hand. `has not merged 3600 seconds after auto-merge was on` means its checks failed or are still running: auto-merge stays on, so it merges by itself once they pass, for example after you re-run a check that failed for a reason outside the repository. A red `Get a token of the tibia-sh App` step, or `Bad credentials` from `gh`, means the App's key or its installation no longer works, as [The tibia-sh App](#the-tibia-sh-app) describes. |
218-
| `The build job did not succeed.`, with `npm did not serve server X.Y.Z within 900 seconds.` in `Pin the server` | The run was moving the pin to server X.Y.Z, and for 15 minutes npm either did not list that version's tarball or a `HEAD` on it did not answer 200. Nothing was built or pushed. Check the server's release run in tibiawiki-mcp and `npm view @tibia.sh/tibiawiki-mcp@X.Y.Z dist.tarball`. Once npm serves it, run drift again by hand. A scheduled run also picks it up when it is `latest`. |
218+
| `The build job did not succeed.`, with `npm did not serve server X.Y.Z within 2700 seconds.` in `Pin the server` | The run was moving the pin to server X.Y.Z, and for 45 minutes npm either did not list that version's tarball or a `HEAD` on it did not answer 200. Nothing was built or pushed. Check the server's release run in tibiawiki-mcp and `npm view @tibia.sh/tibiawiki-mcp@X.Y.Z dist.tarball`. Once npm serves it, run drift again by hand. A scheduled run also picks it up when it is `latest`. |
219219
| `The build job did not succeed.`, with `The server-release dispatch asks for '…', not an x.y.z version.` in `Pin the server` | A `server-release` dispatch carried a payload version that is not `x.y.z`, and the step used none of it. Nothing was built or pushed. Fix the sender, tibiawiki-mcp's release workflow. Then run drift by hand, which moves the pin to npm's `latest`. |
220220
| `The pr job did not succeed.`, with a red `Check the build job's outputs` step | The build job handed on a value the `pr` job refuses: `changed`, `pin_moved` or `level` out of range, `Not a server version`, `moved the pin from A to B, which is not above it`, `kept the pin at B, but main pins A`, or `Neither the content nor the pin changed`. Nothing was pushed, and no token was minted. The build job runs the generator, so a value like this means either a mistake in `drift.yml`, such as a misspelt output, or a build job something tampered with. Read the build job's log, and in particular `Pin the server`. Run drift again only once you know which it was. |
221221
| `The pr job did not succeed.`, with `The recompute changed other files than package.json and pnpm-lock.yaml:` or `package.json changed in more than the pin of @tibia.sh/tibiawiki-mcp` in `Keep the recompute to the pin` | The `pr` job's own `pnpm add --lockfile-only` changed more than the server's pin. Nothing was pushed. That usually means a pnpm or `pnpm-workspace.yaml` change rewrote the manifests. Run the same command, `pnpm add -D --save-exact --lockfile-only --ignore-scripts --ignore-pnpmfile @tibia.sh/tibiawiki-mcp@X.Y.Z`, on a clean checkout of `main` and read `git diff`. When the extra change is right, land it in a reviewed pull request of its own, then run drift again. |

‎test/drift-workflow.test.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,9 @@ test('drift runs take turns in their own concurrency group, and none is cancelle
366366
assert.match(concurrency, /^ *cancel-in-progress: *false$/m, 'cancel-in-progress is not false');
367367
});
368368

369-
test('the build job is bounded in time', () => {
369+
test('the build job is bounded at 90 minutes, room for the 45 minute wait for npm and the build', () => {
370370
// A wiki API that keeps answering 429 with a long Retry-After must end the run, red.
371-
assert.match(scalar(buildJob(), 'timeout-minutes') ?? '', /^[1-9]\d*$/, 'the build job has no timeout-minutes');
371+
assert.equal(scalar(buildJob(), 'timeout-minutes'), '90');
372372
});
373373

374374
test('every action in the drift workflow is pinned to a full commit SHA, with its version beside it', () => {
@@ -1222,7 +1222,8 @@ type PinScenario = {
12221222
listed?: string[];
12231223
heads?: string[];
12241224
pins?: boolean;
1225-
env?: Record<string, string>;
1225+
/** An undefined value leaves that variable unset, so the step falls back to its default. */
1226+
env?: NodeJS.ProcessEnv;
12261227
};
12271228

12281229
/** Runs the build job's pin step in a checkout that pins `pin`, against a stand-in npm, curl and pnpm. */
@@ -1284,6 +1285,12 @@ test('on its schedule, the pin step moves the pin to the latest server once npm
12841285
]);
12851286
});
12861287

1288+
test('the pin step waits up to 2700 seconds for npm unless told otherwise', () => {
1289+
const run = runPin({ latest: '0.14.1\n', listed: [`${tarballOf('0.14.1')}\n`], env: { DEADLINE_SECONDS: undefined } });
1290+
assert.equal(run.status, 0, run.log);
1291+
assert.match(run.log, /^Waiting up to 2700 seconds for npm to serve server 0\.14\.1\.$/m, 'the default deadline is not 2700 seconds');
1292+
});
1293+
12871294
test('on a server-release dispatch, the pin step waits for npm to list the version and serve its tarball, then pins it', () => {
12881295
// npm does not know the version at first, then lists it before its tarball answers.
12891296
const run = runPin({ event: 'repository_dispatch', requested: '0.15.0', latest: '0.14.1\n', listed: ['E404', '', `${tarballOf('0.15.0')}\n`], heads: ['404', '200'] });

0 commit comments

Comments
 (0)