Skip to content

fix(ci): close the scope map silent gaps and ratchet it shut - #3852

Merged
zackees merged 3 commits into
masterfrom
ci/scope-completeness
Nov 7, 2026
Merged

zackees merged 3 commits into
masterfrom
ci/scope-completeness

Conversation

@zackees

@zackees zackees commented Nov 7, 2026

Copy link
Copy Markdown
Member

The scope map had a silent hole: 128 build inputs selected no CI lane at all, so touching them could leave CI green on a tree it never rebuilt.

Measured, not assumed

Running ci_scope.scope([path]) over all 11,184 tracked files:

before
build inputs covered by no lane 128
worst cases cmake/Modules/ObsHelpers.cmake (a module every target includes), libobs-opengl/CMakeLists.txt, every Metal Swift source, every WinRT header

cmake/Modules/*.cmake changing selected nothing - not Linux, not macOS, not Windows.

What this does

  1. TREE_PLATFORMS - trees whose paths carry no OS token, so the name classifier returns None:
"libobs-metal/":  {MACOS}
"libobs-winrt/":  {WINDOWS}
"libobs-d3d11/":  {WINDOWS}
"libobs-opengl/": {LINUX, WINDOWS}
"cmake/linux/":   {LINUX}   "cmake/macos/": {MACOS}   "cmake/windows/": {WINDOWS}
  1. Top-level cmake/** is shared and tier2 - every target includes those modules, so a change must rebuild Linux Tier 2 plus both native lanes. plugins/CMakeLists.txt joins SHARED_FILES.
  2. ci/test_scope_completeness.py - a ratchet: every tracked file under a build-input root must select at least one lane. Exemptions live in ci/scope_exemptions.txt and may only shrink (two tests enforce that: no stale pattern, and no exemption that a rule now covers).

Result

build inputs with no lane: 128 -> 0
exempted (with reasons):   32   AppImage packaging, Flatpak manifest+generator,
                                Steam depot descriptors, one cosmetic dotfile
tests: 67 passed, 46 subtests   (test_scope_completeness.py + test_ci_scope.py)

The exempted trees are covered by their own workflows (appimage.yaml builds and runs the AppImage in distro containers; the flatpak and steam jobs consume the manifests), so this is not a testing regression - it is the map telling the truth about who owns what.

Cost

More lanes now run for changes that previously ran none: cmake/**, libobs-opengl/**, libobs-metal/**, libobs-winrt/**. That is the point - those changes do affect those builds. The comparison to the old behaviour is a CI-time increase on precisely the PRs that used to skip everything.

Not done here

  • The graph-derived closure (compile_commands + depfiles) that would replace the prefixes entirely. This ratchet is the precondition: it proves any replacement is at least as complete.
  • build-cache: true / S3 enablement - still gated on zccache#1943 (stale replay, safe: false).

Measured: 128 build inputs selected NO lane, so a change to e.g.
cmake/Modules/ObsHelpers.cmake (a module every target includes) or
libobs-opengl/CMakeLists.txt left CI green on a tree it never rebuilt.

- Add TREE_PLATFORMS for trees whose paths carry no OS token: libobs-metal
  (macos), libobs-winrt and libobs-d3d11 (windows), libobs-opengl
  (linux+windows), cmake/{linux,macos,windows}.
- Treat top-level cmake modules/config as shared AND tier2: every target
  includes them. plugins/CMakeLists.txt joins SHARED_FILES.
- Add ci/test_scope_completeness.py: every tracked build input must select
  at least one lane, with a shrink-only ci/scope_exemptions.txt for the
  packaging scripts that have their own workflows.

After: build inputs with no lane 128 -> 0 (32 are explicitly exempted:
AppImage/Flatpak/Steam packaging, which appimage.yaml and the flatpak and
steam workflows exercise).
…red file

The first cut imported pytest and edited sys.path, which ci/test_ci_tests_stdlib_only.py
and ci/test_no_sys_path_edits.py both forbid (the gate runs these with plain
). Rewritten as stdlib unittest, importing ci_scope by
name the way test_ci_scope.py does. plugins/CMakeLists.txt joins the shared-build
registry with a reason, which ci/test_shared_build_files.py requires.
The tree/cmake rules pushed scope() to complexity 12 (limit 10). Moved them into
tree_lanes(), which returns the (macos, windows, tier2) delta. Behaviour is
unchanged: scope_completeness + ci_scope tests pass.
@zackees
zackees added this pull request to the merge queue Nov 7, 2026
Merged via the queue into master with commit 108c674 Nov 7, 2026
38 checks passed
@zackees
zackees deleted the ci/scope-completeness branch November 7, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants