@intentius/chant-lexicon-k8s 0.41.17 → 0.41.18

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "579bf4095e47e58c245aa6e2531cabeaf1b6b558a25a5e1090810d9bf31f2675",
4
+ "manifest.json": "c2f3553d27f37ccedf78b608acf76ee427dcd03bdc832f0a9ffbb4da78ff9bd9",
5
5
  "meta.json": "c0b141b882c51483c1d1aead748a0eb171aceca7432edd2a0404b062bf6d7831",
6
6
  "types/index.d.ts": "3be2af7494aca94adfa16269cb9c4e7a155529872207a3d70b0c4d39914f9eec",
7
7
  "rules/argo-appset-single-project.ts": "afa9f310753aa2d475f35012b13135b2dfaebed2a35d44edbe185ebc07673674",
@@ -50,5 +50,5 @@
50
50
  "skills/chant-k8s-aks.md": "e18f0e2b055f72cd7a37deaf258d7027c2d4d3e286e8fd4975b27a1f981a3ad9",
51
51
  "skills/chant-k8s-argo.md": "b1a0b826559d8c5033a479c5781efaf650320f0aee4419d8841170bd3393cea5"
52
52
  },
53
- "composite": "d2f25a5b946a9065204fc9c38ac8a5c39417015120bbdaeee93c12c2597dc397"
53
+ "composite": "719807c3da16afea57ea7a7709cc29007e28cd3c8d7ab094c273794fa95fbb9e"
54
54
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k8s",
3
- "version": "0.41.17",
3
+ "version": "0.41.18",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "K8s",
6
6
  "intrinsics": [],
@@ -1 +1 @@
1
- {"version":3,"file":"kubectl.d.ts","sourceRoot":"","sources":["../../../src/op/activities/kubectl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAaH,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAI3E;;;;;GAKG;AACH,MAA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AE,CAAC;IACtB,sFAAsF;IACtF,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAiB7E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAEjF;AAqHD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,gBAAgB,EACtB,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,GAAE,YAAkC,GAC1C,OAAO,CAAC,mBAAmB,CAAC,CAkE9B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,gBAAgB,EACtB,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,GAAE,YAAkC,GAC1C,OAAO,CAAC,IAAI,CAAC,CAEf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-k8s",
3
- "version": "0.41.17",
3
+ "version": "0.41.18",
4
4
  "description": "Kubernetes lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -84,7 +84,7 @@
84
84
  },
85
85
  "peerDependencies": {
86
86
  "zod": "^4.3.6",
87
- "@intentius/chant": "^0.41.17",
87
+ "@intentius/chant": "^0.41.18",
88
88
  "typescript": "^5.9.3"
89
89
  }
90
90
  }
@@ -205,6 +205,39 @@ describe("kubectlApply", () => {
205
205
  expect(requests.map((r) => r.query.force)).toEqual(["false", "true", "false", "true"]);
206
206
  });
207
207
 
208
+ test("a controller echoing chant's marker label is retaken too — chant owns its reserved channel", async () => {
209
+ // An operator that reconciles whole objects becomes SSA owner of labels it
210
+ // merely echoed (observed live: kubemicrovm's microvmimagereconciler
211
+ // owning .metadata.labels.chant.intentius.io/stack). It never chose that
212
+ // value; the marker namespace is chant's.
213
+ const file = join(dir, "k8s.yaml");
214
+ writeFileSync(file, deploymentYaml);
215
+ const cluster = fakeCluster({
216
+ respond: (req) => {
217
+ if (req.method !== "PATCH") return undefined;
218
+ if (req.query.force === "true") return { body: JSON.parse(String(req.body)) };
219
+ return {
220
+ status: 409,
221
+ body: {
222
+ ...statusBody(409, "Conflict", 'Apply failed with 1 conflict: conflict with "microvmimagereconciler"'),
223
+ details: {
224
+ causes: [
225
+ {
226
+ type: "FieldManagerConflict",
227
+ message: 'conflict with "microvmimagereconciler"',
228
+ field: ".metadata.labels.chant.intentius.io/stack",
229
+ },
230
+ ],
231
+ },
232
+ },
233
+ };
234
+ },
235
+ });
236
+
237
+ const result = await applyManifest({ manifest: file, stack: "kmv-workload" }, undefined, cluster.connector);
238
+ expect(result.applied).toHaveLength(2);
239
+ });
240
+
208
241
  test("a conflict involving any FOREIGN manager still refuses — self-retake never widens", async () => {
209
242
  const file = join(dir, "k8s.yaml");
210
243
  writeFileSync(file, deploymentYaml);
@@ -200,20 +200,38 @@ async function resolveApplyIdentity(
200
200
  */
201
201
  interface ConflictErrorLike {
202
202
  name: string;
203
- conflicts?: Array<{ manager?: unknown }>;
203
+ conflicts?: Array<{ manager?: unknown; field?: unknown }>;
204
204
  }
205
205
 
206
+ /** chant's reserved label channel — the `chant.intentius.io/*` keys the
207
+ * ownership marker lives under, as a conflict-cause field-path prefix. */
208
+ const MARKER_FIELD_PREFIX = `.metadata.labels.${LABEL_OWNERSHIP_KEYS.stack.split("/")[0]}/`;
209
+
206
210
  /**
207
- * Is every contested field in this conflict owned by chant itself (under any
208
- * of its field managers — `chant` bare or `chant:<stack>`)? True means the
209
- * conflict is a self-migration, never a dispute with another tool.
211
+ * Is this conflict one chant may retake without a human? Two shapes qualify,
212
+ * per contested field:
213
+ *
214
+ * - the owning manager is chant itself (`chant` bare or `chant:<stack>`) —
215
+ * the ownership-stack → unit-stack migration, or a renamed deploy unit; or
216
+ * - the field lives in chant's OWN reserved label channel
217
+ * (`chant.intentius.io/*`). A controller that reconciles whole objects
218
+ * echoes existing labels and becomes their SSA owner as a side effect
219
+ * (observed live: kubemicrovm's `microvmimagereconciler` owning
220
+ * `.metadata.labels.chant.intentius.io/stack`) — it never chose that value,
221
+ * and chant is the authority for its marker namespace no matter who last
222
+ * echoed it.
223
+ *
224
+ * Any contested field outside both shapes — a spec field, an app label —
225
+ * keeps the presented refusal: that IS a dispute with another tool.
210
226
  */
211
227
  function isChantSelfConflict(err: unknown): boolean {
212
228
  const e = err as ConflictErrorLike;
213
229
  if (!e || e.name !== "FieldManagerConflictError" || !Array.isArray(e.conflicts) || e.conflicts.length === 0) return false;
214
- return e.conflicts.every(
215
- (c) => typeof c.manager === "string" && (c.manager === "chant" || c.manager.startsWith("chant:")),
216
- );
230
+ return e.conflicts.every((c) => {
231
+ const chantManager = typeof c.manager === "string" && (c.manager === "chant" || c.manager.startsWith("chant:"));
232
+ const markerField = typeof c.field === "string" && c.field.startsWith(MARKER_FIELD_PREFIX);
233
+ return chantManager || markerField;
234
+ });
217
235
  }
218
236
 
219
237
  /**