@intentius/chant 0.41.0 → 0.41.2

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.
Files changed (37) hide show
  1. package/dist/cli/build-params-cli.d.ts +24 -0
  2. package/dist/cli/build-params-cli.d.ts.map +1 -1
  3. package/dist/cli/handlers/components.d.ts.map +1 -1
  4. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  5. package/dist/components/capability-plugin.d.ts +16 -0
  6. package/dist/components/capability-plugin.d.ts.map +1 -1
  7. package/dist/components/cli-support.d.ts +5 -0
  8. package/dist/components/cli-support.d.ts.map +1 -1
  9. package/dist/components/deploy-units.d.ts +49 -0
  10. package/dist/components/deploy-units.d.ts.map +1 -0
  11. package/dist/components/starter-plugin.d.ts +1 -1
  12. package/dist/components/starter-plugin.d.ts.map +1 -1
  13. package/dist/config.d.ts +10 -0
  14. package/dist/config.d.ts.map +1 -1
  15. package/dist/graph-detail.d.ts +16 -0
  16. package/dist/graph-detail.d.ts.map +1 -1
  17. package/dist/kubectl-context.d.ts +22 -14
  18. package/dist/kubectl-context.d.ts.map +1 -1
  19. package/package.json +1 -1
  20. package/src/cli/build-params-cli.ts +35 -0
  21. package/src/cli/handlers/components.ts +29 -23
  22. package/src/cli/handlers/graph.test.ts +51 -1
  23. package/src/cli/handlers/graph.ts +40 -5
  24. package/src/cli/handlers/lifecycle.ts +18 -3
  25. package/src/components/capability-plugin.test.ts +21 -0
  26. package/src/components/capability-plugin.ts +33 -0
  27. package/src/components/cli-support.test.ts +17 -0
  28. package/src/components/cli-support.ts +11 -1
  29. package/src/components/deploy-units.test.ts +42 -0
  30. package/src/components/deploy-units.ts +82 -0
  31. package/src/components/starter-plugin.ts +4 -2
  32. package/src/config.test.ts +53 -0
  33. package/src/config.ts +41 -3
  34. package/src/graph-detail.test.ts +37 -1
  35. package/src/graph-detail.ts +28 -0
  36. package/src/kubectl-context.test.ts +16 -24
  37. package/src/kubectl-context.ts +22 -19
@@ -38,11 +38,13 @@ export interface K8sConfigShape {
38
38
  }
39
39
 
40
40
  /**
41
- * Thrown when an environment declares a cluster binding but the ambient
42
- * kubectl context disagrees with it. Refusing here instead of silently
43
- * observing whichever cluster is ambient — is the fix for #1100: a
44
- * wrong-cluster read reports every declared resource as missing, which #1089
45
- * then classifies as a confident (and wrong) list of `create` actions.
41
+ * Historically thrown when an environment declared a cluster binding but the
42
+ * ambient kubectl context disagreed with it (#1100/#1155). As of #1488 the
43
+ * resolver no longer polices ambient at all a declared binding is USED, not
44
+ * checked so {@link resolveClusterTarget} never throws this anymore. The
45
+ * class stays exported because the k8s lexicon's read/write paths still catch
46
+ * it (converting a refusal into NOT-OBSERVED), and a custom connector may
47
+ * still throw it to get that classification.
46
48
  */
47
49
  export class ClusterBindingMismatchError extends Error {
48
50
  constructor(
@@ -77,8 +79,11 @@ export interface ResolvedClusterTarget {
77
79
  * `kubectl config current-context`; the k8s lexicon's typed API client
78
80
  * (chant #1074) supplies one that reads the parsed kubeconfig instead, so a
79
81
  * client that never needs the `kubectl` binary does not acquire a dependency
80
- * on it just to check the binding. Both answer the same question, so the
81
- * refusal semantics below are identical either way.
82
+ * on it just to check the binding.
83
+ *
84
+ * As of #1488 the resolver itself no longer reads ambient (a declared binding
85
+ * is used directly), so this hook only matters to callers that surface the
86
+ * ambient context in their own messages.
82
87
  */
83
88
  export type AmbientContextReader = () => Promise<string | undefined>;
84
89
 
@@ -112,13 +117,16 @@ export interface ResolveClusterTargetOptions {
112
117
  * - No binding declared: returns `{ source: "ambient" }` — unchanged
113
118
  * behavior — but logs a visible warning identifying the caller and
114
119
  * environment, so the fallback is never silent (#1100 acceptance).
115
- * - Binding declared and the ambient context agrees (or ambient can't be
116
- * determined): returns `{ context: bound, source: "bound" }`. Callers
117
- * should pass this context explicitly on every kubectl invocation rather
118
- * than relying on it also being ambient.
119
- * - Binding declared and the ambient context disagrees: throws
120
- * {@link ClusterBindingMismatchError} a loud refusal instead of quietly
121
- * reading the wrong cluster.
120
+ * - Binding declared: returns `{ context: bound, source: "bound" }`,
121
+ * regardless of what is ambient (#1488). The declared binding is the
122
+ * selection, not a check: callers pass this context explicitly on every
123
+ * read and write, so whichever cluster `kubectl` happens to be pointed at
124
+ * is irrelevant. Any k3d cluster another project creates mid-session used
125
+ * to steal the ambient context and turn a healthy estate grey with
126
+ * `read-failed` as the only explanation; now it cannot. A bound context
127
+ * that is absent from the kubeconfig fails downstream in the typed client
128
+ * with an error naming the context and the `k8s.profiles.<env>.context`
129
+ * binding — never by falling back to ambient.
122
130
  */
123
131
  export async function resolveClusterTarget(
124
132
  config: Record<string, unknown>,
@@ -141,11 +149,6 @@ export async function resolveClusterTarget(
141
149
  return { source: "ambient" };
142
150
  }
143
151
 
144
- const ambient = await (options.ambientContext ?? currentAmbientContext)();
145
- if (ambient && ambient !== bound) {
146
- throw new ClusterBindingMismatchError(environment, bound, ambient);
147
- }
148
-
149
152
  return { context: bound, source: "bound" };
150
153
  }
151
154