Add mcTVM mctvm build artifact manifest - #33
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new Python script, tools/maca_artifact_manifest.py, designed to generate a reproducible artifact manifest containing file sizes and SHA-256 hashes. Feedback on the implementation suggests validating that the provided root path exists and is a directory to avoid silent failures, and replacing the assert statement in the self-test function with an explicit runtime check to ensure it is not bypassed when Python is run with optimization flags.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| def collect(root: Path) -> dict[str, object]: | ||
| seen: set[str] = set() |
There was a problem hiding this comment.
The collect function does not validate whether the provided root path exists and is a directory. If an invalid or misspelled path is passed, root.glob() will silently return an empty list, producing an empty manifest without any warning or error. This can lead to hard-to-detect failures in CI/CD pipelines. Consider validating that root is an existing directory before proceeding.
def collect(root: Path) -> dict[str, object]:
if not root.is_dir():
raise FileNotFoundError(f"The root path '{root}' does not exist or is not a directory.")
seen: set[str] = set()| sample.write_text("maca artifact\n", encoding="utf-8") | ||
| try: | ||
| data = collect(Path.cwd()) | ||
| assert any(item["path"] == sample.name for item in data["artifacts"]) |
There was a problem hiding this comment.
Avoid using assert statements for runtime validation or self-tests in executable scripts. When Python is run with optimization flags (e.g., python -O), all assert statements are compiled away and ignored, which would cause this self-test to silently pass even if the validation fails. Use an explicit if condition and raise an exception (such as RuntimeError) instead.
| assert any(item["path"] == sample.name for item in data["artifacts"]) | |
| if not any(item["path"] == sample.name for item in data["artifacts"]): | |
| raise RuntimeError("Self-test failed: sample artifact not found in manifest") |
Summary
Validation
Review notes