Skip to content

feat(clients): JSON-driven guppy harness client (+ cliexec, randdir)#6

Open
frrist wants to merge 1 commit into
frrist/dev/ucan1from
frrist/cli/guppy-client
Open

feat(clients): JSON-driven guppy harness client (+ cliexec, randdir)#6
frrist wants to merge 1 commit into
frrist/dev/ucan1from
frrist/cli/guppy-client

Conversation

@frrist

@frrist frrist commented May 29, 2026

Copy link
Copy Markdown
Member

What

Reworks the guppy test-harness client to consume guppy's new --output json mode instead of scraping free-text stdout, and factors out the reusable plumbing for the upcoming piri/sprue/indexer clients.

Changes

  • pkg/clients/cliexec (new) — a Runner seam (StackRunner + RunnerFunc) and a generic JSON[T] decoder; the exec-world analog of the smtp4dev client's jsonRequest. Injects --output=json, surfaces stderr in errors, handles empty/malformed output.
  • pkg/clients/guppy — restructured into sub-clients mirroring the CLI command tree: c.Space().Generate(), c.Upload().Source().Add(), c.Account().List(), c.Blob().Ls(), etc. Local mirror result types live in types.go (CIDs/DIDs as strings; smelt's module graph stays at libforge+ucantone). Login now keys off the JSON result's logged_in/already_logged_in fields, and the brittle extractDID/extractCIDs regex is gone. Unit-tested with a fake runner (incl. both login branches).
  • pkg/clients/randdir (new) — a dedicated client for the randdir test-data generator. It ships in the guppy container but is not a guppy command, so GenerateTestData is no longer a method on the guppy client.
  • tests/e2e — driven through the new sub-client API, now asserting on the structured results: per-field checks plus cross-links (the source_id from Source().Add reappears in Source().List and the Upload().Run entry; the upload root CID reappears in Ls and Retrieve).
  • docs/DEVELOPING.md — documents the genproto replace needed when adding ./guppy to the go.work use-list.

Stacking & ordering

Testing

  • go test ./pkg/clients/... (cliexec decode cases, guppy sub-clients + both login branches, randdir arg construction).
  • Full e2e (tests/e2e) verified end-to-end against a stack running the guppy from guppy#15 (built from source via the workspace): login → space → source → upload → ls → space info → retrieve, with all structured assertions passing.

Rework the guppy test-harness client to consume guppy's new `--output json`
mode instead of scraping free-text stdout, and split out the reusable pieces.

- New pkg/clients/cliexec: a Runner seam (StackRunner + RunnerFunc) and a
  generic JSON[T] decoder — the exec-world analog of smtp4dev's jsonRequest.
  Future piri/sprue/indexer clients build on this.
- pkg/clients/guppy: restructured into sub-clients mirroring the CLI command
  tree (c.Space().Generate(), c.Upload().Source().Add(), c.Account().List(),
  c.Blob().Ls()), with local mirror result types in types.go. Login now keys
  off the JSON result's logged_in/already_logged_in fields; the brittle
  extractDID/extractCIDs regex is gone. Unit-tested with a fake runner,
  including both login branches.
- New pkg/clients/randdir: dedicated client for the randdir test-data
  generator (it ships in the guppy container but is NOT a guppy command), so
  GenerateTestData is no longer a method on the guppy client.
- tests/e2e: drive the new sub-client API and assert on the structured
  results — per-field checks plus cross-links (the source_id from Add reappears
  in Source().List and the Upload entry; the root CID reappears in Ls and
  Retrieve).
- docs/DEVELOPING.md: document the genproto replace needed when including
  ./guppy in the go.work use-list.

Requires the guppy `--output json` support (companion PR) to run the e2e.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@frrist frrist force-pushed the frrist/cli/guppy-client branch from 66c7b3f to 58f211b Compare May 29, 2026 21: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