@intentius/chant-lexicon-azure 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,13 +38,30 @@ describe("compareApiDates", () => {
38
38
 
39
39
  describe("latestVersionPerProvider", () => {
40
40
  it("picks the latest API version per provider", () => {
41
+ // Providers with no PROVIDER_VERSION_OVERRIDES entry — Microsoft.Compute
42
+ // and Microsoft.Authorization are pinned (#1144, #223) and covered by
43
+ // their own describe block below.
41
44
  const paths = [
42
45
  "schemas/2022-01-01/Microsoft.Storage.json",
43
46
  "schemas/2023-06-01/Microsoft.Storage.json",
44
- "schemas/2023-01-01/Microsoft.Compute.json",
47
+ "schemas/2023-01-01/Microsoft.Network.json",
45
48
  ];
46
49
  const result = latestVersionPerProvider(paths);
47
50
  expect(result.get("Microsoft.Storage")?.apiVersion).toBe("2023-06-01");
48
- expect(result.get("Microsoft.Compute")?.apiVersion).toBe("2023-01-01");
51
+ expect(result.get("Microsoft.Network")?.apiVersion).toBe("2023-01-01");
52
+ });
53
+ });
54
+
55
+ describe("PROVIDER_VERSION_OVERRIDES", () => {
56
+ it("pins Microsoft.Compute to the last date with the virtualMachines family (#1144)", () => {
57
+ const paths = [
58
+ "schemas/2025-11-01/Microsoft.Compute.json",
59
+ "schemas/2026-03-01/Microsoft.Compute.json",
60
+ "schemas/2026-03-02/Microsoft.Compute.json",
61
+ ];
62
+ const result = latestVersionPerProvider(paths);
63
+ // 2026-03-02 is the naive "latest by date" but drops virtualMachines
64
+ // (a disk-only delta); the override keeps 2026-03-01 instead.
65
+ expect(result.get("Microsoft.Compute")?.apiVersion).toBe("2026-03-01");
49
66
  });
50
67
  });
@@ -53,9 +53,21 @@ export function parseSchemaPath(
53
53
  * includes the plain `roleAssignments` / `roleDefinitions` resources; they live
54
54
  * in 2022-04-01, the latest stable that still has them. Pin it so those
55
55
  * generate (the naming table maps both). See #223.
56
+ *
57
+ * Microsoft.Compute has the same issue (#1144): at the schema commit pinned
58
+ * in ../spec/fetch.ts, the newest dated `Microsoft.Compute.json` (2026-03-02)
59
+ * is a narrow disk-only delta that drops `virtualMachines`,
60
+ * `virtualMachineScaleSets`, and `availabilitySets` entirely — not a rename,
61
+ * an omission, since Azure alternates between a "VM flavor" and a "disk
62
+ * flavor" of this file across dates rather than publishing one cumulative
63
+ * file. 2026-03-01 is the most recent date that still has the VM family
64
+ * (validate.ts's REQUIRED_NAMES and composites/vm-linux.ts depend on it);
65
+ * it drops the disk-only resources (disks, diskAccesses, diskEncryptionSets,
66
+ * snapshots), which nothing here currently references.
56
67
  */
57
68
  export const PROVIDER_VERSION_OVERRIDES: Record<string, string> = {
58
69
  "Microsoft.Authorization": "2022-04-01",
70
+ "Microsoft.Compute": "2026-03-01",
59
71
  };
60
72
 
61
73
  /**
package/src/spec/fetch.ts CHANGED
@@ -69,10 +69,42 @@ export interface ArmSchemaDefinition {
69
69
  items?: ArmSchemaProperty;
70
70
  }
71
71
 
72
- const TARBALL_URL =
73
- "https://github.com/Azure/azure-resource-manager-schemas/archive/refs/heads/main.tar.gz";
72
+ /**
73
+ * Pinned commit of Azure/azure-resource-manager-schemas (#1144).
74
+ *
75
+ * The repo has no tagged releases, so unlike gcp (`KCC_VERSION`) or k8s
76
+ * (`K8S_SCHEMA_VERSION`) there is no version tag to pin against — codegen
77
+ * used to fetch `refs/heads/main` directly. That meant a cold cache picked
78
+ * up whatever upstream state had landed since the cache last expired, while
79
+ * a warm cache kept serving whatever was current when it was last filled.
80
+ * Azure republishes per-provider schema files under new dates constantly,
81
+ * and a later date can drop resources an earlier one defined (see
82
+ * PROVIDER_VERSION_OVERRIDES in ./api-versions.ts) — so which resources
83
+ * even exist to generate depends on exactly when you fetch, not just what
84
+ * the fetch URL happens to be. That broke composites/vm-linux.ts at tsc
85
+ * nondeterministically, depending on which runner's cache was warm.
86
+ *
87
+ * Pinning to a commit SHA makes generation reproducible regardless of cache
88
+ * state. Bump policy: #523's scheduled lexicon-upgrade cron (rolling-spec
89
+ * bucket, sub-issue #526) is meant to propose bumps to this constant as a
90
+ * reviewable PR once built. Until then, bump by hand: take the current
91
+ * `main` HEAD sha from
92
+ * https://github.com/Azure/azure-resource-manager-schemas/commits/main,
93
+ * regenerate, fix up any composite left referencing a renamed or vanished
94
+ * export (adding a PROVIDER_VERSION_OVERRIDES entry if a resource dropped
95
+ * out of the naive "latest by date" pick), and update this constant +
96
+ * comment.
97
+ */
98
+ export const AZURE_SCHEMA_COMMIT = "0085cb6f3a98e735359807143bcb1667aeec930f";
99
+
100
+ const TARBALL_URL = `https://github.com/Azure/azure-resource-manager-schemas/archive/${AZURE_SCHEMA_COMMIT}.tar.gz`;
74
101
  const CACHE_DIR = join(homedir(), ".chant");
75
- const CACHE_FILE = join(CACHE_DIR, "azure-resource-manager-schemas.tar.gz");
102
+ // The cache filename embeds the pin so a stale tarball from before a bump
103
+ // can never mask the bump: restoring an old ~/.chant (e.g. a CI cache
104
+ // partial-key fallback, or a developer's pre-existing cache) simply misses
105
+ // this filename and re-downloads, instead of silently serving pre-bump
106
+ // schemas under a name that still matches (#1144).
107
+ const CACHE_FILE = join(CACHE_DIR, `azure-resource-manager-schemas-${AZURE_SCHEMA_COMMIT}.tar.gz`);
76
108
 
77
109
  /** Paths to skip (common-types, non-provider files). */
78
110
  function isProviderSchema(path: string): boolean {