Public: anyone can read this; the crew can change it.

A release asks scripts/return-check.ts before it promotes #17793

opened this in answer to

Merged 7h 8m ago, live in production

The repository now has everything the release needs for the return check, but the host's tick.sh doesn't call it yet. That script isn't in this repo, so I couldn't edit it. Adding one line to it is the owner's host-side step.

Notes

opened this

The repository now has everything the release needs for the return check, but the host's tick.sh doesn't call it yet. That script isn't in this repo, so I couldn't edit it. Adding one line to it is the owner's host-side step.

  • Brought in scripts/return-check.ts (#17766). It was only on the unmerged branch sold/return-check, so I cherry-picked its commit 7fc26dde5 with its author intact. That is why the previous try was parked. Say so if you'd rather wait for that branch to merge first.
  • New src/release/return_check.ts. It holds the decision: it names each migration that makes a return unproven. A migration is let through only by a line <id> <reason> in an allow file; an id without a reason doesn't count. Exit 1 holds the release.
  • scripts/return-check.ts is now a thin wrapper over it. I added --log <file>, which appends what the check said, with timestamps, to the release log.
  • docs/features/nightly-release.md has the host step. Between build and promote the tick runs bun scripts/return-check.ts v<live> --allow /srv/forge/release-tick/return-allow.txt --log <release log>. Exit 1 is a hold, and so is exit 2 (it could not look).
  • New test/return-check-release.test.ts. It covers the hold, the let-through by id and reason, and an id with no reason being refused. It also covers a changed migration being named and a plain new one passing.
  • Checks. The new test and test/schema-additive.test.ts pass, as do the unused-exports, doorless and feature-doors tests, and tsc --noEmit is clean. The gate's one note is that parseAllow is 0.55 similar to docHeadings in test/cli-docs.test.ts. I judged that a false match and did not change it.
  • Not done. The check reads words, not meaning, so it does not prove the old code's writes. I wrote no end-to-end test of the host script, since it lives outside the repo.

To try it: bun test test/return-check-release.test.ts, or bun scripts/return-check.ts v0.7.719 --log $TMPDIR/release.log.

Closes #17769

2 earlier comments
commented

The repository now has everything the release needs for the return check, but the host's tick.sh doesn't call it yet. That script isn't in this repo, so I couldn't edit it. Adding one line to it is the owner's host-side step.

  • Brought in scripts/return-check.ts (#17766). It was only on the unmerged branch sold/return-check, so I cherry-picked its commit 7fc26dde5 with its author intact. That is why the previous try was parked. Say so if you'd rather wait for that branch to merge first.
  • New src/release/return_check.ts. It holds the decision: it names each migration that makes a return unproven. A migration is let through only by a line <id> <reason> in an allow file; an id without a reason doesn't count. Exit 1 holds the release.
  • scripts/return-check.ts is now a thin wrapper over it. I added --log <file>, which appends what the check said, with timestamps, to the release log.
  • docs/features/nightly-release.md has the host step. Between build and promote the tick runs bun scripts/return-check.ts v<live> --allow /srv/forge/release-tick/return-allow.txt --log <release log>. Exit 1 is a hold, and so is exit 2 (it could not look).
  • New test/return-check-release.test.ts. It covers the hold, the let-through by id and reason, and an id with no reason being refused. It also covers a changed migration being named and a plain new one passing.
  • Checks. The new test and test/schema-additive.test.ts pass, as do the unused-exports, doorless and feature-doors tests, and tsc --noEmit is clean. The gate's one note is that parseAllow is 0.55 similar to docHeadings in test/cli-docs.test.ts. I judged that a false match and did not change it.
  • Not done. The check reads words, not meaning, so it does not prove the old code's writes. I wrote no end-to-end test of the host script, since it lives outside the repo.

To try it: bun test test/return-check-release.test.ts, or bun scripts/return-check.ts v0.7.719 --log $TMPDIR/release.log.

commented

All three changes from the review are in and pushed. The new tests, test/schema-additive.test.ts, the unused-exports test and tsc --noEmit pass, and the gate reads 0 failures with one note.

  • Script test (test/return-check-script.test.ts). It runs scripts/return-check.ts with Bun.spawnSync inside a temporary git repo that has a tag, and checks:
    • Exit 0 when nothing changed since the tag.
    • Exit 1 with the unproven line when a shipped migration was edited.
    • --allow lets that id through with exit 0, and an id with no reason still gives exit 1.
    • --log appends ISO-stamped lines after an existing line, twice over, and never overwrites.
    • Exit 2 for a missing or malformed tag, a tag git can't find, and --allow or --log with no value.
  • parseAllow (src/release/return_check.ts). Lines starting with # are now comments and are skipped. A repeated id keeps its last reason. A new multi-line test pins blank lines, surrounding whitespace, comments, an id with no reason, and the repeated id.
  • Flags with no value (scripts/return-check.ts). --allow or --log given last, or followed by another flag, now prints a usage error and exits 2.
  • Missing --allow file. A file path that doesn't exist is still treated as an empty allow list rather than an error, so the tick works before anyone has written the file. Say so if you want that to exit 2 too.
commented

The check failed because test/return-check-script.test.ts ran git on the host's environment, which test/test-git-env.test.ts forbids. I fixed it and pushed. That test and test/test-git-env.test.ts pass, and tsc --noEmit is clean. I did not run the full suite.

Both the test's git calls and its bun runs of the script now use env: gitClientEnv() from test/helpers/git-client.ts. The repo init also goes through that same git helper. Only the test changed, not scripts/return-check.ts or src/release/return_check.ts. The pull's behaviour is as described before.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs