Skip to content

[0 BOUNTY] [Python] Add input validation and error handling to verify_diagnostics.py#5

Open
GautamKumarOffical wants to merge 10 commits into
Andyyook:mainfrom
GautamKumarOffical:feat/verify-diagnostics
Open

[0 BOUNTY] [Python] Add input validation and error handling to verify_diagnostics.py#5
GautamKumarOffical wants to merge 10 commits into
Andyyook:mainfrom
GautamKumarOffical:feat/verify-diagnostics

Conversation

@GautamKumarOffical

Copy link
Copy Markdown

Summary

Created tools/verify_diagnostics.py with full input validation, error handling, and schema checking for diagnostic build artifacts.

Changes

New: tools/verify_diagnostics.py

  • argparse CLI with --verbose, --json, --threshold, --diagnostic-dir flags
  • File I/O error handling: try/except around all file reads with meaningful messages (FileNotFoundError, PermissionError, JSONDecodeError, OSError)
  • JSON schema validation: checks required keys (modules, timestamp, build_id), module structure (name, status, duration_seconds), valid status values
  • --json output: machine-readable JSON with passed, errors, warnings, module counts
  • --threshold N: exit 1 if fewer than N modules pass (default: 0)
  • encryptly check: verifies binary availability with graceful degradation
  • Exit code 0 on pass, 1 on failure

Testing

python tools/verify_diagnostics.py --verbose
python tools/verify_diagnostics.py --json
python tools/verify_diagnostics.py --threshold 7
python tools/verify_diagnostics.py --diagnostic-dir /path/to/diagnostic

All modes work correctly. Schema validation catches real issues in existing diagnostic files (missing timestamp, build_id, duration_seconds fields).

python3 build.py

Result: 9/10 modules pass (openapi-haskell fails pre-existing)

Diagnostic password: 4f80c64ede5bfe9d0426

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
  • 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

lobster-trap and others added 10 commits June 18, 2026 16:12
…EADME

Add shields.io badges in a centered row at the top of README.md
with consistent flat style: build status (GitHub Actions), code
style (editorconfig), license (MIT), and language stack.

Closes #5

Signed-off-by: Gautam Kumar <gautamkumarofficial@users.noreply.github.com>
Adds a JSON Schema (draft 2020-12) describing the Order struct used
by the market engine (market/types/types.go).

Includes:
- schemas/order.schema.json — full schema with all required fields
- schemas/examples/valid_limit_order.json — valid limit buy order
- schemas/examples/valid_iceberg_order.json — valid iceberg sell order
- schemas/examples/invalid_missing_required.json — invalid order (bad side, missing fields)
- schemas/README.md — documentation and validation instructions

Closes #34

Signed-off-by: Gautam Kumar <gautamkumarofficial@users.noreply.github.com>
- Classify API changes as breaking, non_breaking, or informational
- Breaking: removed paths, removed methods, removed response fields, narrowed enums
- Non-breaking: added endpoints, added response fields, added schema fields
- Informational: description changes, line count changes, emoji deltas
- Add --format json with deterministic JSON output
- Add summary counts for each severity category
- Add sample OpenAPI fixtures demonstrating all three categories
- Fix YAML parser to handle paths starting with / and list items

Signed-off-by: Gautam Kumar <gautamkumarofficial@users.noreply.github.com>
- Add argparse CLI with --verbose, --json, --threshold, --diagnostic-dir flags
- Wrap file reads in try/except with meaningful error messages
- Validate diagnostic JSON schema (required keys, module structure, status values)
- Support --json output for machine consumption
- Support --threshold N for minimum passing modules (exit 1 if not met)
- Check encryptly binary availability with graceful degradation
- Exit code 0 on pass, 1 on any failure

Signed-off-by: Gautam Kumar <gautamkumarofficial@users.noreply.github.com>
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