Skip to content

feat: punktfunk check verb plugin - #1

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/punktfunk-verb
Aug 29, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/punktfunk-verb

Conversation

@atrawog

@atrawog atrawog commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the punktfunk: check verb — an out-of-tree, out-of-process plugin that drives a
running punktfunk streaming host through its
management REST API. It is the management half of punktfunk support in charly; the host
itself is installed by layer-punktfunk.

30 methods, split read/write:

Group Methods
host / health health status diagnostics diagnostics-refresh compositors gpus plugins hooks
native pairing pair-status pair-arm pair-disarm pending approve deny pin
paired clients clients rename access unpair
library library scanners scanner-toggle
virtual displays display-state display-monitors display-settings display-release
lifecycle actions action-invoke end-game
stream events (bounded SSE)

No edit to charly/ or spec/ is needed: checkVerbProviderBijection explicitly allows
out-of-tree verbs, and punktfunk collides with no authored #Op field.

Why this is not the generic http: verb (R3)

http: already does URL + status + body/header matchers + allow_insecure, and
duplicating that would be pointless. This verb exists for what http: structurally cannot
do:

  • Token discovery. The bearer token is generated per host at first start and written
    inside the venue. An authored http: step cannot read a per-deploy secret out of a
    container or guest.
  • Domain semantics. Methods map to endpoints and return real verdicts, with
    json_path: to assert one field rather than pattern-matching a JSON blob.
  • events. A bounded SSE subscription is the only way to assert a transition;
    polling /api/v1/host observes a state, never that a stream started.

Three design decisions worth reviewing

1. The request is issued from inside the venue, not from the charly host. punktfunk
binds its management API to loopback by default and its documentation is explicit that the
API stays loopback-only while the web console is the network-facing surface. A host-vantage
cc.HTTPDo cannot reach a loopback-bound listener in a container, and the two ways to make
it reachable — republishing the port, or a socat eth0→loopback relay — would both weaken
exactly the posture upstream chose. Probing in-venue keeps that intact and puts the request
on the same side as the token. The cost is a curl dependency, so its absence is reported
as a precise, actionable message rather than a bare exit code (tested).

2. The token never touches argv. It travels through curl --config on stdin, via a
heredoc with a quoted delimiter so the shell cannot expand it. argv is world-readable
through /proc, and a management token in ps output would be a real leak on a shared
host. TestTokenNeverReachesArgv pins this.

3. The TLS flag is verify_tls, not insecure. punktfunk serves a self-signed
certificate, so verification must be off by default. A Go bool cannot distinguish "unset"
from "false", so an insecure field could never default to true — inverting the name makes
the ZERO VALUE the correct default instead of relying on a tri-state that does not survive
codegen.

Mutating methods are refused in a check: step (via Op.IntentDo == assert, which the
runner stamps from the step keyword and authors cannot set), so a probe can never silently
unpair a device or reboot a machine.

How tested

Built with the binary from the pinned charly checkout (task build:binary at
v2026.241.1535+1). The repo's deploy.yml — on main from bootstrap, not in this diff;
see the CI-gate section below — pins that same tag, whose spec v0.2026241.931 declares
SchemaVersion = "2026.240.1943". Verified, which is why the build check is green.

Unit tests

$ GOWORK=off go build ./... && GOWORK=off go vet ./... && GOWORK=off go test ./...
ok  github.com/opencharly/plugin-punktfunk/candy/plugin-punktfunk
$ gofmt -l .        # (no output)

Beyond the happy paths, the suite pins the properties that would otherwise rot silently:
a drift gate that reads the method disjunction out of the embedded CUE and fails if it
and the Go dispatch table diverge (measured: 30 methods on both sides); the read/write
classification of every method; required-field enforcement; path-escaping of
attacker-influenced identifiers (a fingerprint arrives from a pairing request); SSE
multi-line payload joining; and the token-leak guard above.

Live proof — the verb dispatching against a real host

A disposable pod bed (CachyOS base + headless sway + the punktfunk candy + this plugin)
was built and driven end to end. Full R10 sequence, every step green:

image-build          true      config               true      check-live           true
check-image          true      start                true      feature-run          true
deploy-add           true      bring-up-members     true      update               true
check-live-rebuild   true      feature-run-rebuild  true      cleanup              true
cleanup-members      true
CHECK_RUN_EXIT=0

The verb's own verdicts, from the fresh-rebuild leg (note the container id differs from
the first leg — this is a genuinely rebuilt deployment, not a re-read of the first):

PASS  the punktfunk verb reaches the management API's unauthenticated health route  [pf-verb-health]
      {"status":"ok","version":"0.33.0-1","abi_version":26}
