From 47392d60791f94d93ee431ba07b3ec59e625e535 Mon Sep 17 00:00:00 2001 From: reacher-z <68239571+reacher-z@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:25:30 -0700 Subject: [PATCH] Test that the release index lists exactly the executable task files restore_modes makes executable only the files the index lists, because Hugging Face does not keep file modes. Nothing checked that the list agrees with the checkout, so a script made executable in tasks/ but left out of the index would install from Hugging Face without its executable bit. The index and the source modes agree for all 70 tasks today; the test keeps it that way. --- tests/test_download_tasks.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_download_tasks.py b/tests/test_download_tasks.py index de794f29..d55ce7a2 100644 --- a/tests/test_download_tasks.py +++ b/tests/test_download_tasks.py @@ -123,6 +123,26 @@ def test_index_matches_the_pinned_harbor(self): self.assertIn(f"harbor=={index['harbor']}", project["dependencies"]) self.assertEqual(importlib.metadata.version("harbor"), index["harbor"]) + def test_index_executables_match_the_source_modes(self): + """The checkout and the release agree on which task files are executable. + + Hugging Face does not store file modes, so the index is the only record + of them for that source; a script made executable in the checkout but + missing from the index would install without its executable bit. + """ + index = download.load_index() + mismatched = [] + for name, entry in sorted(index["tasks"].items()): + task = ROOT / "tasks" / name + listed = set(entry["executables"]) + for path in sorted(task.rglob("*")): + if not path.is_file(): + continue + relative = path.relative_to(task).as_posix() + if bool(path.stat().st_mode & 0o111) != (relative in listed): + mismatched.append(f"{name}/{relative}") + self.assertEqual(mismatched, []) + def test_index_with_another_schema_is_rejected(self): with tempfile.TemporaryDirectory() as tmp: path = Path(tmp) / "index.json"