Repository navigation
fix: a declared cluster binding is used, not policed against ambient (#1488) - #1507
Merged
Merged
Conversation
…1488) resolveClusterTarget resolved k8s.profiles.<env>.context but then compared it against the ambient kubectl context and refused on mismatch — so any k3d cluster another project created mid-session stole the current-context and turned a healthy estate grey, with `read-failed` as the only explanation from behold's seat. The normal state of a laptop with two projects on it, as #1488 puts it. The binding is a selection, not a check: when declared, the resolver now returns it unconditionally and every read/write passes it explicitly to the typed client. Ambient never enters the picture. A bound context the kubeconfig does not have still fails with an error naming the context and the k8s.profiles.<env>.context binding (the client's existing KubeConfigError) — never by falling back to ambient. ClusterBindingMismatchError stays exported: the resolver no longer throws it, but the kube/* read paths still catch it (a custom connector may throw it to get NOT-OBSERVED classification). Verified on fountain-ops, the reporting project, read-only with the ambient context deliberately left on the wrong cluster: before — statuses {"neutral":11}, refusal on stderr; after — statuses {"good":11,"runtime":4}, ambient untouched. Core 4026/4026; k8s suites green except the pre-existing #1476/#1419 local ungenerated-table failures, byte-identical on main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HDqbe9YwXqqpF7VxFp1Drx
lex00
added a commit
that referenced
this pull request
Aug 9, 2026
…ng block typechecks (#1488, #1455) (#1610) * fix(k8s): read failures name the cluster context they read (#1488) resolveClusterTarget stopped policing ambient in #1507 — a declared binding is used, not checked — but a read that still fails said nothing about which cluster it talked to. The reporting scenario: no binding declared, another project's k3d cluster steals the ambient context, and every declared resource goes grey with a bare read-failed. The typed client now stamps a context note onto every API and transport failure at construction — context name plus how it was selected — and classifyApiFailure appends it to the unobserved detail after the one-line cap, so it never truncates away. The connector supplies the selection story: 'bound by k8s.profiles.<env>.context', 'ambient; no k8s.profiles.<env> binding', or 'explicit --context'. Every read path (describeResources, deep observe, the runtime sweep, kube verbs, Op activities) classifies through the same seam, so none of them needed touching. Also retires the stale pre-#1507 doc comments that still described the ambient-mismatch refusal. * test(k8s): the cluster-binding block typechecks and its typos are rejected (#1455) The augmentation and schema #1455 asks for landed with #1405/#1344 — config.ts declares 'k8s' on ChantConfig, config-schema.ts is the runtime half, plugin.ts wires it as configSchema — but nothing proved the issue's reproduction compiles, and the k8s lexicon lacked the config-augmentation guard the forgejo lexicon carries. Port it: the reproduction verbatim under satisfies ChantConfig, plus schema cases for the failure the namespace most cares about — an unknown key ('profile', 'contxt') is rejected rather than silently leaving the environment unbound, which is exactly the wrong-cluster setup #1488 hit.
78 of 84 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolveClusterTarget resolved k8s.profiles..context but then compared
it against the ambient kubectl context and refused on mismatch — so any
k3d cluster another project created mid-session stole the current-context
and turned a healthy estate grey, with
read-failedas the onlyexplanation from behold's seat. The normal state of a laptop with two
projects on it, as #1488 puts it.
The binding is a selection, not a check: when declared, the resolver now
returns it unconditionally and every read/write passes it explicitly to
the typed client. Ambient never enters the picture. A bound context the
kubeconfig does not have still fails with an error naming the context and
the k8s.profiles..context binding (the client's existing
KubeConfigError) — never by falling back to ambient.
ClusterBindingMismatchError stays exported: the resolver no longer throws
it, but the kube/* read paths still catch it (a custom connector may
throw it to get NOT-OBSERVED classification).
Verified on fountain-ops, the reporting project, read-only with the
ambient context deliberately left on the wrong cluster:
before — statuses {"neutral":11}, refusal on stderr;
after — statuses {"good":11,"runtime":4}, ambient untouched.
Core 4026/4026; k8s suites green except the pre-existing #1476/#1419
local ungenerated-table failures, byte-identical on main.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01HDqbe9YwXqqpF7VxFp1Drx