PASS  the verb discovers the host-generated bearer token in the venue and reads host identity  [pf-verb-status]
      {"hostname":"charly-check-punktfunk-pod","uniqueid":"8a8c3860cfc04c94a93c4e5e8c81ad8d","local_ip":"10.89.0.161","version":"0.33.0-1",…
PASS  the verb reports the compositor backends the host can drive  [pf-verb-compositors]
      [{"id":"kwin","label":"KWin / KDE Plasma","available":false,…},{"id":"gamescope",…},{"id":"mutter",…}
PASS  the verb lists paired native clients (empty on a fresh host, but authenticated)  [pf-verb-clients]
      []
PASS  json_path extracts a single field instead of matching the whole document  [pf-verb-jsonpath]
      ok

25 steps: 24 passed, 0 failed, 1 skipped

A doc-vs-reality divergence the live run caught (R1)

The first live run failed three of five verb checks with a clean HTTP 401:

FAIL  [pf-verb-status]  punktfunk: status: HTTP 401: {"error":"missing or invalid credentials (a paired client cert, or a bearer token)"}

Root cause, measured in the venue rather than guessed: the management-token file is not
a bare token, which is what the upstream documentation implies ("generated and persisted
API token … path=~/.config/punktfunk/mgmt-token"). Against punktfunk-host 0.33.0-1 it is an
env-file line:

$ cat ~/.config/punktfunk/mgmt-token
PUNKTFUNK_MGMT_TOKEN=d0c73fe4eee1ef0cf45e2d706cd60aeb71c0e1880c3ba8674ea0ace05a976dbf

The plugin was sending the whole line as the bearer. Fixed with a real parser
(token.go) that accepts both the env-file and bare forms and prefers the
PUNKTFUNK_MGMT_TOKEN key — the host writes a sibling plugin-token, so key preference is
load-bearing rather than cosmetic. TestParseTokenFile covers the measured shape,
quoting, CRLF, comments and the multi-key ordering both ways.

No schema check would have found this. It is the concrete reason the verb was proved on a
live bed before landing rather than after.

The stock plugin CI gate is empty — this repo's is not

While setting this up I measured that running charly box validate at a plugin repo
root
validates nothing: a plugin repo has no project charly.yml, so discovery never
reaches candy/<name>/charly.yml and the command exits 0 on any manifest. Injecting a
malformed provider class (notaclass:punktfunk) still exited 0 at the repo root, while the
same manifest under a project with a discover: block failed correctly:

plugin.providers.0: invalid value "notaclass:punktfunk" (out of bound =~"^(kind|deploy|verb|…):[a-z0-9][a-z0-9_-]*$")

Where the fixed gate lives, precisely: this repo's deploy.yml already carries the
corrected shape — it stages a minimal project with a discover: block so the manifest is
actually parsed, and additionally runs go build / go vet / go test / gofmt -l, the
substance of a plugin repo that the stock template omits entirely. It is not in this
diff.
It was installed on main during repo bootstrap, together with the pr-validator
and tag-on-merge dispatchers, because tag-on-merge fires on workflow_run and
workflow_run only fires for workflows already present on the default branch — a first PR
that installed the dispatcher could never be tagged by it. So the gate that produced the
green build check on this PR is the corrected one, and this PR's 16 files are the plugin
module itself. Every step of it was dry-run locally before being installed.

The same weakness affects the other plugin repos still on the stock template. It is
tracked as opencharly/charly#459, which carries the measurement, the control against
plugin-vnc, and the concrete template fix; this repo is named there as the reference
shape. That is the exit — this PR advances it by shipping and proving the corrected gate.

Rulebook compliance

  • R1 — the 401 was root-caused by measuring the actual file in the venue before any
    code changed; the doc-vs-reality divergence is documented in token.go so the next
    reader does not re-derive it.
  • R3 — the verb does not duplicate http:; the justification is above and the
    boundary is deliberate. The in-venue transport is one implementation used by every method.
  • R4 — no workaround for the loopback bind: the design follows punktfunk's posture
    rather than relaxing it with a port relay.
  • R6 — no force-push, no hook bypass; the pre-commit gate's -F <file> requirement was
    complied with, not disabled.
  • R7 / R10 — the pasted evidence is a full charly check run on the final tree,
    including the fresh-rebuild leg, not a green git status.
  • A2 / B12 — the changed runner executed live in this PR; the verb's behaviour is
    covered by checks that fail if it breaks (the 401 above is exactly such a failure, caught
    by these checks before landing).
  • R2 / B14(b) — the CI-template finding is no longer parked behind "not in this PR": it
    is routed to a named exit, Plugin repos' candy CI gate validates nothing (charly box validate at a plugin repo root scans an empty set) charly#459, which this PR advances by shipping the
    corrected gate and standing as its reference implementation.
  • Body truthfulness — the deploy.yml references now state plainly that the file lives
    on main from bootstrap and is not part of this diff, and why it has to.

Change classification

  • Change class: new plugin candy (feature) — one new repo, no existing behaviour altered.
  • Verification gate: go build / go vet / go test / gofmt, a real manifest
    validate under discovery, and a full charly check run R10 sequence on a disposable pod bed.
  • Attribution tier: fully tested and validated — the R10 bed passed on the final tree
    and every changed path executed live, with the output retained above.

Assisted-by: Claude Code claude-opus-5[1m] (fully tested and validated)

Serves the `punktfunk:` verb, which drives a running punktfunk streaming host through
its management REST API - probing it (health, status, diagnostics, compositors, gpus,
clients, pending devices, library, displays, plugins, hooks, actions) and managing it
(pairing, approvals, PIN, rename, access presets, unpair, scanner toggle, display
release, power actions, end game, and a bounded SSE event subscription).

Not a re-skin of the generic http: verb. It exists for the three things http: cannot
do: it reads the per-host bearer token from inside the venue over the reverse channel,
it carries domain semantics that return real verdicts, and its events method can assert
a TRANSITION rather than a state.

The request is issued from INSIDE the venue rather than the charly host. punktfunk binds
its management API to loopback by design; reaching it from the host would mean
republishing or relaying the port, weakening the posture upstream chose. Probing in-venue
also puts the request on the same side as the token. The token travels via curl --config
on stdin, never argv, because argv is world-readable through /proc.

Mutating methods are refused in a check: step, so a probe can never unpair a device or
reboot a machine.

Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: d7c036aea246b8a2697e0ca86544b21c635093f6

Change class: new plugin candy (feature) — new out-of-tree Go plugin module serving the punktfunk check verb. 16 new files, 0 deletions.

Security screen: PASS — no T1–T4 findings. Token travels via curl --config on stdin (never argv), identifiers are path-escaped, no exfiltration, no weakened guardrails, pinned deps only.

Placement: CORRECT — the capability (a verb) is placed as a candy/plugin, the correct outermost layer. No core/sdk changes.

Blocks

  1. R2 / B14(b) — parking phrase with no named exit. The body states: "The same weakness applies to the other plugin repos using the stock template; that is reported rather than fixed here, since sweeping ~90 repos does not belong in this PR." This is a parking phrase ("does not belong in this PR") that names no thematic batch or task. Per B14(b), a parking phrase is itself a finding unless it names an exit THIS PR advances. The author must either fix the stock-template CI weakness in-tree or route it to a NAMED thematic batch/task.

  2. Body-truthfulness (rule 4) — deploy.yml claimed but absent from the diff. The body twice references a deploy.yml as part of this PR's setup: "This repo's deploy.yml therefore stages a minimal project so the manifest is actually parsed, and additionally runs go build / go vet / go test / gofmt -l … Every step was dry-run locally before being committed" and "deploy.yml pins the same tag." The diff contains no deploy.yml (16 files, all under candy/plugin-punktfunk/ plus .gitignore). Either the file is missing from the PR (the CI-gate workaround the body describes does not ship) or the body misdescribes a pre-existing base file as committed in this PR. The author must reconcile the body with the diff — add the file or correct the claim.

Verdict: BLOCK


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: d7c036aea246b8a2697e0ca86544b21c635093f6

Security screen: PASS — no T1–T4 findings. Token travels via curl --config on stdin (never argv, pinned by TestTokenNeverReachesArgv), attacker-influenced identifiers are path-escaped, no exfiltration/egress beyond the management API, no weakened guardrails, pinned deps only.

Checklist: All applicable rules PASS or NA.

Prior reviewer comments considered:

  • github-actions[bot] block feat: punktfunk check verb plugin #1 (R2/B14b parking phrase) — stale-superseded: the current body routes the stock-template CI weakness to a named exit, opencharly/charly#459, and states this PR advances it by shipping the corrected gate.
  • github-actions[bot] block feat: add the punktfunk check-verb skill #2 (deploy.yml claimed but absent) — stale-superseded: the current body explicitly states deploy.yml is on main from bootstrap, is not in this diff, and explains why (workflow_run only fires for workflows already on the default branch).

Placement: CORRECT — the capability (a verb) is placed as a candy/plugin, the correct outermost layer; no core/sdk changes. ADE satisfied (non-empty description: + plan: with a deterministic check: step). SDD satisfied (schema/punktfunk.cue → params/cue_types_gen.go generated in the same commit; no banned patterns). R10 evidence is internally consistent (full sequence green, fresh-rebuild leg with a distinct container id, verb verdicts from the changed code path executing live on a disposable pod bed). Attribution tier fully tested and validated is justified by the live proof.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) August 29, 2026 19:29
@github-actions
github-actions Bot merged commit f6d5c18 into main Aug 29, 2026
2 of 3 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Aug 29, 2026
@aitrawog
aitrawog deleted the feat/punktfunk-verb branch September 25, 2026 19:30
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