fix(catalog): digest provider projections

This commit is contained in:
morluto
2026-07-26 16:07:12 +00:00
parent 8ec9bb1bfe
commit c4cd0330e0
5 changed files with 43 additions and 4 deletions
+17
View File
@@ -44,6 +44,7 @@ import {
cliCommandDescriptionIssues,
cliCommandOptionNames,
createProductCatalog,
providerCatalogDigest,
serializeProductCatalog,
} from "../scripts/lib/product-catalog.mjs";
@@ -139,6 +140,9 @@ describe("canonical product catalog", () => {
"project_managed_application_graph",
"verify_managed_native_boundaries",
]);
expect(catalog.runtime_catalog.digests.providers_sha256).toBe(
providerCatalogDigest(catalog.providers),
);
expect(
z.toJSONSchema(analysisSnapshotSchema).properties?.snapshot_version,
).toMatchObject({
@@ -230,6 +234,19 @@ describe("canonical product catalog", () => {
);
});
it("changes the provider projection digest when provider facts drift", async () => {
const catalog = await createProductCatalog(root);
const firstProvider = catalog.providers[0];
if (firstProvider === undefined) throw new TypeError("Missing provider");
const driftedProviders = [
{ ...firstProvider, name: `${firstProvider.name} drifted` },
...catalog.providers.slice(1),
];
expect(providerCatalogDigest(driftedProviders)).not.toBe(
catalog.runtime_catalog.digests.providers_sha256,
);
});
it("fails check mode without rewriting a stale generated artifact", async () => {
const directory = await createTestTempDirectory("rea-generated-check-");
temporaryRoots.push(directory);