Skip to content

fix(deploykit,packagekit): match a pinned package by bare name; parse a real candy charly.yml - #307

Merged
github-actions[bot] merged 2 commits into
mainfrom
fix/pkgname-bare-and-packaging-parse
Sep 26, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
fix/pkgname-bare-and-packaging-parse

Conversation

@aitrawog

@aitrawog aitrawog commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix two sdk defects exposed by pinning an exact version in a candy's
distro: <d>. package: list (name=version on pac/apt/apk,
name-<version>-<rel> on rpm) — the mechanism opencharly/layer-charly#10 adds so
an upstream package rebuild invalidates exactly the install layer.

1. deploykit.distroRepoProvidesPackage matched a pinned entry by exact string.
It compared the bare packaging.name (charly) against the package list with
slices.Contains. A pinned entry (charly=2026.268.1917) no longer matched, so
the localpkg-skip did not fire and the emitter produced a redundant, UNPINNED
second install
— defeating the pin it was meant to enforce. Measured on the
githubrunner box: without the pin, ONE install line; with the pin, TWO
(pacman -Syu --needed charly=2026.268.1917 + a pacman -U …/charly-${ARCH}.pkg.tar.zst
that pulls the latest). Match on the bare name via the ONE canonical strip
(buildkit.PkgName, R3) — the same helper the {{pkgName .}} render func uses.

2. packagekit.ParsePackaging could not parse a real candy charly.yml.
It decoded the whole document into a map[string]struct{…}; a real candy file
carries a top-level version: <calver> SCALAR, which fails that decode before
ever reaching the candy: body — so charly generate-packages errored on every
real candy. Its own test fixture hid this by nesting version: inside candy:.
Walk a yaml.Node so a top-level scalar is tolerated.

Both changes ship a unit test that FAILS without the fix; no exported API changes
beyond adding buildkit.PkgName (whose TemplateFuncs["pkgName"] behavior is
byte-identical). Five files total, all named above.

How tested

Each new test fails with the fix reverted (proof):

# Defect 1 — deploykit/install_build.go reverted to main, new test kept:
--- FAIL: TestDistroRepoProvidesPackage_MatchesPinnedVersion (0.00s)
    localpkg_test.go: distroRepoProvidesPackage with `charly=2026.268.1917` + repo = false, want true
    localpkg_test.go: distroRepoProvidesPackage with `charly-2026.268.1917-1` + repo = false, want true

# Defect 2 — packagekit/packaging.go reverted to main, new test kept:
--- FAIL: TestParsePackaging_TopLevelScalarVersion (0.00s)
    packaging_test.go: parse charly.yml: yaml: unmarshal errors:
        line 1: cannot unmarshal !!str `2026.26...` into struct { Candy struct { … } }

Real-file end-to-end (ParsePackaging against the actual layer-charly/charly.yml):
before — the exact unmarshal error above; after — OK name=charly.

Final module-CI gate on the final tree:

$ gofmt -l .        # empty
$ go vet ./...      # exit 0
$ go test ./...
ok  github.com/opencharly/sdk/buildkit
ok  github.com/opencharly/sdk/deploykit
ok  github.com/opencharly/sdk/kit
ok  github.com/opencharly/sdk/packagekit
… (every package ok)

Rulebook compliance

  • R1 — both defects root-caused with a live reproduction (real candy file) before fixing.
  • R2 — both in-scope occurrences fixed here; a same-mechanism consumer is layer-charly#10.
  • R3 — ONE strip implementation (buildkit.PkgName), reused by the template func and deploykit.
  • R5 — the old inline closure is removed, not shadowed.
  • R7 — each test fails without its fix (proof above).
  • R8 — the generated install plan is the validated artifact (one pinned line, no double-install).
  • R9 — the module-CI gate (gofmt/vet/test) is the whole gate for a contract module with no bed.

Change classification

  • Change class: contract/library module (github.com/opencharly/sdk) — no charly.yml, no deployable target, no disposable: true entity.
  • Verification gate: the repo's own committed module CI (gofmt -l . + go vet ./... + go test ./...) GREEN on this head; each new test fails without its fix.
  • Attribution tier: fully tested and validated — the module suite executed the changed paths and fails without them.

Cross-repo ordering

This sdk fix must land before opencharly/layer-charly#10, whose pin triggers the
defect; the consumer boundary is the githubrunner box build (distro-cachyos),
which this unblocks once charly carries the fix.

Assisted-by: OpenCode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

… a real candy charly.yml

Two defects exposed by pinning an exact version in a candy's
`distro: <d>. package:` (opencharly/layer-charly#10):

1. deploykit.distroRepoProvidesPackage compared the bare packaging.name
   against the package list with slices.Contains, so a pinned entry
   (`charly=2026.268.1917` pac/apt/apk, `charly-<ver>-<rel>` rpm) no
   longer matched and the localpkg-skip did not fire — emitting a
   redundant UNPINNED second install that defeats the pin. Match on the
   bare name via the ONE canonical strip (buildkit.PkgName, R3), the same
   helper the `{{pkgName .}}` render func uses.

2. packagekit.ParsePackaging decoded the whole document into a typed map,
   which fails on a real candy charly.yml's top-level `version:` scalar
   before reaching the candy body — so `charly generate-packages` errored
   on every real candy (its fixture hid this by nesting version:). Walk a
   yaml.Node so a top-level scalar is tolerated.

Both fix a unit test that fails without the change.

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

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 2aedf2ea3bf14efb97c22dba91615c18d59d8933 (branch: fix/pkgname-bare-and-packaging-parse)

Change class: contract/library module (github.com/opencharly/sdk) — the two code fixes themselves are clean (the PkgName extraction is byte-identical to the removed closure; packageListProvides reuses the one canonical strip; the yaml.Node walk correctly tolerates a top-level scalar and skips non-mapping values; both new tests exercise the changed paths).

Blocks

  1. A1 / T3 — undocumented file: kit/reverse_ops_merge_test.go (+3/-1). The body's Summary of changes, How tested, and Rulebook compliance sections account for buildkit/render.go, deploykit/install_build.go, deploykit/localpkg_test.go, packagekit/packaging.go, and packagekit/packaging_test.go — but never mention kit/reverse_ops_merge_test.go. That file's diff reformats the op := func(s string) spec.ReverseOp {…} literal inside TestMergeReverseOps from one line to three. Under A1 "a diff item missing from the body's accounting is a defect," and under T3 a file the summary never mentions is a description↔code scope mismatch. This is not a gofmt-required change (gofmt does not reflow a one-line function literal), so it is a gratuitous, unrelated edit to a test file the PR does not describe.
    Fix: either drop the unrelated cosmetic edit to kit/reverse_ops_merge_test.go, or add it to the Summary with its justification. As written the change does more than the body claims.

Verify (tool-limited, non-blocking)

  • deploykit/install_build.go: the diff removes the only visible slices.Contains(...) call but does not remove the slices import. If slices is now unused elsewhere in the file, the module will not compile and the body's pasted go vet ./... # exit 0 / go test ./... output would contradict the diff. I cannot re-run the build, so confirm slices still has a use in the file (or drop the import).

Comments

No comments on this PR (<comment_thread> empty) — nothing to adjudicate.

Verdict: BLOCK


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

View action run

…e go 1.26.4)

The one-line function literal in TestMergeReverseOps is reflowed by gofmt
1.27 but NOT by the gofmt of the module's declared toolchain (go 1.26.4,
which CI uses). It is not part of this change; revert it so the diff
carries only the two defects.

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

Copy link
Copy Markdown

Review — PASS

Head SHA: f5f8d12860489dd61825e0f4af47e194da6223d1 (branch: fix/pkgname-bare-and-packaging-parse)

Security screen: PASS (T1–T4 — no injected/embedded instructions, no secrets or egress, no guardrail/CI/branch-protection weakening, no supply-chain change; the only new import is the in-repo github.com/opencharly/sdk/buildkit).
Checklist: All applicable rules PASS or NA. Change class = contract/library module (github.com/opencharly/sdk); the module CI is the correct gate, and each new test executes a changed path (PkgName→packageListProvides, ParsePackaging) and fails without its fix. Placement: CORRECT (kind-blind reusable buildkit.PkgName mechanism, reused by the template func and deploykit — not a capability in core).
Comment disposition:

  • Comment 5849865324 (github-actions[bot], head 2aedf2ea…) — stale-superseded: its sole block (undocumented kit/reverse_ops_merge_test.go +3/-1) no longer reproduces — the CURRENT 5-file diff excludes that file (dropped by commit f5f8d1286048), and the body accounts for all five current files.
  • Same comment's tool-limited "verify" note (slices import possibly unused in deploykit/install_build.go) — verified-non-blocking: the diff leaves the slices import line untouched (only slices.Contains(...) at the call site changed), and the body's green go vet ./... is consistent with slices retaining another use; no diff↔output contradiction is confirmable.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 26, 2026 21:08
@github-actions
github-actions Bot merged commit 862022e into main Sep 26, 2026
5 of 6 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 26, 2026
@aitrawog
aitrawog deleted the fix/pkgname-bare-and-packaging-parse branch September 26, 2026 23:34
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