ci: skip steps that a change cannot affect #361

Manually merged
ullrich merged 3 commits from ci/change-scope into main 2026-11-18 08:58:20 +00:00
Owner

Contains the commit of #360. Merge #360 first; this PR then shows two commits.

Change

  1. scripts/ci-scope.mjs compares the tested commit with its base (tree to tree) and gives two outputs: code and openspec.
  2. Checks, Visual Tests, E2E Tests and Journal Image Smoke Test run it after checkout and skip their expensive steps when the change is inert.
Changed paths Steps that run
Only docs/, infrastructure/, root *.md, renovate.json5, agent config, non-CI workflows Security Scan, Dockerfile check
The above plus openspec/ The above, plus install and openspec validate
All other paths, an unknown path, no base commit, or an error Full suite

Required checks

All six jobs always run and always report. The CI / * status contexts do not change. Only steps inside the jobs are skipped. The conditions fail open: a step is skipped only when the scope output is the literal string false.

Why it is safe to skip

  • If the two trees differ only in inert paths, each input of a skipped step is byte-identical to the base. The base got its own full result.
  • Two files below infrastructure/ are read by tests. #360 declares them as Turbo inputs. Each declared Turbo input counts as code, so there is one list.
  • A test fails when source below apps/, packages/ or e2e/ reads an inert directory without a Turbo input declaration.
  • .forgejo/workflows/ci.yml and scripts/ are not inert. This PR runs the full suite on itself.

Verification

  • 6 unit tests (node --test, part of pnpm test).
  • Simulation with a shallow clone, as in CI: docs, openspec, code, infra fixture, ci.yml, new root file, zero base, unknown base. All gave the expected scope.
  • Replay on history:
Data set Full Narrowed
323 first-parent commits on main since 2026-07-22 269 54 (49 inert, 5 openspec only)
151 CI runs of the last 30 days with a resolvable commit 134 14

The 14 narrowed runs used 63 of 950 minutes in the four gated jobs (6.6%). None of them had a real failure in a gated job.

The narrowed path cannot run in this PR, because this PR changes ci.yml.

🤖 Generated with Claude Code

Contains the commit of #360. Merge #360 first; this PR then shows two commits. ## Change 1. `scripts/ci-scope.mjs` compares the tested commit with its base (tree to tree) and gives two outputs: `code` and `openspec`. 2. Checks, Visual Tests, E2E Tests and Journal Image Smoke Test run it after checkout and skip their expensive steps when the change is inert. | Changed paths | Steps that run | |---|---| | Only `docs/`, `infrastructure/`, root `*.md`, `renovate.json5`, agent config, non-CI workflows | Security Scan, Dockerfile check | | The above plus `openspec/` | The above, plus install and `openspec validate` | | All other paths, an unknown path, no base commit, or an error | Full suite | ## Required checks All six jobs always run and always report. The `CI / *` status contexts do not change. Only steps inside the jobs are skipped. The conditions fail open: a step is skipped only when the scope output is the literal string `false`. ## Why it is safe to skip - If the two trees differ only in inert paths, each input of a skipped step is byte-identical to the base. The base got its own full result. - Two files below `infrastructure/` are read by tests. #360 declares them as Turbo inputs. Each declared Turbo input counts as code, so there is one list. - A test fails when source below `apps/`, `packages/` or `e2e/` reads an inert directory without a Turbo input declaration. - `.forgejo/workflows/ci.yml` and `scripts/` are not inert. This PR runs the full suite on itself. ## Verification - 6 unit tests (`node --test`, part of `pnpm test`). - Simulation with a shallow clone, as in CI: docs, openspec, code, infra fixture, `ci.yml`, new root file, zero base, unknown base. All gave the expected scope. - Replay on history: | Data set | Full | Narrowed | |---|---|---| | 323 first-parent commits on main since 2026-07-22 | 269 | 54 (49 inert, 5 openspec only) | | 151 CI runs of the last 30 days with a resolvable commit | 134 | 14 | The 14 narrowed runs used 63 of 950 minutes in the four gated jobs (6.6%). None of them had a real failure in a gated job. The narrowed path cannot run in this PR, because this PR changes `ci.yml`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(ci): hash root configs and infra fixtures into the Turbo cache
All checks were successful
CI / Security Scan (pull_request) Successful in 9s
CI / Dockerfile Package Check (pull_request) Successful in 4s
CI / Visual Tests (pull_request) Successful in 45s
CI / Journal Image Smoke Test (pull_request) Successful in 1m31s
CI / Checks (pull_request) Successful in 2m59s
CI / E2E Tests (pull_request) Successful in 4m37s
CD Staging / Build & Push journal Image (pull_request) Has been skipped
CD Staging / Build & Push planner Image (pull_request) Has been skipped
CD Staging / Deploy Staging (pull_request) Has been skipped
CD Staging / Deploy PR Preview (pull_request) Has been skipped
Cancel superseded CI / Cancel in-flight CI (pull_request) Successful in 4s
CD Staging / Tear Down PR Preview (pull_request) Successful in 12s
6bc22e5ec4
CI keeps the Turbo cache between runs, and a cache hit replays the old
result. Turbo hashed only the files inside each package, so these inputs
did not invalidate the cache:

- tsconfig.base.json, vitest.shared.ts, vitest.setup.ts and
  eslint.config.js, which every package uses
- infrastructure/scripts/poi-selectors.sql and
  infrastructure/brouter-host/poi-extract/osmium-filters.txt, which the
  map-core sync tests read

A change to one of them got a cached green result for typecheck, lint
and test. Declare the root configs as globalDependencies and the two
fixtures as inputs of the map-core test task.

Verified with turbo --dry=json: the task hashes now change when one of
these files changes, and stay the same for unrelated files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
scripts/ci-scope.mjs compares the tested commit with its base and says
if the change can affect code checks or only OpenSpec validation. A path
must be proven inert (docs, infrastructure, agent config, non-CI
workflows) to be left out. An unknown path, a missing base, or an error
selects the full suite.

Files that tests read from infrastructure/ are declared as Turbo inputs,
and each declared Turbo input counts as code. A test fails when source
reads an inert directory without that declaration.

The script is not used by a workflow yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ci: skip steps that a change cannot affect
Some checks failed
CI / Security Scan (pull_request) Successful in 10s
CI / Dockerfile Package Check (pull_request) Successful in 7s
CI / Checks (pull_request) Successful in 1m41s
CI / Visual Tests (pull_request) Successful in 48s
CI / Journal Image Smoke Test (pull_request) Successful in 53s
CI / E2E Tests (pull_request) Successful in 3m44s
CI / Dockerfile Package Check (push) Has been cancelled
CI / Checks (push) Has been cancelled
CI / Visual Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Journal Image Smoke Test (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CD Staging / Build & Push journal Image (pull_request) Has been skipped
CD Staging / Build & Push planner Image (pull_request) Has been skipped
CD Staging / Deploy Staging (pull_request) Has been skipped
CD Staging / Deploy PR Preview (pull_request) Has been skipped
Cancel superseded CI / Cancel in-flight CI (pull_request) Successful in 3s
CD Staging / Tear Down PR Preview (pull_request) Successful in 12s
fe55272831
Each heavy job (Checks, Visual Tests, E2E Tests, Journal Image Smoke
Test) now runs scripts/ci-scope.mjs after checkout and skips its
expensive steps when the change is inert. A change below openspec/ runs
only the install and the OpenSpec validation.

The jobs always run and always report, so the required CI / * status
contexts do not change. The conditions fail open: steps are skipped only
when the scope output is the literal string false.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ullrich manually merged commit c343b96a09 into main 2026-11-18 08:58:20 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
trails-cool/trails!361
No description provided.