Skip to content

fix(tools): validate compiler path before checking case sources (#655) - #666

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
DYNOSuprovo:fix/early-compiler-validation-655
Sep 17, 2026
Merged

LunaStev merged 1 commit into
wavefnd:masterfrom
DYNOSuprovo:fix/early-compiler-validation-655

Conversation

@DYNOSuprovo

Copy link
Copy Markdown
Contributor

Summary

Fixes #655

When \ ools/check_case_sources.py\ is invoked with an invalid, non-existent, or non-executable compiler path, it previously walked the entire case manifest and repeatedly failed launching each source file instead of failing early with a single top-level configuration error.

Changes

  • Added \�alidate_compiler(wavec: Path | str) -> Path\ in \ ools/check_case_sources.py:
    • Ensures the compiler path is non-empty (\ValueError).
    • Resolves candidate paths relative to \ROOT\ or via \shutil.which.
    • Verifies the candidate exists (\FileNotFoundError\ if missing).
    • Verifies the candidate is a regular file (\ValueError\ if directory or non-file).
    • Verifies launchability on POSIX systems (\PermissionError\ if not executable).
  • In \main(), validates \�rgs.wavec\ before starting source checks; on failure, preserves a valid report JSON with an empty
    esults\ list and records the configuration error.
  • In \ ools/test_check_case_sources.py, added regression tests covering missing compiler path, unusable directory path, empty path, non-launchable path, and verified no source execution is attempted.

Verification

  • Ran \python -m unittest tools/test_check_case_sources.py\ (10 passed in 1.3s).

@LunaStev LunaStev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. The overall direction matches #655, but there are a few cases that should be fixed before merging:

  1. validate_compiler() only checks executable permission on POSIX (os.name != "nt"). On Windows, any existing regular file can pass validation even if it is not actually launchable, which can still fall back to repeated per-source launch failures. Please make the preflight validation satisfy the issue requirement on Windows as well, or otherwise ensure an unusable compiler is rejected before any source command is attempted.

  2. A truly empty compiler argument is not detected by the current check. Path("") becomes Path("."), so if not str(raw).strip() does not catch "". Please validate the raw string before converting it to Path, and add a regression test for an actual empty string rather than only whitespace.

  3. #665 introduces the atomic report writer for this same tool. After that change lands, please rebase/update this PR and use the shared atomic report path for the new top-level compiler-validation error report as well, so this new error path does not reintroduce direct writes to the final JSON path.

Also, please keep the existing module docstring unless there is a specific reason to remove it.

@DYNOSuprovo
DYNOSuprovo force-pushed the fix/early-compiler-validation-655 branch from 3e07903 to 258174b Compare September 16, 2026 20:13
@DYNOSuprovo

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review @LunaStev! I have updated the PR to address all points:

  1. Windows Launchability: validate_compiler now validates that on Windows (os.name == "nt"), the compiler path has a launchable executable extension from PATHEXT (such as .exe, .bat, .cmd, .com), and added regression tests for Windows launchability alongside POSIX permission checks.
  2. Empty String Validation: Validated the raw input before Path conversion and handled empty/whitespace paths ("" and " "), and added regression test coverage specifically asserting "".
  3. Atomic Report Writer: Rebased onto master and integrated with _write_report introduced in fix: write case source-check reports atomically #665 so top-level compiler-validation errors are written atomically.
  4. Module Docstring: Preserved the original module docstring in tools/check_case_sources.py.

@LunaStev
LunaStev self-requested a review September 17, 2026 03:15

@LunaStev LunaStev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

@LunaStev
LunaStev merged commit 0c32b94 into wavefnd:master Sep 17, 2026
22 of 27 checks passed
@LunaStev LunaStev mentioned this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail early when check_case_sources receives an invalid compiler path

2 participants