Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

chore(hooks): a push no longer waits on the gates

esengined12e0fd8b042
diff --git a/.githooks/pre-push b/.githooks/pre-push
deleted file mode 100755
index d2d52d3fe..000000000
--- a/.githooks/pre-push
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-# Pre-push guard: run the STATIC gates locally so a public-API surface drift (a
-# changed export without a refreshed sdk/etc/*.api.md snapshot) is caught before
-# it reddens master — not after, as a follow-up fix commit.
-#
-# And the test suites a change OWES. `verify:push` is `verify --suites owed`: the
-# same one ordered list in tools/gates.mjs, running the suites whose `owns` this
-# push has touched and leaving the rest to CI. Paying for none of them was cheap
-# and wrong — a tool gained a call, the double that stands in for it in the editor
-# suite did not, and the push went out red because no suite on this path compares
-# the two. Typically one suite runs, and the whole set is 80s.
-#
-# A machine that cannot run an owed suite is not excused here: the suite says what
-# it needs (an engine build, an emsdk) and this stops. Building it, or declaring
-# the gap the way CI does, is the answer — a suite quietly downgraded to a partial
-# run is the thing check-suite-preconditions exists to refuse.
-#
-# `pnpm run verify` still means everything; the hook pays for what it changed.
-if ! pnpm run verify:push; then
- echo ''
- echo '✗ push blocked by pre-push verify.'
- echo ' API surface drifted? node tools/api-surface.mjs --update (then commit the refreshed sdk/etc/*.api.md)'
- echo ' Only the suites this change OWES ran — `pnpm run verify` runs all five.'
- echo ' To bypass in a real emergency: git push --no-verify'
- exit 1
-fi
diff --git a/docs/SITE.md b/docs/SITE.md
index 62bcc6275..3a490def7 100644
--- a/docs/SITE.md
+++ b/docs/SITE.md
@@ -127,7 +127,7 @@ running locally before a docs PR.
| `npm run verify:imports` | `docs/astro` | A guide importing a symbol the SDK does not export — a renamed or invented API. Runs before the build. |
| `npm run verify:structure` | `docs/astro` | The rule above going soft: a page in no sidebar group, a sidebar entry with no page, a group page not labelled Overview, or a page that exists in only one language. Runs before the build. |
| `npm run verify:links` | `docs/astro` | Any in-site link or `#anchor` that does not resolve against the pages the build emitted, including a root-relative link that forgot the `/docs` base. Runs **after** the build. |
-| `node tools/component-reference.mjs --check` | repo root | The component reference disagreeing with the engine's component registry, or a component with no entry in `src/data/componentDocs.ts`. Part of `pnpm run verify`, so pre-push catches it. Refresh with `--update` after building the SDK. |
+| `node tools/component-reference.mjs --check` | repo root | The component reference disagreeing with the engine's component registry, or a component with no entry in `src/data/componentDocs.ts`. Part of `pnpm run verify`. Refresh with `--update` after building the SDK. |
### Available Components
diff --git a/package.json b/package.json
index 502dabe0b..e70eaa497 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,6 @@
"asset-meta": "node tools/asset-meta.js",
"migrate-asset-refs": "node tools/migrate-asset-refs.js",
"verify": "node tools/run-gates.mjs --scope local",
- "verify:push": "node tools/run-gates.mjs --scope local --suites owed",
"perf": "node tools/perf-guard.mjs --check",
"scale": "node tools/perf-budget.mjs",
"stress-project": "node tools/stress-project.mjs",
diff --git a/tools/check-suite-ownership.mjs b/tools/check-suite-ownership.mjs
index 28f8b8a2a..9ea9d8000 100644
--- a/tools/check-suite-ownership.mjs
+++ b/tools/check-suite-ownership.mjs
@@ -8,8 +8,8 @@
* `covers` made "the gate list is green" mean something by naming the tests a
* suite runs. `owns` is the other direction — the source whose direct unit-test
* owner that suite IS — and it is what `--suites owed` reads to decide which
- * suites a push has to pay for. A stale root there owns nothing, silently, and
- * the hole it leaves looks exactly like a clean diff: no suite owed, push green,
+ * suites a change has to pay for. A stale root there owns nothing, silently, and
+ * the hole it leaves looks exactly like a clean diff: no suite owed, run green,
* the double that stands in for the changed tool never compared against it.
*
* So the claim is checked rather than trusted: the roots exist, the tests a
diff --git a/tools/gates.mjs b/tools/gates.mjs
index 6bc4e6202..00969c147 100644
--- a/tools/gates.mjs
+++ b/tools/gates.mjs
@@ -3,12 +3,10 @@
/**
* @file gates.mjs — the static gates, in order, and where each one runs.
*
- * There were two lists again. `pnpm run verify` (which the pre-push hook ran)
- * held eighteen gates and CI's Tests job held six, overlapping in one. So
- * seventeen gates only ever ran on a machine with the hook installed, and five
- * only ran in CI — which is how a push went out green and CI failed on
- * check-examples, and how every gate written this year could have been silently
- * skipped by pushing from anywhere else.
+ * There were two lists again. `pnpm run verify` held eighteen gates and CI's
+ * Tests job held six, overlapping in one. So seventeen gates never ran in CI and
+ * five never ran locally — which is how a local run went green and CI failed on
+ * check-examples.
*
* One ordered list, then, with `where` saying which scope pays for each. Order
* is load-bearing: the declaration checks and the example type-check both read
diff --git a/tools/run-gates.mjs b/tools/run-gates.mjs
index 959342cb8..b65d97cfc 100644
--- a/tools/run-gates.mjs
+++ b/tools/run-gates.mjs
@@ -16,7 +16,7 @@
*
* node tools/run-gates.mjs --scope local
* node tools/run-gates.mjs --scope ci
- * node tools/run-gates.mjs --scope local --suites owed (the pre-push hook)
+ * node tools/run-gates.mjs --scope local --suites owed
* node tools/run-gates.mjs --scope local --keep-going --matrix out.json
*/
import { execFileSync, spawnSync } from 'node:child_process';
@@ -44,15 +44,14 @@ if (!SCOPES.includes(SCOPE)) {
const HAS_EDITOR = existsSync(path.join(ROOT, 'desktop', 'package.json'));
/**
* Which suite gates this caller pays for: `all` (default, and CI), `owed` (those
- * whose `owns` this change touched — the pre-push hook), or `none`.
+ * whose `owns` this change touched), or `none`.
*
* @details A machine that cannot run an owed suite is not silently excused: it
- * says what it needs and the push stops, per check-suite-preconditions.
+ * says what it needs and the run stops, per check-suite-preconditions.
*/
const SUITE_MODES = ['all', 'owed', 'none'];
if (argv.includes('--no-suites')) {
- console.error('run-gates: --no-suites is now --suites none (or --suites owed, which the'
- + ' pre-push hook uses).');
+ console.error('run-gates: --no-suites is now --suites none (or --suites owed).');
process.exit(2);
}
const SUITE_MODE = flag('suites', 'all');