feat(change-stories): add pup change-stories list command group#558
Draft
bmarengo wants to merge 1 commit into
Draft
feat(change-stories): add pup change-stories list command group#558bmarengo wants to merge 1 commit into
pup change-stories list command group#558bmarengo wants to merge 1 commit into
Conversation
Wires a new top-level command group that calls the change-stories `/api/unstable/change-stories/cli` wrapper endpoint and emits the agent-friendly payload through the existing formatter + envelope pipeline. The pup command intentionally exposes a reduced parameter surface (service, env, from, to, story_types, primary_tag, token_limit) to match the wrapper endpoint while the upstream /api/unstable/ contract stabilizes. Timestamps are required and reuse the parsing methods so agents reading just `--help` produce inputs the backend accepts. Ticket: CTR-2908 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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 does this PR do?
Wires a new top-level command group that calls the change-stories
/api/unstable/change-stories/cliwrapper endpoint and emits the payload through an agent-friendly formatter + envelope pipeline.The pup command intentionally exposes a reduced parameter surface (service, env, from, to, story_types, filter_tags, token_limit) to match the wrapper endpoint while the upstream /api/unstable/ contract stabilizes. Timestamps are required and reuse the parsing methods so agents reading just
--helpproduce inputs the backend accepts.Testing Report
Positive / Happy Path Tests
Cross-validation of pup's output against curl's output to the main change-stories endpoint - all in the staging environment.
All 20 tests passed.
--service change-stories --from 2025-05-01T00:00:00Z --to 2025-06-03T00:00:00Z--env staging--env staging--env prod--env prod--from 7d --to now--from 7d --to now--from 30m --to now--from 30m --to now--from 1746057600 --to 1748908800--from 1746057600000 --to 1748908800000--story-types deployment--story-types deployment--story-types feature_flag--story-types feature_flag--story-types kubernetes--story-types kubernetes--story-types watchdog--story-types watchdog--story-types(repeated flags)--story-types deployment --story-types kubernetes--story-types(comma-delimited)--story-types deployment,kubernetes--token-limit 500(triggers truncation)--token-limit 500--token-limit 999999(no truncation)--token-limit 999999--filter-tags "datacenter:us1.staging.dog"--filter-tags "datacenter:us2.staging.dog"--story-types scale(no data)--story-types scale--service this-service-does-not-exist-xyz123--from 2025-06-02T12:00:00Z --to 2025-06-02T13:00:00Zai_gateway)--service ai_gatewayNegative / Validation Error Tests
All 14 tests produced non-zero exit codes with the expected error messages.
--from 2025-05-01(bare date)unable to parse time--to 2025-06-03(bare date)unable to parse time--from "not-a-time"(garbage)unable to parseend_ts must be greater than start_tsend_ts must be greater than start_ts123service)Service name must start with a letter*excludesall{}excludesall--service ""required--story-types invalid_type_xyzoneof--servicerequired arguments were not provided--fromrequired arguments were not provided--torequired arguments were not providedOutput Format Tests
storiesarray--output yamlstories:--output table+---borders, not JSON--agentenvelopestatus=success,data.stories,metadata.command="change-stories list"--agent+--token-limit 500(truncation)data.truncated=trueandmetadata.truncated=trueTimestamp Format Tests
These tests verified every documented accepted and rejected format for
--from/--to.2025-05-01T00:00:00Z174605760017460576000007d30m2hours30min"2 hours"NOW(uppercase)NOW-7dallow_hyphen_valuesfix)1746057600vs2025-05-01T00:00:00Z1746057600000vs2025-05-01T00:00:00Z2025-05-01unable to parse"yesterday"unable to parse--from 2025-06-03 --to 2025-05-01end_ts must be greaterContributing Guidelines Compliance
Evaluated against every MUST item in
docs/REVIEW.md,docs/CONTRIBUTING.md, anddocs/TESTING.md.client::raw_get,formatter::format_and_print,formatter::Metadata,util::parse_time_to_unix_millis. No new helpers invented for existing functionality.--fromrejected (names flag), invalid--torejected (names flag). Both positive and negative paths covered.client::raw_getwhich uses HTTPS.Cargo.toml. The onlyCargo.tomlchange is adatadog-api-clientrev bump, which is an existing pinned dependency.cargo auditis not installed; no new crates were introduced.list()is 67 lines with a single level of nesting.#[allow(clippy::too_many_arguments)]follows established codebase pattern (9 other command files use it). No traits, generics, or builder patterns introduced.feat/add-change-stories. One feature commit (feat(change-stories): add \pup change-stories list` command group`). Conventional commit format. Unrelated code not touched.cargo fmt --check→ exit 0.cargo clippy -- -D warnings→ exit 0.anyhow::anyhow!used with context for both timestamp errors. IdiomaticOption/Resultthroughout.cargo test commands::change_stories→ 8 passed, 0 failed.COMMANDS.mdandEXAMPLES.mdboth updated.ARCHITECTURE.mdupdated.