Skip to content

test(contracts): schemas for the six CLIs that print JSON without one, validated on the tier-1 fixtures (#873) - #912

Merged
DrunkOnJava merged 6 commits into
mainfrom
test/cli-json-schemas
Oct 23, 2026
Merged

DrunkOnJava merged 6 commits into
mainfrom
test/cli-json-schemas

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

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) and rvt-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's Report, rvt-inspect's InspectReport / InspectErrorReport, ifc::compare::IfcCompareReport). Every field is listed, required where the type always serializes it, and Option fields allow null. rvt-inspect's export_diagnostics is validated separately against export-diagnostics.schema.json, because the in-test validator resolves only local refs.
  • tests/json_schema_contracts.rs:
    • tier1_report_clis_validate_against_their_schemas runs the six CLIs on the tier-1 project and on the committed synthetic IFC files, with no corpus needed. rvt-history runs with --all-strings, since the synthetic Global/Latest has no document history.
    • The family-corpus test also checks rvt-history --json on the 2024 family and requires a non-empty history.
    • The schema-document check lists the new schemas.
  • 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 runs json_schema_contracts with the family corpus (RVT_REQUIRE_CORPUS=1).
  • End to end: the CLIs' real output on corpus/tier1/architectural-2024/architectural-2024.rvt, tests/fixtures/synthetic-*.ifc and the 2024 family, in this PR's run.
  • IFC exporter / performance: N/A.

Audit-honesty checklist

  • README / docs reflect the current state after this PR
  • No limitation resolved or introduced
  • Commit messages describe what and why
  • No emojis
  • No private paths, personal email addresses, or internal jargon in committed files
  • Reverse-engineering finding: N/A

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread tests/json_schema_contracts.rs Resolved
Comment thread docs/schemas/README.md Resolved
Comment thread docs/schemas/ifc-compare.schema.json Resolved
Comment thread docs/schemas/inspect.schema.json Resolved
Comment thread tests/json_schema_contracts.rs Resolved
Comment thread tests/json_schema_contracts.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/schemas/elem-table.schema.json Resolved
Comment thread docs/schemas/analyze.schema.json Resolved
…t contracts, the output schemas stay open to added fields, and the validator checks const, item counts and sibling refs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/schemas/README.md Resolved
Comment thread docs/schemas/inspect.schema.json Resolved
Comment thread tests/json_schema_contracts.rs Resolved
Comment thread tests/json_schema_contracts.rs Resolved
…s the constant 1, the validator checks minLength, and --all-strings must print string records

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread tests/json_schema_contracts.rs Resolved
Comment thread tests/json_schema_contracts.rs Resolved
Comment thread tests/json_schema_contracts.rs Resolved
Comment thread tests/json_schema_contracts.rs Resolved
…et contracts, and relation-domain entries a schema
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 23, 2026 15:21
DrunkOnJava added a commit that referenced this pull request Oct 23, 2026
…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.
@DrunkOnJava
DrunkOnJava merged commit 6c0a2ab into main Oct 23, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the test/cli-json-schemas branch October 23, 2026 16:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread docs/schemas/README.md
Comment on lines +40 to +41
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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