2.0 KiB
2.0 KiB
id, title, status, wave, depends_on, plan
| id | title | status | wave | depends_on | plan |
|---|---|---|---|---|---|
| task-04 | Fixture plugin binary | done | 1 | docs/plans/plugins/plan.md |
Fixture plugin binary
Title
Standalone Go HTTP server implementing the plugin contract, for Go integration tests and Playwright e2e.
Inputs
- Spec
docs/specs/plugins/requirements/plugins.md→ event delivery headers/HMAC, tool invocation, webhook proxy, UI page contract. - Must be self-contained: only stdlib +
crypto/hmac,crypto/sha256. NO imports frominternal/plugins(proves the contract is decoupled).
Acceptance
apps/backend/cmd/plugin-fixture/main.gostarts an HTTP server on a port from-addr/PLUGIN_FIXTURE_ADDR(default127.0.0.1:0→ print chosen addr on stdout asLISTENING <addr>so tests can capture it).- Endpoints:
GET /health→ 200{"status":"ok"}.POST /events→ verifiesX-Kandev-Signature: sha256=<hmac>againstHMAC-SHA256(secret, rawBody)using secret from-secret/PLUGIN_FIXTURE_SECRET; records delivery (event_type + event_id) in memory; returns 200. Bad sig → 401.POST /tools/echo→ returns{"output": <input>}.POST /webhooks/test-hook→ records the call; returns 200.GET /ui/dashboard→ returns a small HTML page with<h1 id="plugin-dashboard">Fixture Plugin</h1>and a<script>that reads theme via postMessage (enough for e2e to assert render).GET /_debug/deliveries→ JSON list of recorded event_types (test-only introspection).
- Graceful shutdown on SIGINT/SIGTERM.
Files
apps/backend/cmd/plugin-fixture/main.goapps/backend/cmd/plugin-fixture/main_test.go(spins the server, asserts health + HMAC accept/reject + echo)
Verification
go test ./cmd/plugin-fixture/...fromapps/backendgo build ./cmd/plugin-fixturefromapps/backendmake -C apps/backend lint
Output contract
Report: chosen flags/env, the LISTENING <addr> handshake, endpoints implemented,
how HMAC is verified. Stay within apps/backend/cmd/plugin-fixture/.
Dependencies
None.