feat(clients): JSON-driven guppy harness client (+ cliexec, randdir)#6
Open
frrist wants to merge 1 commit into
Open
feat(clients): JSON-driven guppy harness client (+ cliexec, randdir)#6frrist wants to merge 1 commit into
frrist wants to merge 1 commit into
Conversation
7388695 to
66c7b3f
Compare
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>
66c7b3f to
58f211b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Reworks the
guppytest-harness client to consume guppy's new--output jsonmode instead of scraping free-text stdout, and factors out the reusable plumbing for the upcoming piri/sprue/indexer clients.Changes
pkg/clients/cliexec(new) — aRunnerseam (StackRunner+RunnerFunc) and a genericJSON[T]decoder; the exec-world analog of the smtp4dev client'sjsonRequest. 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 intypes.go(CIDs/DIDs as strings; smelt's module graph stays at libforge+ucantone).Loginnow keys off the JSON result'slogged_in/already_logged_infields, and the brittleextractDID/extractCIDsregex is gone. Unit-tested with a fake runner (incl. both login branches).pkg/clients/randdir(new) — a dedicated client for theranddirtest-data generator. It ships in the guppy container but is not a guppy command, soGenerateTestDatais 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 (thesource_idfromSource().Addreappears inSource().Listand theUpload().Runentry; the upload root CID reappears inLsandRetrieve).docs/DEVELOPING.md— documents thegenprotoreplaceneeded when adding./guppyto thego.workuse-list.Stacking & ordering
frrist/dev/ucan1(notmain): the e2e changes useWithWorkspaceBinaries/WithServiceBinary, which live on that branch. Retarget tomainonce it lands.--output text|jsonflag for machine-readable output guppy#15 (the--output jsonsupport). Land guppy#15 first — the client passes--output=json, which the current published guppy rejects.Testing
go test ./pkg/clients/...(cliexec decode cases, guppy sub-clients + both login branches, randdir arg construction).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.