Repository navigation
test(contracts): schemas for the six CLIs that print JSON without one, validated on the tier-1 fixtures (#873) - #912
Conversation
…, validated on the tier-1 fixtures (#873)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3dc770d265
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… since the fixtures' ElemTable is empty
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6abb350b13
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…t contracts, the output schemas stay open to added fields, and the validator checks const, item counts and sibling refs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65f656e1c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…s the constant 1, the validator checks minLength, and --all-strings must print string records
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 947d36a61c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…et contracts, and relation-domain entries a schema
…e.sha (#873) (#919) The semver gate compared each pull request with the event's base.sha, which can be older than main (7c4e87f on #912 with main at 6af75c9), so changes main took since counted as the pull request's. It now compares with the merge commit's first parent, main as GitHub merged the branch into it.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43f014b846
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| The integration test `tests/json_schema_contracts.rs` runs every CLI that | ||
| prints JSON and validates its output against its schema: on the tier-1 |
There was a problem hiding this comment.
Validate the rvt-ifc observation output
The assertion that every JSON-producing CLI is schema-validated overlooks rvt-ifc --observation: that option enters the separate writer at src/bin/rvt_ifc.rs:192-199, while the only rvt-ifc invocation in this contract test uses --diagnostics. Consequently, incompatible changes to the witness-observation envelope can pass this suite despite its published schema; add a tier-1 invocation with --observation and --artifact-id, then validate the resulting file against witness-observation.schema.json.
Useful? React with 👍 / 👎.
| env!("CARGO_BIN_EXE_rvt-corpus"), | ||
| &[ | ||
| std::ffi::OsStr::new("doctor"), | ||
| root.join("corpus").join("tier1").as_os_str(), |
There was a problem hiding this comment.
Exercise a doctor failure report
This invocation scans only the three valid tier-1 CFB fixtures, so every files[].failure remains null and none of the doctor_failure paths are exercised. A change to the non-null failure representation or its associated fields would therefore pass the new contract test; include an invalid direct input such as README.md and assert that the resulting failure record also validates against corpus-doctor.schema.json.
Useful? React with 👍 / 👎.
Summary
Every CLI that prints JSON now has a schema and a contract test that validates its output. The new schemas cover
rvt-elem-table,rvt-history(both shapes),rvt-analyze,rvt-inspect(report and error report) andrvt-ifc-compare.rvt-capabilities' existing schema is now checked against the CLI. Part of S2 in #873.Motivation
#873, S2. Twelve CLIs print JSON, and six had a schema the contract test checked. For the other six, a removed or retyped field broke nobody's test.
Changes
docs/schemas/{elem-table,history,analyze,inspect,ifc-compare}.schema.json, written from the output types (elem_table::{ElemRecord, ElemTableLayout, RecordFraming},object_graph::{DocumentHistory, StringRecord},rvt-analyze'sReport,rvt-inspect'sInspectReport/InspectErrorReport,ifc::compare::IfcCompareReport). Every field is listed, required where the type always serializes it, andOptionfields allownull.rvt-inspect'sexport_diagnosticsis validated separately againstexport-diagnostics.schema.json, because the in-test validator resolves only local refs.tests/json_schema_contracts.rs:tier1_report_clis_validate_against_their_schemasruns the six CLIs on the tier-1 project and on the committed synthetic IFC files, with no corpus needed.rvt-historyruns with--all-strings, since the syntheticGlobal/Latesthas no document history.rvt-history --jsonon the 2024 family and requires a non-empty history.docs/schemas/README.md: the producers table, what the contract test covers, and the capability-manifest note, which said it was checked only by serde round-trips.The in-test validator ignores
additionalProperties: false, so a new field never fails a contract. That is the compatible direction. Removing a field or changing its type does fail.Testing
tools/check-local.sh: not run locally. CI's Linux test job runsjson_schema_contractswith the family corpus (RVT_REQUIRE_CORPUS=1).corpus/tier1/architectural-2024/architectural-2024.rvt,tests/fixtures/synthetic-*.ifcand the 2024 family, in this PR's run.Audit-honesty checklist
Legal and contribution hygiene