Skip to content

Add SARIF wire-format regression tests for Artefact renames #397

Closed

Description

@coderabbitai

Summary

Add regression tests that protect the SARIF JSON wire names after the Rust API rename from Artifact to Artefact.

Rationale

The Rust fields now use artefact_location and artefacts, while the SARIF contract must continue to use artifactLocation and artifacts. Round-trip tests can pass when both serialization and deserialization use an incorrect renamed key. Empty collections also do not prove the serialized collection key.

Affected areas

  • crates/whitaker_sarif/src/model/location.rs
  • crates/whitaker_sarif/src/model/run.rs
  • crates/whitaker_sarif/src/builders/run_builder.rs
  • SARIF model and builder tests in crates/whitaker_sarif

Required changes

  • Serialize a PhysicalLocation with a non-empty artefact_location.
  • Assert that JSON contains artifactLocation and does not contain artefact_location.
  • Deserialize canonical JSON containing artifactLocation and assert that PhysicalLocation::artefact_location is populated.
  • Serialize a Run with a non-empty artefact collection, preferably through RunBuilder::with_artefact.
  • Assert that JSON contains artifacts and does not contain artefacts.
  • Deserialize canonical JSON containing artifacts.
  • Assert that RunBuilder::with_artefact stores the supplied artefact.

Acceptance criteria

  • Tests fail if either Serde rename is removed or changed.
  • Tests cover serialization and deserialization for populated location and run values.
  • Tests directly cover RunBuilder::with_artefact.

Backlinks

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtestingTest coverage, test infrastructure, and verification tooling work.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions