CI: one tested rule for code changes; review fixes

From the review of this PR:
- What counts as code lives only in scripts/ci/affected.py now: nothing selected and not full
  means no code changed, on pull requests and pushes to main alike. The untested bash copy in
  Select checks disagreed with it. Root files and folders a crate embeds now select that crate
  (the licence texts and NOTICE: the engine; skills/: the MCP server's tests), where before a
  change to them ran no test at all. Other workflows and the bots' scripts select nothing.
- A push to main skips the native jobs only when nothing a build reads changed since the last
  push to main whose run passed. Comparing with the push just before was unsafe: a newer push
  cancels a waiting run, so that commit may never have been tested.
- Fail fast applies to pull requests only. On main, nightly and Run workflow the test build and
  the shards run regardless of the repository checks, so the action matrix and property tests
  that hang off Build tests keep their signal. Doc tests (main and nightly only now) no longer
  wait for the checks.
- tests/robustness/ turns on the goldens, so a change to goldens.json runs the seed tests.
- tests/oracle/ no longer selects the kernel, which never reads it.
- The workflow header and CONTRIBUTING describe what main and pull requests now run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QWhMwdqJYQKQq8RCLSL1LT
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-19 16:42:11 -04:00
1 parent 6b4026fd19
commit 2f92aaee6c
4 files changed
+99 -74

No files matched your search

+31 -16
View File
@@ -13,24 +13,37 @@ Prints and optionally appends to $GITHUB_OUTPUT:
A changed file maps to the package whose directory holds it. The packages that depend on those
(directly or not, dev-dependencies included) are added. Test data under tests/ maps to the
packages that read it, and a vendored crate (vendor/, a [patch] of a crates.io dependency) to the
packages that use it. Anything that can change every package, or that no package owns, selects
the full workspace. Only documentation and packaging files are ignored.
packages that read it, a vendored crate (vendor/, a [patch] of a crates.io dependency) to the
packages that use it, and a root file or folder a crate embeds to that crate. Anything that can
change every package, or that no package owns, selects the full workspace. Documentation,
packaging, the other workflows and the GitHub bots' scripts are ignored: when only those change,
nothing is selected and full is false, which CI reads as "no code changed" (on pull requests and
on pushes to main alike).
"""
import argparse
import json
import subprocess
import sys
# Changes here can affect every package.
FULL_PREFIXES = (".cargo/", ".config/", ".github/", "scripts/")
FULL_FILES = ("Cargo.toml", "Cargo.lock")
# Changes here affect no code: documentation and packaging.
IGNORED_PREFIXES = ("docs/", "packaging/")
# Changes here can affect every package. The CI workflow itself is one; other workflows are not.
FULL_PREFIXES = (".cargo/", ".config/", "scripts/")
FULL_FILES = ("Cargo.toml", "Cargo.lock", ".github/workflows/ci.yml")
# Changes here affect no code: documentation, packaging, the other workflows and GitHub settings,
# and the GitHub bots' scripts (tested in the repository checks). Root *.md files too, unless
# embedded (below).
IGNORED_PREFIXES = ("docs/", "packaging/", ".github/", "scripts/claim/", "scripts/triage/")
IGNORED_FILES = ("vendor/README.md",)
# Root files that a crate embeds (include_str!), so they are not ignorable documentation.
EMBEDDED = {"ATTRIBUTION.md": "solidcraft-ui-egui"}
# Asset folders that only some packages read: the UI embeds the catalogs, xtask checks them.
EMBEDDED_PREFIXES = {"assets/locales/": ("solidcraft-ui-egui", "xtask")}
EMBEDDED = {
"ATTRIBUTION.md": "solidcraft-ui-egui",
"LICENSE-MIT": "solidcraft-engine",
"LICENSE-APACHE": "solidcraft-engine",
"NOTICE": "solidcraft-engine",
"THIRD-PARTY-LICENSES.txt": "solidcraft-engine",
}
# Folders that only some packages read: the UI embeds the catalogs and xtask checks them; the MCP
# server's tests read the agent skills.
EMBEDDED_PREFIXES = {"assets/locales/": ("solidcraft-ui-egui", "xtask"), "skills/": ("solidcraft-mcp",)}
# Test data and the package directories whose tests (or xtask) read it. Any other folder under
# tests/ selects the full workspace.
TEST_DATA = {
@@ -38,7 +51,7 @@ TEST_DATA = {
"tests/hole_matrix/": ("crates/engine/",),
"tests/projection/": ("crates/engine/",),
"tests/taper/": ("crates/engine/",),
"tests/oracle/": ("apps/solidcraft-cli/", "crates/kernel/", "xtask/"),
"tests/oracle/": ("apps/solidcraft-cli/", "xtask/"),
"tests/action_matrix/": ("apps/solidcraft-cli/", "crates/engine/", "xtask/"),
}
# Vendored crates (vendor/<crate>/, a [patch] of a crates.io dependency) and the dependency names
@@ -102,12 +115,14 @@ def select(meta, paths):
hit = set()
for path in paths:
if path in FULL_FILES or path.startswith(FULL_PREFIXES) or path.startswith("rust-toolchain"):
if path in FULL_FILES or path.startswith("rust-toolchain"):
return True, []
if path in IGNORED_FILES or path.startswith(IGNORED_PREFIXES):
continue
if path.startswith(FULL_PREFIXES):
return True, []
owners = [d for d in by_dir if path.startswith(d)]
if path.startswith("vendor/"):
if path == "vendor/README.md":
continue
users = users_of(path.split("/")[1])
if not users:
return True, []
@@ -124,7 +139,7 @@ def select(meta, paths):
hit.add(EMBEDDED[path])
elif any(path.startswith(p) for p in EMBEDDED_PREFIXES):
hit.update(next(v for p, v in EMBEDDED_PREFIXES.items() if path.startswith(p)))
elif path.startswith(IGNORED_PREFIXES) or ("/" not in path and path.endswith(".md")):
elif "/" not in path and path.endswith(".md"):
continue
else:
return True, [] # not owned by any package
+17 -1
View File
@@ -52,6 +52,12 @@ class Synthetic(unittest.TestCase):
def test_docs_only_selects_nothing(self):
self.assertEqual(affected.select(SYNTH, ["docs/book/a.md", "README.md", "packaging/x.yml"]), (False, []))
def test_no_code_paths_select_nothing(self):
# What CI reads as "no code changed", on pull requests and pushes to main alike.
for p in [".github/workflows/docker.yml", ".github/ISSUE_TEMPLATE/bug.yml", "scripts/claim/claim.js",
"scripts/triage/triage.test.js", "vendor/README.md", "SECURITY.md"]:
self.assertEqual(affected.select(SYNTH, [p]), (False, []), p)
class RealWorkspace(unittest.TestCase):
@classmethod
@@ -78,11 +84,21 @@ class RealWorkspace(unittest.TestCase):
self.assertNotIn("solidcraft-kernel", pk)
self.assertNotIn("solidcraft-render", pk)
def test_oracle_cases_select_the_cli_and_xtask(self):
def test_oracle_cases_select_the_cli_and_xtask_not_the_kernel(self):
full, pk = affected.select(self.meta, ["tests/oracle/box/recipe.json"])
self.assertFalse(full)
self.assertIn("solidcraft-cli", pk)
self.assertIn("xtask", pk)
self.assertNotIn("solidcraft-kernel", pk)
def test_embedded_root_files_select_their_crate(self):
for path, pkg in [("ATTRIBUTION.md", "solidcraft-ui-egui"), ("LICENSE-MIT", "solidcraft-engine"),
("NOTICE", "solidcraft-engine"), ("THIRD-PARTY-LICENSES.txt", "solidcraft-engine"),
("skills/solidcraft-modeling/SKILL.md", "solidcraft-mcp")]:
full, pk = affected.select(self.meta, [path])
self.assertFalse(full, path)
self.assertIn(pkg, pk, path)
self.assertNotIn("solidcraft-kernel", pk, path)
def test_unmapped_test_data_selects_full(self):
self.assertEqual(affected.select(self.meta, ["tests/tools/x.json"]), (True, []))