Skip to content

[$40 BOUNTY] Add input validation and error handling to verify_diagnostics.py#2

Open
maojianian25-png wants to merge 1 commit into
Andyyook:mainfrom
maojianian25-png:feature/verify-diagnostics-validation
Open

[$40 BOUNTY] Add input validation and error handling to verify_diagnostics.py#2
maojianian25-png wants to merge 1 commit into
Andyyook:mainfrom
maojianian25-png:feature/verify-diagnostics-validation

Conversation

@maojianian25-png

Copy link
Copy Markdown

Summary

This PR implements the verify_diagnostics.py tool with comprehensive input validation, error handling, and structured output support as requested in #1.

Changes

  • Add argparse CLI with --verbose, --json, and --threshold flags
  • Wrap subprocess.run calls in try/except with meaningful error messages for TimeoutExpired, FileNotFoundError, PermissionError, and generic exceptions
  • Support --json output for machine consumption with structured result objects
  • Allow --threshold N for minimum passing modules (default: 0)
  • Validate diagnostic JSON schema on read and report structural errors including:
    • Required top-level fields (generated_at, commit, total_modules, passed, failed, modules)
    • Required module fields (name, status, elapsed_seconds, output)
    • Valid status values (PASS/FAIL)
    • Numeric elapsed_seconds
    • Count consistency (total_modules, passed, failed match actual module array)
  • Add encryptly platform detection and logd file readability verification
  • Add comprehensive docstrings and type hints throughout

Testing

Verified locally with:

# Basic verification
python3 tools/verify_diagnostics.py

# Verbose mode
python3 tools/verify_diagnostics.py --verbose

# JSON output
python3 tools/verify_diagnostics.py --json

# Threshold check (should fail with current diagnostics)
python3 tools/verify_diagnostics.py --threshold 5

All modes produce correct output. JSON schema validation catches structural errors correctly.

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

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

Closes #1

…stics.py

- Add argparse CLI with --verbose, --json, --threshold flags
- Wrap subprocess.run calls in try/except with meaningful error messages
- Support --json output for machine consumption
- Allow --threshold N for minimum passing modules (default: 0)
- Validate diagnostic JSON schema on read and report structural errors
- Add comprehensive docstrings and type hints

Closes Andyyook#1
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.

[$40 BOUNTY] [Python] Add input validation and error handling to verify_diagnostics.py

1 participant