Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ lite-07; bitrate enforcement is not part of this release.
- [Dependency and alternatives audit](/quest/m2/audit-deps.md) - every dependency earns its weight, preferring fewer, and the rest are current, deduplicated, and the best maintained option
- [Dead code and API surface audit](/quest/m2/audit-dead-code.md) - repeat the removal audit before the next major release
- [Typecheck with bun check](/quest/m2/bun-check.md) - workspace packages typecheck through bun once nixpkgs ships bun 1.4.4
- [Declare each check module once in the dispatcher](/quest/m2/dispatch-modules.md) - one registration call per module replaces its parallel tables
- [Format YAML with Biome](/quest/m2/biome-yaml.md) - `just check` fails on unformatted YAML
- [Format Markdown with Biome](/quest/m2/biome-markdown.md) - Biome formats every Markdown file and remark is gone, landed in a quiet window
- [Test coverage audit](/quest/m2/audit-test-coverage.md) - repeat the coverage audit against the m1 baselines after the next release ships
Expand Down
22 changes: 0 additions & 22 deletions quest/m2/dispatch-modules.md

This file was deleted.

287 changes: 147 additions & 140 deletions sh/dispatch.sh

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions sh/gh/test-inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,10 @@ def execute(self, path: Path):
self.executed.add(path)
# The module dispatch passes its own names: `just <module> check` and the like.
if path == self.root / "sh/dispatch.sh":
for line in re.findall(r"modules=\(([^)]*)\)", path.read_text(errors="replace")):
for name in line.split():
for verb in ("check", "fix"):
for recipe in self.resolve([name, verb], self.root):
self.visit_recipe(recipe)
for name in re.findall(r"^module (\w+) ", path.read_text(errors="replace"), re.M):
for verb in ("check", "fix"):
for recipe in self.resolve([name, verb], self.root):
self.visit_recipe(recipe)

def bases(self, text: str, cwd: Path, file: Path | None) -> list[Path]:
"""The directories a script path in text may be relative to."""
Expand Down
11 changes: 11 additions & 0 deletions sh/gh/test-inventory.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ def test_a_commented_out_caller_covers_nothing(self):
self.write("justfile", JUSTFILE.replace(caller, f"echo 'a # b' a#b && {caller}"))
self.assertNotIn("ignore media::gpu::tests::renders", self.orphans())

def test_the_module_dispatcher_reaches_each_registered_module(self):
# sh/dispatch.sh runs `just <module> check` for each `module` registration.
self.write("sh/dispatch.sh", "module() { :; }\nmodule rs '^rs/' \\\n tools='cargo' fix\n")
self.write("rs/justfile", RS + "\n check:\n just rs sweep\n")
self.assertIn("recipe rs::sweep", self.orphans())

self.write("justfile", JUSTFILE + " bash sh/dispatch.sh check\n")
orphans = self.orphans()
self.assertNotIn("recipe rs::sweep", orphans)
self.assertNotIn("ignore media::probe::long_sweep", orphans)

def test_a_dispatcher_runs_only_the_branch_its_caller_selects(self):
self.write(
"sh/group.sh",
Expand Down
2 changes: 1 addition & 1 deletion sh/js/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def selection(root, paths):

def unmapped(root, paths):
"""Existing inputs the dispatcher's static JS impact map misses, so changing one would skip its readers."""
impact = re.compile(re.search(r"^\s*\[js\]='([^']*)'", (root / "sh/dispatch.sh").read_text(), re.M).group(1))
impact = re.compile(re.search(r"^module js '([^']*)'", (root / "sh/dispatch.sh").read_text(), re.M).group(1))
# A directory input matches through the files under it, and an import through its file.
return [
path
Expand Down
2 changes: 1 addition & 1 deletion sh/js/workspace.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def setUp(self):
self.write()
(self.root / "test/tsconfig.json").write_text('{"exclude":["**/dist"]}')
(self.root / "sh").mkdir()
(self.root / "sh/dispatch.sh").write_text(" [js]='^(js/|doc/|demo/|test/)'\n")
(self.root / "sh/dispatch.sh").write_text("module js '^(js/|doc/|demo/|test/)'\n")

def write(self):
(self.root / "package.json").write_text(json.dumps({"workspaces": list(self.packages)}))
Expand Down
11 changes: 8 additions & 3 deletions sh/rs/select.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
LINUX = os.uname().sysname == "Linux"


def dispatch_scope():
"""The rs module's impact pattern, as sh/dispatch.sh registers it."""
return re.search(r"^module rs '([^']*)'", (ROOT / "sh/dispatch.sh").read_text(), re.M).group(1)


class SelectTest(unittest.TestCase):
# CI runs target lints before its test build.
def selected(self, *paths, action="lint", github_actions=False):
Expand Down Expand Up @@ -71,7 +76,7 @@ def test_workspace_clippy_configuration_selects_workspace(self):
with self.subTest(paths=paths):
calls = self.selected(*paths)
self.assertTrue(any(call.startswith("rs lint --workspace ") for call in calls), calls)
scope = re.search(r"^\s*\[rs\]='([^']*)'", (ROOT / "sh/dispatch.sh").read_text(), re.M).group(1)
scope = dispatch_scope()
self.assertRegex("clippy.toml", scope)

def test_gate_runs_no_feature_matrix(self):
Expand Down Expand Up @@ -157,11 +162,11 @@ def test_relay_nixos_module_selects_the_relay(self):
# moq-relay's tests read the module.
calls = self.selected("nix/modules/moq-relay.nix", action="test")
self.assertTrue(any("/rs/moq-relay#" in call for call in calls), calls)
scope = re.search(r"^\s*\[rs\]='([^']*)'", (ROOT / "sh/dispatch.sh").read_text(), re.M).group(1)
scope = dispatch_scope()
self.assertRegex("nix/modules/moq-relay.nix", scope)

def test_dispatch_scope_covers_out_of_crate_targets(self):
scope = re.search(r"^\s*\[rs\]='([^']*)'", (ROOT / "sh/dispatch.sh").read_text(), re.M).group(1)
scope = dispatch_scope()
metadata = json.loads(
subprocess.check_output(["cargo", "metadata", "--format-version", "1", "--no-deps"], cwd=ROOT, text=True)
)
Expand Down