mirror of
https://github.com/morluto/rea.git
synced 2026-12-02 13:11:18 -05:00
ci(hooks): check the advertised-schema summary before pushing source changes (#15428)
* ci(hooks): check the advertised-schema summary before pushing source changes A stale advertised-schema summary was the most common PR CI failure in a recent window (10 of 28 failing runs). The pre-push hook now runs npm run verify:advertised-schemas when the branch changes non-test files under src/, and skips it otherwise. On a schema change it took 6.5-9.5 s to rebuild with a warm Turbo cache plus 0.9-2.6 s to check, and printed the update command. * ci(hooks): refuse pushes with uncommitted schema summaries and document the check The schema check reads the working tree while CI reads the pushed commit, so running --update-summary without committing the result passed the hook and still failed CI. The hook now refuses the push while files under scripts/verify/advertised-schemas/tools are uncommitted. The testing guide and CONTRIBUTING describe when the hook runs the check.
This commit is contained in:
@@ -1 +1,17 @@
|
||||
npm run check:fast
|
||||
|
||||
# CI compares the committed advertised-schema summary on every code change, and
|
||||
# a stale summary was the most common PR CI failure. Check it here only when
|
||||
# the branch changes production source, so other pushes skip the build.
|
||||
base=$(git merge-base HEAD origin/main 2>/dev/null || true)
|
||||
if [ -n "$base" ] &&
|
||||
git diff --quiet "$base" HEAD -- src ':(exclude)**/*.test.ts'; then
|
||||
exit 0
|
||||
fi
|
||||
npm run verify:advertised-schemas
|
||||
# The check reads the working tree; CI reads the pushed commit.
|
||||
summaries=scripts/verify/advertised-schemas/tools
|
||||
if [ -n "$(git status --porcelain -- "$summaries")" ]; then
|
||||
echo "Commit the updated files in $summaries before pushing." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+3
-1
@@ -394,7 +394,9 @@ It guides reproduction and comparable measurements before changing checks.
|
||||
`docs:check` also runs the onboarding example consistency suite for README-only
|
||||
changes.
|
||||
|
||||
Pre-commit formats and lints staged files; pre-push runs `check:fast`.
|
||||
Pre-commit formats and lints staged files; pre-push runs `check:fast`, and
|
||||
`verify:advertised-schemas` when the branch changes non-test files under
|
||||
`src/`.
|
||||
|
||||
### Generated files and command ownership
|
||||
|
||||
|
||||
@@ -362,8 +362,10 @@ environment with `pip install --require-hashes -r` and set
|
||||
as not verified rather than passed; `REA_REQUIRE_SCHEMA_ENGINES=1` turns it
|
||||
into a failure. CI's build job sets it after uploading the build, using the
|
||||
runner's Go and a virtual environment cached by the requirements file's
|
||||
digest, so every code change runs every engine. The pre-push hook does not
|
||||
run the check, because it needs a current build. `--package-root=DIR` lists
|
||||
digest, so every code change runs every engine. The pre-push hook runs the
|
||||
check, after a cached build, when the branch changes non-test files under
|
||||
`src/`, and refuses the push while the regenerated summaries are uncommitted.
|
||||
`--package-root=DIR` lists
|
||||
an installed package instead of the checkout's build; the release guide uses
|
||||
it to [check the qualified archive](releasing.md#check-the-packed-catalog-with-client-engines).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user