feat: add kgb (Known Good Binaries) command group#248
Conversation
Renders a known-good binary record: sha256 plus the flagging sources,
reference artifact-instance id, and created time when present. Guards the
optional fields so the minimal delete response ({sha256, deleted}) renders
cleanly too.
New top-level 'kgb' (Known Good Binaries) group wrapping the SDK's known_good_create/get/delete. sha256-keyed, no update; --source plus optional hash/filename/mimetype/metadata on create. Community flows from the global -c; authorization is enforced server-side, not in the CLI. Wired into polyswarm_cli.
CliRunner lifecycle tests (create -> get -> delete, text + json, plus get-after-delete 404) recorded against the live stack via VCR; distinct sha256 per test keeps them independent and first-run-safe.
Add the kgb row to the command catalogue (distinct from the host-oriented 'known' group) and list known_good in the formatter interface set.
Review — PR #248 (
|
… server-side source is required, so it's a positional argument rather than an option. The --metadata flag now parses any valid JSON and forwards it; the object-shape requirement is enforced server-side so it stays consistent across clients (help/error reworded to match — no client-side shape check).
Review — PR #248 (kgb command group)Clean against gitflow (base 1. Missing test for the only non-passthrough logic (--metadata parsing) — test coverage
2. SDK version pin — confirm the floor (spec 05 invariant)The PR relies on 3. Minor: PR body says --source, code uses a positional SOURCEThe PR description (create takes sha256 + required --source) does not match the implementation ( Nothing blocking on correctness — the minimal delete-response render and the 404-to-exit-1 path are both covered by replay, so the guarded optional-field access in |
Review — PR #248 (kgb / Known Good Binaries)Checked against One actionable item — the Non-blocking notes:
Nothing else needs action. |
TL;DR
kgb(Known Good Binaries) command group:create/get/delete(no update), wrapping the SDK'sknown_good_create/get/delete.known_good(...)formatter inTextOutputandJSONOutput.Context
Adds the CLI surface for the Known Good Binaries feature on top of the already-merged
polyswarm-apiSDK methods. A known-good entry is keyed on its sha256 — create records a feed (--source) as having flagged the hash; get and delete take the same sha256. Authorization is enforced server-side (internal-only); the CLI does not gate it.Changes
src/polyswarm/client/kgb.py— newkgbgroup +create/get/delete.createtakessha256+ required--source, optional--sha1/--md5/--filename/--mimetype/--metadata(JSON). Community flows from the global-c.src/polyswarm/client/polyswarm.py— register the group.formatters/base.py+text.py+json.py—known_good(...)renderer (text guards the optional fields so the minimal delete response renders cleanly).specs/02-commands.md,specs/03-formatters.md— catalogue + formatter-interface updates.Tests
tests/kgb_test.py—CliRunnerlifecycle (create → get → delete, text + json, plusget-after-delete 404), recorded against the live e2e stack via VCR; distinct sha256 per test (first-run-safe). Full suite green (replay + live).