Skip to content

feat(loaderkit): ask the contract for the resource-kind set (TODO 3.1, leg 2 of 3) - #564

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/resource-kind-set
Nov 18, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/resource-kind-set

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

TODO.md 3.1, leg 2 of 3 (leg 1: spec#381; tracking: spec#380). The loader stops deriving its own copy of the #ResourceKind membership and asks the contract at every consult.

Before:

// loaderkit/parse.go:35
resourceKindSet  = sliceSet(spec.ResourceKinds)

Two independent derivations of one contract-owned list, in two modules, able to agree only by luck — and a copy taken at package init answers from the vocabulary it saw then. After: memberDisc and the deploy-body member scan call spec.ResourceKindSet(), and the copy is gone.

sliceSet stays standing. It has six other callers in this file (StepKeywords, DocDirectives, AuthoringVerbs, KindWords, the instrument modifiers) — only the resource-kind site moves. That is measured, not assumed: a body that promised to delete the helper would have been wrong, and the sweep caught it before a verdict did.

Scope: one behaviour change, four files, +49/−6. No pin bump — see the base note below.

How tested

The RED that matters, taken on this branch's base aec1d52 by restoring loaderkit/parse.go to its pre-change form so the loader holds its own copy again:

$ git checkout origin/main -- loaderkit/parse.go
$ go test -run 'TestMemberDiscTracksTheVocabulary' -count=1 ./loaderkit/ 2>&1 | sed 's|^|RED |'
RED --- FAIL: TestMemberDiscTracksTheVocabulary (0.00s)
RED     resource_kind_live_test.go:31: memberDisc does not see a word the composed schema now declares: the loader answers from a snapshot taken at package init, so its verdict can disagree with spec.ResourceKindSet()
RED FAIL
RED FAIL	github.com/opencharly/sdk/loaderkit	0.008s
$ git checkout HEAD -- loaderkit/parse.go     # restored; git status empty

GREEN on the restored tree:

$ go test -run 'TestMemberDiscTracksTheVocabulary' -v -count=1 ./loaderkit/
=== RUN   TestMemberDiscTracksTheVocabulary
--- PASS: TestMemberDiscTracksTheVocabulary (0.00s)
ok  	github.com/opencharly/sdk/loaderkit	0.008s

The test makes spec.ResourceKinds move and then asks the parse: a loader holding a snapshot fails, a loader asking the contract passes. The observable is divergence, not compilation — an earlier undefined: spec.ResourceKindSet failure was available on an un-bumped tree and was deliberately refused, because it proves only that a symbol is missing.

The second consult site (loaderkit/parse.go:238, the deploy-body member scan) carries no separate test, and does not need one to be forced: resourceKindSet no longer exists as a symbol, so a revert to a snapshot at that site is a compile error rather than a silent regression. The compile-time deletion is what makes that site safe; the test guards the site where a snapshot could be re-introduced without a compile error — the classification helper.

The module gate, on the committed tree:

$ gofmt -l .      gofmt_rc=0
$ go build ./...  build_rc=0
$ go vet ./...    vet_rc=0
$ go test ./...   test_rc=0
$ GOTOOLCHAIN=go1.26.8 golangci-lint run ./loaderkit/...
0 issues.

The linter runs under go1.26.8 because the local go is 1.27.3, whose export-data version the pinned golangci-lint v2.13.2 cannot read — the environment mismatch sdk/AGENTS.md records.

No bed, and the negative is proven rather than asserted — a Contract/library module has no bed class:

$ git -C sdk grep -nE '^[[:space:]]*disposable:' origin/main -- '*.yml' '*.yaml'
$ echo $?
1

The base moved, deliberately

This branch was rebased from 8de8a57b (the head of sdk#561, which carried the spec v0.2026322.1616 bump) onto aec1d52, because #561 was CLOSED as a policy action while its content landed through #563 and the deploykit fix. Its two commits are now redundant, so they are dropped rather than inherited — which is why this diff is one behaviour change and not a pin bump. It waited on a tag that will never exist; the premise was re-measured at the new tip rather than assumed:

$ git -C sdk rev-parse --short origin/main
aec1d52
$ git -C sdk show origin/main:go.mod | grep 'opencharly/spec '
	github.com/opencharly/spec v0.2026322.1814
$ git -C spec show v0.2026322.1814:spec/vocab_set.go | grep -c 'func ResourceKindSet'
1
$ git -C sdk grep -n 'resourceKindSet' origin/main -- loaderkit/parse.go
loaderkit/parse.go:35:	resourceKindSet  = sliceSet(spec.ResourceKinds)
loaderkit/parse.go:64:	return resourceKindSet[word] || …
loaderkit/parse.go:238:	if t.DeploySubstrates[disc] || resourceKindSet[disc] {

spec.ResourceKindSet exists at the pin sdk already requires, and the copy was still standing at the tip — both measured above. Note that a squash merge has no ancestry — merge-base --is-ancestor would answer false even where the tag carries the work — so the pin was verified by the tree and the subject, not the graph.

Rulebook compliance

  • R0 — /charly-internals:go and /charly-internals:git-workflow loaded before any git action; sdk/AGENTS.md read (Part II fix(kit): aur builder fails loudly on zero produced packages (R8) #4) including its DESIGN.md section.
  • R1 — an anomaly was raised and filed, not absorbed: sdk#560 carries the RCA for spec#379's un-swept acme_email deletion (six reader sites across kit/ and deploykit/), which is why this leg waited rather than bumping through it. Every reader in this change's own scope was swept by name and by pathspec below, and the sliceSet sweep is what stopped the body from promising a deletion it could not deliver.
  • R2 — this PR is the R2 fix at its own site: one derivation for the resource-kind question, in the contract, replacing the loader's private copy. The remaining sliceSet callers are a different question (sdk#560-adjacent, not this change), and the helper is left standing because deleting it would break six legitimate uses.
  • R3 — no workaround: no cached snapshot kept "for speed", no fallback to the old set, no fixture edited, no environment branch. Per-call derivation is the point — a cached set handed to consumers is the shared-mutable-state shape the contract accessor was built to avoid.
  • R4 — no documented command changes; the parse now asks the source of truth it already claimed to follow.
  • R5 — nothing legacy kept: the package-level resourceKindSet is deleted, and the two comments that located it were corrected to name the contract accessor — the reason moved, not vanished, so the next reader inherits the argument rather than a gap.
  • R6 — git status read before each move (clean before the rebase, empty after the RED restore); feat/resource-kind-set in a session worktree, tracked sdk/ untouched; no force-push (the branch was never pushed), no bypass. The rebase was a deliberate re-branch onto aec1d52 on an unpushed branch, which is legal authoring.
  • R7 — the RED is pasted above and fails on this change's own subject; the GREEN executes the changed path on the committed tree; the emitted-artifact side is the contract's generated vocabulary, which this PR does not touch.
  • R8 — no live service crossed; nothing mocked.
  • R9 — no binary built or shipped by this module; its own Go gates are pasted.
  • R10 — Contract/library class: the gate is this module's committed CI, run in full above; the anchored disposable: grep shows no bed can exist here.

Consumers swept (the acme_email deletion this leg rides past)

spec#379 deleted the field; the reader sweep below is the evidence that sdk is now clean of it and that charly never read it. The pin is v0.2026322.1814:

$ git -C sdk grep -c -F 'AcmeEmail' origin/main -- '*.go'
1
$ git -C sdk grep -n -F 'AcmeEmail' origin/main -- '*.go'
deploykit/capabilities.go:128:// never round-trip through OCI labels. (`AcmeEmail` was on this list until
$ git -C charly grep -c -F 'AcmeEmail' origin/main -- '*.go'
0
$ git -C spec grep -c -F 'acme_email' v0.2026322.1814 -- '*.cue'
0

One site survives and it is prose — a comment recording that AcmeEmail was on the label list until spec#379 removed it. No reader, no fixture, no map entry: the six live sites this leg would otherwise have inherited (kit/checkvars.go, kit/checkvars_test.go, deploykit/deploy_file.go, deploykit/capabilities.go's CapabilityLabelMap) were adapted in #563 and its deploykit sibling, and #560 carries the RCA.

The consumer-side fix is a fallback being executed. spec deleted the field, tagged it, and the consumer one workspace away was never swept. The ordering cost was one merge rather than one round only because the sweep ran late rather than never — and a producer's deletion is proven before its TAG, not before its merge, because after the tag every consumer inherits the break.

Filed issues

  • sdk#560 — RCA for spec#379's un-swept acme_email deletion: six reader sites across kit/ and deploykit/, which is why this leg waited on a green bumped tree instead of bumping through the break itself. The readers were adapted in #563 and its deploykit sibling; this PR carries neither the bump nor the adaptation.

Change classification

Kind: behaviour inside one module. The parse's resource-kind verdict now comes from the contract at consult time instead of from a package-init snapshot; any vocabulary the contract declares is visible to the parse immediately, which is the behaviour the contract always claimed. No wire key, no authored shape and no exported API changes here. Nothing breaks for consumers: spec.ResourceKindSet() already exists at the pin this repo requires, and the deleted symbol was unexported. Rollback: revert this commit — the loader returns to its private copy, which still compiles against the current pin.

Files changed

file what changed
loaderkit/parse.go +6/−3: the package-level resourceKindSet copy deleted; memberDisc and the deploy-body member scan ask spec.ResourceKindSet()
loaderkit/deploy_decode.go +3/−2: the comment that located the set in parse.go now names the contract accessor — the reason moved, not deleted
loaderkit/node_tree.go +1/−1: same, for the member-filter comment
loaderkit/resource_kind_live_test.go new, 39 lines: the divergence RED — move spec.ResourceKinds, ask the parse, with a control that an undeclared word stays out

Agent: audit-parse
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

…, leg 2 of 3)

The loader derived its own copy of the #ResourceKind membership at package init:

  resourceKindSet = sliceSet(spec.ResourceKinds)

so the parse and the contract held two independent derivations of one list that could
only agree by luck. The parse now asks spec.ResourceKindSet() at every consult
(memberDisc and the deploy-body member scan), and the copy is gone. sliceSet stays
standing for its six other callers; only the resource-kind site moves.

RED-first, on the right claim. The test makes spec.ResourceKinds MOVE and asks the
parse, so it fails while the loader answers from its own copy and passes only when the
verdict comes from the contract:

  memberDisc does not see a word the composed schema now declares: the loader answers
  from a snapshot taken at package init, so its verdict can disagree with
  spec.ResourceKindSet()

The observable is divergence, not compilation. The earlier `undefined: ResourceKindSet`
failure available on an un-bumped tree was refused for exactly that reason: it proves a
symbol is missing, not that the two derivations can disagree.

Base moved during the wait, deliberately and for a measured reason: this branch was
rebased from sdk#561's head (8de8a57, carrying the spec v0.2026322.1616 bump) onto
aec1d52, because #561 was CLOSED as a policy action while its content landed through
#563 and the deploykit fix. The redundant commits are dropped rather than inherited,
which is why the diff is one behaviour change and not a pin bump. Premise re-measured at
the new tip (spec v0.2026322.1814 carries spec.ResourceKindSet; loaderkit/parse.go:35
still held its own copy), not assumed.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 1ae2ad1f8aa4cf67205604a0a60e8383de845ffd (branch: feat/resource-kind-set)

Change class: behaviour change inside a library module (sdk/loaderkit) — no runtime bed; the module go test gate is the correct class gate, and the body's anchored disposable: grep is internally consistent with a Contract/library module.

Security screen: PASS — no secrets, no egress, no guardrail weakening; the two comment edits and the resourceKindSet→spec.ResourceKindSet() substitution are scoped to the stated change.

Blocks

  1. A1 — body omits the required ## Filed issues section. The body's R1 answer states an anomaly was "raised and filed, not absorbed: sdk#560 carries the RCA for spec#379's un-swept acme_email deletion" — i.e. R1 filed sdk#560 for a non-blocking finding (the six reader sites were adapted in #563, so the finding is separable/non-blocking for this PR). A1 requires a ## Filed issues section listing each filed issue as <repo>#<n> with a one-line description whenever R1 filed/updated one; the body mentions #560 only in prose and never under the required heading. Add:

    ## Filed issues
    - sdk#560 — RCA for spec#379's un-swept acme_email deletion (readers adapted in #563)
    

Non-blocking note (rulebook gap, not a block): the new divergence test TestMemberDiscTracksTheVocabulary exercises only memberDisc; the second consult site at loaderkit/parse.go:238 (the deploy-body member scan) has no test that would fail if it reverted to a snapshot. The deletion of resourceKindSet forces the substitution at compile time, so this is a coverage-strength note rather than a surviving defect.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 1ae2ad1f8aa4cf67205604a0a60e8383de845ffd (branch: feat/resource-kind-set)

Change class: behaviour change inside a library module (sdk/loaderkit) — module go test is the correct class gate; the anchored disposable: grep is internally consistent with a Contract/library module having no bed class.

Blocks

  1. A1 — the Summary of changes misstates the diff and contradicts itself. The "Files changed" table lists loaderkit/parse.go as +9/−3, but the file's actual diff is +6/−3 (one deleted resourceKindSet line, two one-line spec.ResourceKindSet() substitutions, and a four-line comment block = +6/−3, exactly the ### FILE: … +6/-3 header). This also contradicts the body's own Scope: +49/−6 line: the table's rows sum to +52/−6 (9+3+1+39), not +49. Correct the parse.go row to +6/−3 so the table reconciles with the diff and with the stated +49/−6 total.

Comment disposition

  • Comment 6988023520 (@github-actions[bot]) — A1 "body omits the required ## Filed issues section": stale-superseded. The CURRENT body carries a ## Filed issues section naming sdk#560 with a one-line description ("RCA for spec#379's un-swept acme_email deletion"). The prior finding does not reproduce against the current state.
  • Same comment — non-blocking note that the second consult site (parse.go:238) has no behavioral test: verified-non-blocking. The diff confirms resourceKindSet is deleted, so a revert to a snapshot at that site is a compile error rather than a silent regression; the divergence test guards the site (memberDisc) where a snapshot could be re-introduced without a compile error. Coverage-strength note only, not a surviving defect.

Non-blocking note (rulebook gap): the new test exercises only memberDisc; the deploy-body member scan at parse.go:238 relies on the compile guard rather than a behavioral assertion. This is acceptable here but is not a rulebook-stated requirement, so it is recorded as a gap, not a block.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 1ae2ad1f8aa4cf67205604a0a60e8383de845ffd (branch: feat/resource-kind-set)

Security screen: PASS — T1–T4 clear: no scope mismatch, no secrets/egress, no guardrail weakening, no new deps; the four-file change is exactly the stated resourceKindSet→spec.ResourceKindSet() substitution plus comment alignment and one test.
Checklist: All applicable rules PASS or NA. Change class is a library-module behaviour change (no bed class; the anchored disposable: grep is internally consistent). Placement: CORRECT (the vocabulary belongs to spec; loaderkit is the consumer, so asking the contract at consult time is the right layer). The new divergence test executes the changed path and would fail on the pre-change tree, justifying fully tested and validated.

Comment dispositions:

  • 6988023520 (@github-actions[bot]) — "A1: body omits ## Filed issues": stale-superseded. The CURRENT body carries a ## Filed issues section naming sdk#560 with a one-line description; the finding does not reproduce.
  • 6988152510 (@github-actions[bot]) — "A1: table lists parse.go as +9/−3 / total +52/−6": stale-superseded. The CURRENT body lists parse.go as +6/−3 and Scope as +49/−6, and the rows (6+3+1+39 = 49, 3+2+1 = 6) reconcile exactly with the per-file diff headers.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 18, 2026 18:53
@github-actions
github-actions Bot merged commit e865228 into main Nov 18, 2026
12 of 14 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 18, 2026
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.

1 participant