CI: a translation change tests the UI and xtask, not the whole workspace (#3061)

assets/locales/ belongs to no crate, so affected.py selected the full
workspace (every crate, all four test shards) for a catalog-only PR. Only
solidcraft-ui-egui embeds the catalogs and xtask checks them; map the folder
to those two packages and their dependents.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bherbruck
2026-10-19 08:31:49 -04:00
committed by GitHub
parent 7fd51ce6a5
commit 5f399207bf
2 changed files with 12 additions and 0 deletions
+4
View File
@@ -28,6 +28,8 @@ FULL_FILES = ("Cargo.toml", "Cargo.lock")
IGNORED_PREFIXES = ("docs/", "packaging/")
# 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")}
def load_metadata(path):
@@ -76,6 +78,8 @@ def select(meta, paths):
hit.add(by_dir[max(owners, key=len)])
elif path in EMBEDDED:
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")):
continue
else:
+8
View File
@@ -71,6 +71,14 @@ class RealWorkspace(unittest.TestCase):
def test_docs_only_selects_nothing(self):
self.assertEqual(affected.select(self.meta, ["docs/book/src/dev/testing.md", "CONTRIBUTING.md"]), (False, []))
def test_translation_selects_the_ui_and_xtask_not_the_kernel(self):
full, pk = affected.select(self.meta, ["assets/locales/ja.json", "assets/locales/it.json"])
self.assertFalse(full)
self.assertIn("solidcraft-ui-egui", pk)
self.assertIn("xtask", pk)
self.assertNotIn("solidcraft-kernel", pk)
self.assertNotIn("solidcraft-engine", pk)
if __name__ == "__main__":
unittest.main()