Repository navigation
feat(observe): carry the resolved query address per entity through the live wire - #1625
Merged
Merged
Conversation
…e live wire From behold#192: a Flux-deployed k8s project declares no metadata.namespace (the controller stamps targetNamespace at apply), so the live read scopes to the context's default namespace, finds nothing, and correctly reports absence — painting weeks-old running infrastructure pending. Every layer is spec-correct; the report cannot explain itself. The observation envelope now carries an optional queried map — the resolved address each read was issued against, keyed by entity name. Purely additive: classification still reads only resources/unobserved and the #1089 tri-state does not shift. The map is the only record an OBSERVED-ABSENT entity gets (absence is spelled 'in neither map'), and unobserved entries carry the address inline as UnobservedEntity.queried. - k8s-client grows pathFor(ref): the exact request path read() would GET, namespace defaulting made visible; undefined when discovery does not serve the kind. - The k8s reader resolves the address before each read and stamps it on every verdict; the observeEntities harness accepts queried on all three EntityObservation variants for the other native observers. - lifecycle diff --live --json emits resources.queried per lexicon and queried per unobserved row; the human report shows 'web [queried /apis/apps/v1/namespaces/default/deployments/web]' on missing and unobserved lines. lifecycle plan carries the same address per change-set entry (a create's address is the one the provider confirmed absent). - The #1610 context note now LEADS the unobserved detail instead of trailing it: consumers truncate a reason to its first line / ~160 chars, and a note appended after a long error vanished exactly when it mattered. Closes #1620
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.
Closes #1620 (from behold#192).
The failure shape
A Flux-deployed k8s project declares no
metadata.namespace— the controller stampsKustomization.spec.targetNamespaceat apply time. The live read scopes to the context's default namespace, finds nothing, and correctly reports absence, so behold paints weeks-old running infrastructure pending. Every layer behaves as specified; the picture still says the opposite of the truth. The missing piece is per-entity: what address was the cluster actually asked?The wire shape
One field name,
queried, at three depths — all optional, all additive over the #1089 tri-state (classification still reads onlyresources/unobserved; an entity inqueriedand neither map is still OBSERVED-ABSENT):ObservationResult.queried?: Record<string, string>— resolved query address per entity name. This side-map is deliberate: absence is spelled "in neither map", so an absent verdict has no row to hang diagnostics on — this is the only record it gets.UnobservedEntity.queried?: string— inline on not-observed entries (extending the existingdetail, not replacing it), so a row renders without a join.LiveDiffResult.queried?/UnobservedResource.queried?/ChangeSetEntry.queried?— the pass-throughs that reach consumers.The address is a single self-describing string rather than a k8s-shaped struct, because the failure generalizes: any substrate deriving its read address (endpoint override, region, account) has the same "looked in the wrong place ≠ not there" shape. k8s is the first implementer; lexicons omitting it stay valid, and the
observeEntitiesharness acceptsqueriedon all threeEntityObservationvariants for the other native observers.Where it surfaces
chant lifecycle diff --live --json, per lexicon:{ "resources": { "missing": ["web"], "queried": { "web": "/apis/apps/v1/namespaces/default/deployments/web" }, "unobserved": [ { "name": "api", "reason": "read-failed", "queried": "/api/v1/namespaces/default/services/api" } ] } }behold's inspect pane can render
queried: /apis/apps/v1/namespaces/default/deployments/web → 404next to the pending verdict. The human report printsweb [queried …]on missing/unobserved lines, andlifecycle plancarries the address per change-set entry (acreate's address is the one the provider confirmed absent).How k8s resolves it
@intentius/chant-k8s-clientgrowspathFor(ref): the exact request pathread()would GET — apiVersion/kind resolved against the cluster's own (cached) discovery, the namespace defaulted from the resolved context when the ref carries none,undefinedwhen discovery does not serve the kind. The reader resolves it before each read and stamps it on every verdict: present, absent, filtered, read-failed.Also: the #1610 context note now leads the detail
behold truncates a failure reason to its first line / 160 chars, and
detailOfappended thecontext "<name>" (<how selected>)note after a message capped at 200 — pushed out of the window exactly on the failures long enough to need it. The note now leads, the capped error follows; tests assert position and the 160-char window on a long multi-line error.Verification
pathForpath/scope/unknown-kind cases; context-note position.describeObservationConformanceuntouched and green across all lexicons.just build,npm run build -w @intentius/chant-lexicon-k8s,npm run build -w @intentius/chant-k8s-clientall clean.