Skip to content

fix: build the observed estate with the caller's parameters (#1483) - #1486

Merged
lex00 merged 1 commit into
mainfrom
fix/live-graph-build-params
Aug 4, 2026
Merged

lex00 merged 1 commit into
mainfrom
fix/live-graph-build-params

Conversation

@lex00

@lex00 lex00 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #1483.

chant graph --live builds the source to learn which entities to observe, and did it on default parameters (handlers/graph.ts:147). The declared overlay built beside it resolves the caller's (:307). So the two halves of an overlay came from different parameters.

// live path — no params
const buildResult = await build(resolve(args.src ?? config.sourceDir ?? "."), plugins.map((p) => p.serializer));

// declared/non-live path — params, since #1359
const buildParams = await graphBuildParams(ctx, projectPath);
const result = await discover(projectPath, { buildParams });

Why it is worse than a missing lens

For a project whose parameters choose which resources exist — a tier, a size, a profile — every resource the real parameter declares is absent from the observation and reads as not deployed, and every resource the default declares is observed against nothing and reads as pending. The overlay is confidently wrong rather than empty.

Found in kubemicrovm-ops, whose minimal tier declares a bare MicroVM and whose prod-ha declares a MicroVMReplicaSet, MicroVMClass and MicroVMNetwork instead. A fully converged prod-ha estate — image SUCCESSFUL, connector ACTIVE, readyReplicas at the floor — overlaid as four unobserved Kubernetes resources, because it was compared against minimal's declarations.

The stderr ordering is the tell: at KMV_TIER=prod-ha the not-observed warnings name image, operatorNs, vm, workloadNs — minimal's entity set, vm and not replicaSet — and [param] tier = "prod-ha" (env) prints afterwards, from the declared pass.

The change

build() already forwards options.buildParams to discover, so this is the resolution the non-live path has done since #1359, moved ahead of the call that needed it too. Same graphBuildParams helper, same early return on an unresolvable parameter.

Verified against kubemicrovm-ops with the patch applied to an installed 0.38:

before   tier=minimal -> 11 nodes    tier=prod-ha -> 11 nodes
after    tier=minimal -> 11 nodes    tier=prod-ha -> 13 nodes
                                     (+ MicroVMReplicaSet, MicroVMClass, MicroVMNetwork)

Tests

Two regression tests under live graph (--live), mirroring the #1359 pair that covers the non-live path. The build mock now forwards its arguments so a test can assert what was passed, the same reason discover's already does.

Confirmed non-vacuous — with the source change reverted, both fail:

Tests  2 failed | 39 passed (41)     <- fix reverted
Tests  41 passed (41)                <- fix applied

tsconfig.typecheck.json reports 755 errors before and after this change, all pre-existing in examples/; none in handlers/graph.ts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XsCknJvqegvVkB9WKUeBgG

`chant graph --live` builds the source to learn which entities to observe, and
did it on default parameters. The declared overlay built beside it resolves the
caller's. So the two halves of an overlay came from different parameters.

For a project whose parameters choose which resources *exist* — a tier, a size,
a profile — that is not a near miss. Every resource the real parameter declares
is absent from the observation and reads as not deployed; every resource the
default declares is observed against nothing and reads as pending. The overlay
is confidently wrong rather than empty, which is the worse of the two.

Found in kubemicrovm-ops, whose `minimal` tier declares a bare MicroVM and
whose `prod-ha` declares a replica set, a class and a network connector
instead. A converged prod-ha estate — image SUCCESSFUL, connector ACTIVE,
readyReplicas at the floor — overlaid as four unobserved Kubernetes resources,
because it was being compared against minimal's declarations.

The stderr ordering was what gave it away: at KMV_TIER=prod-ha the not-observed
warnings name minimal's entity set, and `[param] tier = "prod-ha" (env)` prints
afterwards from the declared pass.

`build()` already forwards `options.buildParams` to `discover`, so this is the
resolution the non-live path has done since #1359, moved ahead of the call that
needed it too.

    before   tier=minimal -> 11 nodes    tier=prod-ha -> 11 nodes
    after    tier=minimal -> 11 nodes    tier=prod-ha -> 13 nodes

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsCknJvqegvVkB9WKUeBgG
@lex00
lex00 merged commit 045d951 into main Aug 4, 2026
5 checks passed
@lex00
lex00 deleted the fix/live-graph-build-params branch August 4, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chant graph --live --overlay ignores build params, so a tier lens is dead under the overlay

1 participant