Skip to content

Commit 67893c6

Browse files
authored
Make the runtime boundary check blame only a PR's own increase (#15153)
Pull request runs now compare against the base branch, so a PR is judged on its own change. Comparing absolute counts blamed every open PR for an increase merged to main by another PR (#15136 after #15134). The check nets increases out per Deno API and per std module before any file is blamed, so a renamed file or a moved call is not a finding. An increase is an error only for a Deno API that src/deno_ral covers equivalently (build.os and build.arch, in scopes that can import it). Every other increase is a warning on the added line, and the job summary gives the per-scope delta and the baseline bump a maintainer accepts with --accept-increase. Std imports get only a suggested replacement, since a name check cannot show that a wrapper exports what the file uses. Pushes to main and manual runs keep the absolute baseline gate. - Delta mode reads the baseline committed at the base revision. A PR that adds nothing while main is above baseline gets only a notice. - Delta mode lists the whole base tree rather than passing every changed path to git, which keeps long comparisons under the Windows command-line limit. - Counts use a prototype-free dictionary, so an identifier such as constructor is an ordinary key. - src/core/lib is browser-shared and cannot import src/deno_ral, so an increase there is a warning, not an error. Related to #15134, #15135 and #15136.
1 parent 4b29a10 commit 67893c6

10 files changed

Lines changed: 1475 additions & 63 deletions

‎.github/workflows/runtime-boundary.yml‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Runtime boundary ratchet for the Deno -> Node migration.
2-
# Fails when the number of `Deno.` occurrences or direct std-library imports
3-
# (per scope: src, src-js, resources, package/src, tests) rises above
4-
# tools/runtime-boundary-baseline.json.
2+
# Counts `Deno.` occurrences and direct std-library imports per scope
3+
# (src, src-js, resources, package/src, tests). Two modes:
4+
# - pull_request: compares the merge commit with its first parent (the base
5+
# branch tip) and fails only for a Deno.* API that src/deno_ral replaces;
6+
# other increases are warnings plus a maintainer block in the job summary.
7+
# - push (main) and workflow_dispatch: fails when a count rises above
8+
# tools/runtime-boundary-baseline.json.
59
# See dev-docs/runtime-migration/02-runtime-boundary-check.md.
610
name: Runtime Boundary
711
on:
@@ -34,6 +38,8 @@ jobs:
3438
steps:
3539
- name: Checkout Repo
3640
uses: actions/checkout@v6
41+
with:
42+
fetch-depth: 2
3743

3844
- name: Set Path
3945
shell: bash
@@ -45,5 +51,12 @@ jobs:
4551

4652
- name: Check runtime boundary
4753
shell: bash
54+
env:
55+
EVENT_NAME: ${{ github.event_name }}
4856
run: |
49-
quarto run --dev tools/check-runtime-boundary.ts
57+
if [ "$EVENT_NAME" = "pull_request" ]; then
58+
# The checkout is the merge commit: HEAD^1 is the base branch tip.
59+
quarto run --dev tools/check-runtime-boundary.ts --against HEAD^1
60+
else
61+
quarto run --dev tools/check-runtime-boundary.ts
62+
fi

‎dev-docs/runtime-migration/01-quick-fixes-from-spike.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
**Goal:** Land the two runtime-neutral fixes the spike found: `with { type: "json" }` on the two dynamic JSON imports, and a deterministic (sorted) order for the bslib Sass files.
77
**Phase:** 0.
8-
**Depends on:** 02 (lands first in Phase 0; this PR's test imports `tests/asserts.ts` and raises the `tests` baseline with `--accept-tests-increase`).
8+
**Depends on:** 02 (lands first in Phase 0; this PR's test imports `tests/asserts.ts` and raises the `tests` baseline with `--accept-increase`).
99
**Unblocks:** PR 26 (the Node bundle job needs both).
1010
**Branch:** `rt/01-quick-fixes-from-spike`.
1111
**Suggested executor:** Sonnet.
@@ -75,7 +75,7 @@ export const bslibComponentRules = (): string; // unchanged signature; now `conc
7575
- `package/dist/bin/quarto dev-call build-artifacts` completes and `git status --short src/resources/editor` is empty (the bundles do not change).
7676
- `concatenateDirFiles` returns file contents in sorted-name order regardless of creation order (unit test).
7777
- `bslibComponentRules()` equals `concatenateDirFiles` of `bslib-scss` followed by `concatenateDirFiles` of `components/scss` (the five `bslib-scss` files precede the nine `components/scss` files) (unit test).
78-
- `quarto run --dev tools/check-runtime-boundary.ts` passes after `--update-baseline --accept-tests-increase`: `src` unchanged (the helper keeps the 2 `Deno.` calls the old loop had), `tests` +6.
78+
- `quarto run --dev tools/check-runtime-boundary.ts` passes after `--update-baseline --accept-increase`: `src` unchanged (the helper keeps the 2 `Deno.` calls the old loop had), `tests` +6.
7979
- `cd tests && QUARTO_TESTS_NO_CONFIG=true ./run-tests.sh --agent unit/format-html-bslib-order.test.ts smoke/site/render-site-themes.test.ts smoke/render/render-html.test.ts` is green.
8080
8181
## Plan
@@ -310,7 +310,7 @@ Remove `/tmp/rt01` afterwards.
310310

311311
- [ ] **Step 6: Record the new test in the ratchet baseline**
312312

313-
Run: `package/dist/bin/quarto run --dev tools/check-runtime-boundary.ts --update-baseline --accept-tests-increase && git diff tools/runtime-boundary-baseline.json` Expected: one `::warning::tests baseline raised from N to N+6 (Deno.* calls)` line; the diff changes only `tests.denoCalls` (+6, the six `Deno.writeTextFileSync` fixture writes; PR 09 provides `deno_ral` file writers for later tests).
313+
Run: `package/dist/bin/quarto run --dev tools/check-runtime-boundary.ts --update-baseline --accept-increase && git diff tools/runtime-boundary-baseline.json` Expected: one `::warning::tests baseline raised from N to N+6 (Deno.* calls)` line; the diff changes only `tests.denoCalls` (+6, the six `Deno.writeTextFileSync` fixture writes; PR 09 provides `deno_ral` file writers for later tests).
314314
List the file and its count in the PR description.
315315

316316
- [ ] **Step 7: Commit**

‎dev-docs/runtime-migration/02-runtime-boundary-check.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# PR 02: Runtime boundary ratchet in CI, and `tests/asserts.ts`
22

3+
**Amended by:** PR 02c (PR-mode comparison, replacement maps, `--accept-increase`).
4+
35
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task.
46
> Steps use checkbox (`- [ ]`) syntax for tracking.
57

0 commit comments

Comments
 (0)