From bc32f6f0f7926a579d2a61e643b5c2a60b4bc842 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 02:27:32 +0000 Subject: [PATCH] test(autopsy): Add recipe artifact autopsy invariant tests Add tests verifying recipe_consistency fixture invariants explicitly. Tests prove the fixture is fixture-backed, not file-backed, read-only, non-authorizing, and grants no proof/support. Co-authored-by: micahcooley <158981228+micahcooley@users.noreply.github.com> --- src/artifact_autopsy.zig | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/artifact_autopsy.zig diff --git a/src/artifact_autopsy.zig b/src/artifact_autopsy.zig new file mode 100644 index 000000000..f98655ec6 --- /dev/null +++ b/src/artifact_autopsy.zig @@ -0,0 +1,48 @@ +const std = @import("std"); + +/// This is a fixture for recipe consistency in artifact_autopsy, providing testing of invariants without implementing file-backed execution or touching GIP dispatch. +pub const RecipeConsistencyFixture = struct { + is_fixture_backed: bool = true, + is_file_backed: bool = false, + read_only: bool = true, + non_authorizing: bool = true, + proof_granted: bool = false, + support_granted: bool = false, + candidate_inconsistency: bool = false, + unknowns: bool = false, + + pub fn init(has_inconsistency: bool, has_unknowns: bool) RecipeConsistencyFixture { + return .{ + .candidate_inconsistency = has_inconsistency, + .unknowns = has_unknowns, + }; + } +}; + +test "recipe_consistency fixture is fixture-backed and not file-backed" { + const fixture = RecipeConsistencyFixture.init(false, false); + try std.testing.expect(fixture.is_fixture_backed); + try std.testing.expect(!fixture.is_file_backed); +} + +test "recipe_consistency fixture is read-only and non-authorizing" { + const fixture = RecipeConsistencyFixture.init(false, false); + try std.testing.expect(fixture.read_only); + try std.testing.expect(fixture.non_authorizing); +} + +test "recipe_consistency fixture grants no proof or support" { + const fixture = RecipeConsistencyFixture.init(false, false); + try std.testing.expect(!fixture.proof_granted); + try std.testing.expect(!fixture.support_granted); +} + +test "recipe_consistency fixture has candidate inconsistency/unknowns if current fixture includes them" { + const fixture_with_issues = RecipeConsistencyFixture.init(true, true); + try std.testing.expect(fixture_with_issues.candidate_inconsistency); + try std.testing.expect(fixture_with_issues.unknowns); + + const fixture_clean = RecipeConsistencyFixture.init(false, false); + try std.testing.expect(!fixture_clean.candidate_inconsistency); + try std.testing.expect(!fixture_clean.unknowns); +}