Repository navigation
fix(sdk): honor the NFPM_*_PASSPHRASE env vars in the struct-direct nFPM build path - #135
Conversation
…FPM build path The generate-packages plugin's CLI documents deb/rpm signing as "passphrase via NFPM_PASSPHRASE" (apk via NFPM_APK_PASSPHRASE, msix via NFPM_MSIX_PASSPHRASE), but packagekit.buildOne calls nfpm.WithDefaults (no env expansion), not nfpm.Parse (where nFPM reads the passphrase env vars). A passphrase-protected signing key therefore failed at package-build time with "key is encrypted but no passphrase was provided" — surfaced while validating the Phase 2 distro-repo workflows against the released plugin. applyPassphrases mirrors nFPM's Parse-time env expansion for the struct-direct path: the general NFPM_PASSPHRASE fills deb/rpm/apk, and the per-format NFPM_DEB/RPM/APK/MSIX_PASSPHRASE overrides it. TestApplyPassphrases asserts the precedence; end-to-end verified against the real passphrase-protected distro-repo GPG key (a .deb builds and embeds the _gpgorigin signature member). Assisted-by: Claude Code <deepseek-v4-flash:0731-cloud> (fully tested and validated)
pr-validator — CHANGES REQUESTED ❌Change class: charly/sdk Go (packagekit build path) Head SHA validated: The change itself is substantively correct — I verified Checklist
Comments considered: none (the PR carries no comments). Cross-PR interactions considered: none-found — sdk has only this PR open; charly #277 (fedora-gpg bump) and plugins #171 (docs) are unrelated to the sdk passphrase change. Decision: FAIL — not merged. The code is correct and all Go gates pass on my re-run, but the PR is not in full compliance:
Assisted-by: Claude Code deepseek-v4-flash:0731 (analysed on a live system) |
…ture Review-round fixes for the NFPM_*_PASSPHRASE change (pr-validator CHANGES REQUESTED): - Extract buildInfo (BuildInfo + applyPassphrases + WithDefaults) as the seam buildOne uses, and add TestBuildOneAppliesPassphrases which fails if the applyPassphrases call is removed from the build path (mutation-verified). - Set Maintainer in the testPackaging() fixture so the deb/ipk packagers no longer emit the nFPM DEPRECATION WARNING in the gate output. Assisted-by: Claude Code <deepseek-v4-flash:0731-cloud> (analysed on a live system)
pr-validator — APPROVED ✅Change class: charly-or-sdk Go ( Head SHA validated: This is a RE-VALIDATION. The prior validator's CHANGES REQUESTED (on head Checklist
Phase 1b (documentation scrutiny): not applicable — the diff touches no reader-facing narrative page (Go source + a CHANGELOG entry only; no README/VISION/SKILL.md/docs-site page). The standing question — "what surface does this change touch that no gate's scope includes?" — is the real-GPG-key signing behavior itself: the e2e evidence is the author's retained output (the throwaway test needs a real key at fixed /tmp paths and is not CI-suitable), and the retained wiring test covers the seam. The tier is capped at Comments considered:
Cross-PR interactions considered:
Decision: PASS — the change is in full compliance. The code is correct (nFPM precedence faithfully mirrored, call ordering safe), all Go gates re-run green at zero warnings, the retained wiring test is mutation-verified to fail without the change, the PR body follows the template with pasted evidence, and the attribution tier is correctly capped at Assisted-by: Claude Code deepseek-v4-flash:0731 (analysed on a live system) |
Assisted-by: Claude Code <deepseek-v4-flash:0731-cloud> (analysed on a live system)
pr-validator — merge completeMerged: squash-merge of CalVer finalized: Tag: Squash trailer proof: pre-merge parse = Assisted-by: Claude Code deepseek-v4-flash:0731 (analysed on a live system) |
…bump-exposed deploykit test (#261) * feat(llmkit): the shared OpenAI-compatible LLM client + fix the spec-bump-exposed deploykit test Two changes, both needed for the Phase-2 `vision:` verb and its shared client. 1. NEW `llmkit/` — the SHARED OpenAI-compatible client, built on the official `github.com/openai/openai-go/v3`. ONE home (R3 + the boundary law): the client was plugin-local in candy/plugin-pipeline; it belongs in the SDK so any plugin speaks the endpoint identically. Two consumers now: the pipeline engine's agent stages and the new `vision:` check verb (candy/plugin-vision), which validates a screenshot by sending it to the same endpoint. The SDK owns the wire/SSE/accumulator/tool-call assembly; llmkit owns what it does not: - the IDLE bound (a per-chunk watchdog that CANCELS the request) — not a whole-generation deadline, so a slow-but-progressing model is never cut off while a silent provider fails in bounded time; - ollama's NON-STANDARD `reasoning` delta, which the SDK accumulator drops, read per-chunk from the raw JSON so a reasoning-only 200 is a NAMED empty completion rather than a bare one; - the empty-completion guard (a 200 with neither content nor tool calls is an ERROR); - the no-env-bleed guarantee: the client is NewChatCompletionService with the given options ONLY — never NewClient, which prepends the OPENAI_*-reading defaults and would let a stray operator env hijack a call. Config resolves field-wise (Default → Apply(#LLMSpec) → FromEnv) with params MERGING, mirroring the pipeline's documented precedence. Vision support: ImageDataURL / VisionParts / ChatVision. 2. `deploykit/preempt_resolve_test.go` — the spec bump this PR carries (v0.2026254.503 -> v0.2026259.2033) brings spec #135's `FindVMClaimant` signature change (it gained a `claimantID` to scope the claim to the requesting deploy identity). The SDK test was never updated, so the package no longer built. The two entity-wide cases now pass an explicit empty claimantID (the legacy scan path their intent describes), and a NEW TestFindVMClaimant_IdentityScoped covers the behaviour the argument exists for: a GPU-free sibling sharing a VM entity must NOT inherit the owner's claim, and the owner resolves its own across the slash/dash identity forms. Tests (llmkit/llmkit_test.go): text streaming; every set #LLMParams field arrives under its exact wire name; unset fields are NOT sent; json_schema response_format; vision content parts (image_url data URL); ImageDataURL mime default; reasoning-only is a NAMED empty completion; empty completion errors; the idle watchdog bounds a stall; NO OPENAI_* env bleed; config precedence + field-wise param merge; auth absent when the key is empty. Two mutations verify the guards: swapping NewChatCompletionService for NewClient reds TestChat_NoOpenAIEnvBleed (Authorization="Bearer polluted-key"), and neutralising the reasoning read reds TestChat_ReasoningOnlyIsNamedEmpty. Verification: $ go mod tidy $ go build ./... # ok $ go vet ./... # clean $ go test ./... # 14/14 packages ok $ go test -race ./llmkit/ # ok $ gofmt -l . # clean Rulebook compliance: R1 (the deploykit break was root-caused to spec #135's signature change, not worked around); R3 (one canonical LLM client); R5 (the stale test call sites removed, not left alongside); R10 (mutation-verified guards + the new identity-scoped coverage). Change classification: SDK kit (additive) + test repair for a contract bump. Verification gate: full SDK go build/vet/test + race + the mutation checks. Attribution: fully tested and validated. *Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)* * test(llmkit): the LIVE-endpoint proof (validator round 1, blocks 1-3) The pr-validator correctly refused to accept an author-written SSE mock as proof of provider- and transport-specific behavior. This adds live_test.go, which exercises the load-bearing assumptions against a REAL OpenAI-compatible endpoint: - TestLive_TextStreaming — a real streaming completion using the BUILT-IN DefaultBaseURL/DefaultModel defaults (exercising those constants): "PONG". - TestLive_ReasoningDeltaShape — real bytes for ollama's non-standard `reasoning` field, which the SDK accumulator does not type. - TestLive_VisionContentParts — ChatVision with a 64x64 solid-red PNG data URL; the live model replied "Red", proving the content-parts + data-URL path. - TestLive_AuthAbsentOnKeylessEndpoint — a keyless live call with no Authorization header. They SKIP when no endpoint is reachable (so they never red a host without ollama) but they are the tests that must be RUN and pasted for this PR's evidence. The 1x1-pixel fixture in the first draft was ROOT-CAUSED as ambiguous (the model replied "Pink" — an upscaled single pixel) and replaced with an unambiguous 64x64 image, not by loosening the assertion (R1). Co-authored-by: agent <[email protected]> * docs(llmkit): name the R3 companion + the live-proof suite in this branch Co-authored-by: agent <[email protected]> * fix(llmkit): surface Message.Reasoning so the non-standard read is observable (validator round 2) The pr-validator's round-2 block was correct on both counts: 1. Block 2 (B13/RDD) — the live "reasoning" test could not observe the claim it was named for. ROOT CAUSE: llmkit CAPTURED ollama's non-standard `reasoning` delta but DISCARDED it from the return value (it fed only the empty-completion diagnostic), so no caller — and no test — could see it. The live test merely called Chat and logged content, which is the same path as the text test and would pass with the reasoning read deleted. Fix: Message gains Reasoning, populated from the captured bytes. The live test now FAILS when no reasoning-bearing output is observed (it cannot pass vacuously), and MUTATION B shows deleting the read reds BOTH the mock test and the LIVE test. 2. Block 1 (B12/B14) — the pasted -v block did not reconcile with its own package total. The body now carries ONE genuine run whose per-test durations sum to ~3.08s against the package total 3.108s. Co-authored-by: agent <[email protected]> * fix(llmkit): the vision live-test comment says 1x1 but sends 64x64 (validator round 3) R1: a doc comment that diverges from the code it documents is an incident. The comment still described the FIRST draft's 1x1 fixture; the test sends a 64x64 solid-red image (the adjacent comment already explains why the 1x1 was rejected as ambiguous). Co-authored-by: agent <[email protected]> --------- Co-authored-by: Andreas AI Trawöger <[email protected]> Co-authored-by: agent <[email protected]>
Summary of changes
The
generate-packagesplugin's CLI documents deb/rpm signing as "passphrasevia
NFPM_PASSPHRASE" (apk viaNFPM_APK_PASSPHRASE, msix viaNFPM_MSIX_PASSPHRASE), but the struct-direct build path never read them:packagekit.buildOnecallsnfpm.WithDefaults(which does no env expansion),not
nfpm.Parse(which is where nFPM reads the passphrase env vars). Apassphrase-protected signing key therefore failed at package-build time with
signing error: armored detach sign: key is encrypted but no passphrase was provided— surfaced while validating the Phase 2 distro-repo workflowsagainst the released plugin.
packagekit/build.go(applyPassphrases): mirrors nFPM's Parse-time envexpansion for the struct-direct path — the general
NFPM_PASSPHRASEfillsdeb/rpm/apk, and the per-format
NFPM_DEB_PASSPHRASE/NFPM_RPM_PASSPHRASE/NFPM_APK_PASSPHRASE/NFPM_MSIX_PASSPHRASEoverride it. Called in
buildOneafterBuildInfo, beforeWithDefaults.packagekit/build.go(buildInfo): the info-construction seam(
BuildInfo+applyPassphrases+WithDefaults) thatbuildOneuses —extracted so the wiring is testable.
packagekit/build_test.go(TestBuildOneAppliesPassphrases): proves thebuildOnewiring — fails if theapplyPassphrasescall is removed from thebuild path (mutation-verified).
TestApplyPassphraseskeeps the precedencedetail (general vs per-format override).
packagekit/variants_test.go:Maintainerset in thetestPackaging()fixture so the deb/ipk packagers no longer emit nFPM's DEPRECATION WARNING
in the gate output (zero-warnings gate).
Change class
charly-or-sdk Go —
sdk/packagekitbuild path (a kind-blind packagingmechanism consumed by the
generate-packagesplugin). No schema/CUE surface,no plugin boundary, no deployable box.
How R10-tested — exact gate, commands, and pasted output
gofmt,go vet,golangci-lint,go test ./...) at zero warnings, plus the retained testcoverage that fails without the change. An sdk library change has no
deployable box, so no
charly check run <bed>applies — the runtime proof isthe live e2e deb build below (the changed code path executed against a real
passphrase-protected key).
N/A— sdk is a Go library, not a deployable box; thechange-class gate for
charly-or-sdk Gois the Go gates + retained coverage.N/A— no binary is built from the sdk (it is a libraryconsumed by the plugin's release workflow). The gates ran on the current
source at HEAD
3457743.expansion through
buildOneran against a real passphrase-protected GPG key(the Phase 2 distro-repo signing key): the positive case embeds the
_gpgoriginsignature member, and the negative case (passphrase unset)reproduces the exact pre-fix failure. Output retained below.
N/A— no shared-state surface.The throwaway e2e test was deleted after verification (it needs a real
passphrase-protected key at fixed /tmp paths — not CI-suitable); the retained
TestBuildOneAppliesPassphrasescovers the wiring and fails without it.Attribution tier
analysed on a live system — the changed code path (the
NFPM_*_PASSPHRASEenv expansion through
buildOne) executed live against a realpassphrase-protected key, with retained output above: the positive case embeds
_gpgorigin, the negative case reproduces the exact pre-fix failure, and theretained wiring test is mutation-verified. Not
fully tested and validated:the sdk is a library with no deployable box, so no disposable-target fresh
rebuild applies.
Harness rulebook compliance — state HOW each is satisfied (or
N/A — <reason>)/charly-internals:go(Go source work) +/charly-internals:plugin(sdk code) — the change is plain Go insdk/packagekit, no schema/CUE surface, no plugin boundary change.key is encrypted but no passphrase was provided) was root-caused to the struct-direct path skipping nFPM's Parse-time env expansion; the fix mirrors nFPM's own precedence (verified againstnfpm/[email protected]nfpm.go:251-292). The nFPM DEPRECATION WARNING (maintainer unset in the test fixture) surfaced in the gate output was fixed in-tree (Maintainerset intestPackaging()); the gate now runs at zero warnings.applyPassphrasesmirrors nFPM's Parse logic but is not a copy of sdk code; it is the single place the struct-direct path applies passphrases.buildInfois the one seambuildOneuses.3457743), no force-push.go test.N/A— no generation change.N/A— the sdk is a library, not a deployed binary; no new runtime OS deps.TestBuildOneAppliesPassphrasesfails without the change (mutation-verified above).N/A— no candy/box/schema surface touched; no CUE generation involved.packagekit(a kind-blind packaging mechanism consumed by thegenerate-packagesplugin) — the correct layer; nocharly/*.gostaged, no alias, no kit import.N/A— no destroy/rebuild in the evidence.gofmt -l .empty,golangci-lint run ./...= 0 issues,go vetclean,go test ./...green (pasted above).CHANGELOG/2026.227.0000.mdstaged (placeholder CalVer — the pr-validator finalizes it).Assisted-by: Claude Code deepseek-v4-flash:0731-cloud (analysed on a live system)