Add mcoplib mcoplib kernel inventory JSON#54
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new Python script, tools/kernel_inventory.py, which generates a JSON inventory of kernel files matching specific glob patterns. The feedback suggests adding validation for the --root directory argument to ensure it exists and is a directory, preventing silent failures with a 0 exit code when an invalid path is provided.
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.
| args = parser.parse_args() | ||
| if args.self_test: | ||
| self_test() | ||
| return 0 | ||
| print(json.dumps(inventory(Path(args.root)), ensure_ascii=False, indent=2)) | ||
| return 0 |
There was a problem hiding this comment.
If an invalid or non-existent path is provided to --root, the script currently silently succeeds, returning an empty inventory with a 0 exit code. This can lead to silent failures in CI/CD or validation workflows if the path is misconfigured.
Using parser.error() to validate that the specified root path exists and is a directory provides a clear error message on stderr and exits with a non-zero status code.
| args = parser.parse_args() | |
| if args.self_test: | |
| self_test() | |
| return 0 | |
| print(json.dumps(inventory(Path(args.root)), ensure_ascii=False, indent=2)) | |
| return 0 | |
| args = parser.parse_args() | |
| if args.self_test: | |
| self_test() | |
| return 0 | |
| root_path = Path(args.root) | |
| if not root_path.is_dir(): | |
| parser.error(f"The specified root path '{args.root}' is not a directory.") | |
| print(json.dumps(inventory(root_path), ensure_ascii=False, indent=2)) | |
| return 0 |
Summary
Validation
Review notes