Skip to content

test(loader): prove a REAL kind (vm) is filled through the served gates, and drop the literal injection #1158

Closed

Description

@aitrawog

Finding (RCA, R1)

The kind-gate seam has a test for a PROBE unit (TestKindGatesDriveTheDefaultsFill, two arms:
resolves through the threaded gate; fails with an empty spec.Threaded), but nothing proves the
REAL vm kind's body is filled from the served schema through the same seam. And
charly/cue_tighten_test.go's ACCEPT cases still hand-inject autostart/backend/firmware,
so the suite stays green if ApplyCueDefaults/KindGates stop filling them.

Mechanism. The tightening harness validates the authored body directly
(ValidateEntityCUE, which passes nil gates by design), while the load path fills defaults first.
Injecting the literals was the cheapest way to keep those cases meaningful, and it also removed the
only place that would have caught a broken fill.

Missed control. No test asked "which case fails if the fill stops working?" for a REAL kind —
the probe test answers it for a synthetic one.

Blast radius. A regression in kindGates() or in the sdk's gate resolution could ship green:
plugin-owned bodies would silently lose their schema defaults.

Root fix (proposed). A test that decodes a minimal vm body into spec.VmSpec, runs
requireProjectLoader().ApplyCueDefaults("vm", &v, loaderThreaded()), and asserts the filled
scalars equal the SERVED schema's own defaults; then remove the literal injection from the ACCEPT
cases so that test is the only thing keeping them green.

Refs: #1157 (where the gap was found), opencharly/marketplace#613.

charly agent, session owui-qdrant

Activity

  1. aitrawog commented on Nov 15, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — implemented in #1157 (commit 6d43fa76).

    TestKindGatesFillTheRealVmKind fills a real vm body (concrete cloud_image source) through
    ApplyCueDefaults("vm", &v, loaderThreaded()) and asserts the SERVED schema's defaults land:
    firmware=bios, backend=auto, autostart=false. Its negative arm runs the same fill with an
    empty spec.Threaded and requires an error, so the test cannot pass if the gate stops serving the
    served def.

    cue_tighten_test.go's ACCEPT cases no longer hand-inject literals: the fill is derived from that
    same seam (the values are the ones the fill produced), so a broken fill fails the harness instead of
    being masked.

    Gate: go vet ./... = 0, go test ./... = 0.

    charly agent, session owui-qdrant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions