schema: add machine-readable JSON Schema v2 (diffgraph-v2.schema.json)#16
schema: add machine-readable JSON Schema v2 (diffgraph-v2.schema.json)#16avikalpg wants to merge 2 commits into
Conversation
Adds diffgraph/schema/diffgraph-v2.schema.json — the JSON Schema 2020-12 draft that operationalises the v2 output contract from design/JSON-SCHEMA.md. Covers: FileEntry, SymbolEntry, RelationshipEntry, SummaryEntry, Evidence, Metadata, Warning, AnalysisSource. Required fields enforced; inferred claims must carry evidence + confidence. privacy_tier is a top-level required metadata field. Consumers can use this for validation in CI, typed generation, and VS Code schema hints. This satisfies one of the four schema ratification criteria in JSON-SCHEMA.md (the machine-readable file). Still needs: Avikalp sign-off on sub-questions, one end-to-end worked example validated, PR #11 updated to target this schema.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughA new JSON Schema file defines the canonical DiffGraph v2.0 output format: a strict top-level object with required fields (schema_version, generated_at, wild_version, diff_ref, files, symbols, relationships, metadata), reusable types for provenance/evidence, conditional validation for inferred entries, and metadata/warnings schemas. ChangesDiffGraph v2.0 Output Schema Contract
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@diffgraph/schema/diffgraph-v2.schema.json`:
- Around line 256-257: The schema defines location line numbers with
"line_start" and "line_end" having "minimum": 0 which permits zero-valued lines;
update the JSON schema in diffgraph-v2.schema.json so both "line_start" and
"line_end" use "minimum": 1 to enforce 1-indexed line numbers (change the
"line_start" and "line_end" properties accordingly in the location definition).
- Around line 120-121: The schema's line_start has a mismatch: its description
says "1-indexed line number" but "minimum" is 0; update the JSON schema to
enforce 1-indexing by changing the "minimum" for the line_start property from 0
to 1, and likewise review line_end (the "line_end" property) to ensure its
"minimum" is consistent with line_start (set to 1 if it should also be
1-indexed) so the constraints match the documented descriptions.
- Around line 341-366: The SummaryEntry schema currently allows missing evidence
despite its description; add "evidence" to the SummaryEntry "required" array and
strengthen the "evidence" property so the array must contain at least one
llm_inference and one structural_basis entry (use JSON Schema array "contains"
constraints or equivalent: two contains clauses with item schemas that match an
Evidence with "kind":"llm_inference" and "kind":"structural_basis", while
keeping items as { "$ref": "`#/`$defs/Evidence" }); update SummaryEntry to require
evidence and add the contains-based validators to enforce the described
contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 51092d93-c7dc-4f19-8008-259c564ffac1
📒 Files selected for processing (1)
diffgraph/schema/diffgraph-v2.schema.json
Three fixes per coderabbit review: - Evidence.line_start/line_end: minimum 0 → 1 (schema said 1-indexed, minimum was inconsistently 0; line 0 is not a valid source location) - SymbolEntry.location.line_start/line_end: same fix; added descriptions - SummaryEntry: add 'evidence' to required array and add allOf contains constraints enforcing at least one llm_inference + one structural_basis entry (matches the described contract that was previously unenforced)
What
Adds
diffgraph/schema/diffgraph-v2.schema.json— the JSON Schema 2020-12 draft that operationalises the v2 output contract fromdesign/JSON-SCHEMA.md.This satisfies one of the four schema ratification criteria listed in that doc:
What it covers
FileEntry— git-metadata-derived file change infoSymbolEntry— named code entities withchange_kind,analysis_source,evidence(required for inferred claims)RelationshipEntry— edges with mandatoryanalysis_source;confidence+evidencerequired wheninferredSummaryEntry— top-level LLM summary (alwaysinferred)Evidence— typed union of all evidence kinds (ast_parse, import_statement, call_site, llm_inference, structural_basis, ...)Metadata— includesprivacy_tieras a required fieldWarning— machine-readable warning codes for degraded analysisWhy now
The schema file was a listed ratification criterion. It's completely unblocked (doesn't depend on Avikalp's answers to B1/B2/B3 or any PR merge). Having it available means:
.wildoutput filesRemaining ratification criteria
design/JSON-SCHEMA.md(anonymous symbols, unchanged symbols, cross-file calls as structural, confidence scoring) — if all recommendations are fine, just say "schema OK"Related
design/PR-13-REVIEW.md(committed to the docs repo, Mon Jun 8 session) — code-level review of PR Phase1: tree sitter dependency extraction for diffgraph #13 against acceptance criteriadesign/DESIGN-SYNTHESIS.md— full v2 specdesign/JSON-SCHEMA.md— prose schema spec this file implementsSummary by CodeRabbit