fix: reports hold the data trees they read

generate_readme, generate_site and slots resolve against data/ but took no hold when run on their own, as the documented commands do. A refresh swapping a tree mid-read then gave counts from half of it. Each now holds the trees shared, like verify and the builder.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 00:32:26 +02:00
1 parent aea67e998f
commit 7e23815545
4 files changed
+50 -2

No files matched your search

+10 -1
View File
@@ -772,9 +772,18 @@ def main() -> None:
)
args = parser.parse_args()
import contextlib
from common import load_data_dir_registry
from refresh_data_dirs import hold_data_dirs
db = load_database(args.db)
readme = generate_readme(db, args.platforms_dir)
# Coverage resolves against data/: a refresh swapping a tree mid-read
# published counts taken from half of it.
with contextlib.ExitStack() as held:
hold_data_dirs(held, load_data_dir_registry(args.platforms_dir))
readme = generate_readme(db, args.platforms_dir)
status = "Generated" if write_if_changed("README.md", readme) else "Unchanged"
print(f"{status} ./README.md")