probing: add measurements command and -o csv output#14
Conversation
Implements the two 'Probing ergonomics' items from the v2 CLI roadmap (nxthdr/roadmap#38). - `probing measurements [--limit N]`: lists recent measurements via the new GET /api/user/measurements endpoint, so the ID from `send` isn't the only handle. - `-o csv`: third global output format alongside text/json. table() renders header+rows and kv() renders a single-row CSV, both RFC-4180 escaped. Empty-result and text-only decoration handling routed through a new output::empty()/is_text() so every command stays valid in all three formats. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude encountered an error after 2m 2s —— View job Code Review
Overall the PR is clean and well-structured. Two issues worth addressing before merge: 1.
|
- validate `--limit` is within the documented 1-100 range (anyhow::ensure), failing fast instead of relying on the gateway to clamp. - gate the `measurement-status` summary kv to text mode so json/csv emit only the per-agent table — previously `-o csv`/`-o json` printed a summary block followed by a table (two CSV headers / two JSON values), which is invalid for parsers. Mirrors the existing `peering lookup` pattern. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tracks the gateway rename (saimiris-gateway: /api/user/measurements -> /api/measurements) so the measurements list and measurement-status routes are consistent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Implements the two Probing ergonomics items from the v2 CLI roadmap (nxthdr/roadmap#38).
probing measurements [--limit N]Lists your recent measurements as a table (
id · started · agents (done/total) · probes (sent/expected) · status), so the measurement ID returned bysendisn't the only handle.--limitdefaults to 20.-o csvAdds
csvas a third value to the global-o/--outputflag (wastext|json):table()→ header row + data rows;kv()→ keys header + one data row; both RFC-4180 escaped (quote/comma/newline handled).is_json()/ literal-[]empty-result pattern with a format-awareoutput::empty(headers)helper +is_text()gating, so every command (not justresults) stays valid under text/json/csv. Migrated all call sites inpeering.rs/probing.rs.Testing
cargo build,cargo clippy --all-targetsclean;cargo testpasses (added CSV-escaping unit tests).kvpath offline viastatus -o csv(ClickHouse/gateway aren't reachable from the dev sandbox, soresults/measurementsweren't exercised end-to-end):CLAUDE.mdto reflect the three formats and theoutput::empty()convention.🤖 Generated with Claude Code