Skip to content

[ BOUNTY] Add input validation and error handling to verify_diagnostics.py#6

Open
Xiaofei-Z wants to merge 2 commits into
Andyyook:bounty-1-verify-diagnosticsfrom
Xiaofei-Z:add-input-validation
Open

[ BOUNTY] Add input validation and error handling to verify_diagnostics.py#6
Xiaofei-Z wants to merge 2 commits into
Andyyook:bounty-1-verify-diagnosticsfrom
Xiaofei-Z:add-input-validation

Conversation

@Xiaofei-Z

Copy link
Copy Markdown

Summary

Closes #1. Adds input validation, error recovery, and structured output to tools/verify_diagnostics.py.

Changes

  • argparse CLI: --verbose/-v, --json/-j, --threshold/-t (default 0)
  • Subprocess error recovery: run_build() wraps subprocess.run in try/except handling TimeoutExpired, FileNotFoundError, PermissionError, OSError with meaningful messages
  • --json output: full machine-readable report (build status, diagnostics found, schema validity, threshold met, overall ok)
  • --threshold N: exit non-zero if passing modules < N
  • validate_diagnostic_json(): schema validation — checks required keys, type correctness (modules is list, passed/failed are int), reports structural errors clearly

Testing

  • python3 tools/verify_diagnostics.py --help → shows all flags
  • python3 tools/verify_diagnostics.py → runs build, validates diagnostics, reports PASS/FAIL
  • python3 tools/verify_diagnostics.py --json → outputs structured JSON report
  • python3 tools/verify_diagnostics.py --threshold 5 → threshold logic verified
  • Reverse test: corrupting JSON → validator catches and reports structural error
  • python3 build.py run; diagnostic artifacts present

Checklist

  • argparse CLI with --verbose, --json, --threshold
  • subprocess.run wrapped in try/except with meaningful errors
  • --json output for machine consumption
  • --threshold N for minimum passing modules (default 0)
  • Diagnostic JSON schema validation with structural error reporting
  • Existing behavior preserved when run without flags
  • Changes scoped to tools/verify_diagnostics.py

  • I would like to request that my diagnostic build log is removed before merging

Feige added 2 commits June 19, 2026 19:24
- argparse CLI: --verbose, --json, --threshold (default 0)
- subprocess.run wrapped in try/except (timeout/file-not-found/permission/OS)
- --json: machine-readable structured report
- --threshold N: minimum passing modules required
- validate_diagnostic_json(): schema validation with structural error reporting

Closes Andyyook#1
@Xiaofei-Z

Copy link
Copy Markdown
Author

Hi @Andyyook, submitted this for the bounty. Added argparse CLI (--verbose/--json/--threshold), subprocess error recovery for all failure modes, JSON schema validation with structural error reporting, and threshold support. All acceptance criteria covered. Happy to address any feedback. Thanks!

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.

1 participant