Skip to content

refactor(BUZZ-231): clarify audience helpers and share json output - #530

Merged
sarahweeks-prolific merged 1 commit into
mainfrom
feat/buzz-231-audience-review-followup
Oct 5, 2026
Merged

sarahweeks-prolific merged 1 commit into
mainfrom
feat/buzz-231-audience-review-followup

Conversation

@sarahweeks-prolific

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #527 for Matt's post-merge comments on audience count / audience breakdown.

Call sites no longer pass a naked bool into shared helpers. --json is registered once with the other audience flags. Both commands emit the client/API response type for --json instead of count inventing its own DTO.

Implementation

  • Split flag setup into addCountFlags / addBreakdownFlags and validation into validateCount / validateBreakdown. The bool stays inside filter_input.go.
  • Move -j/--json into the shared flag registrar (still hand-bound — shared.AddOutputFlags would steal -t from --template-path).
  • Count --json now marshals client.EligibilityCountResponse, matching breakdown's use of client.FilterBreakdownResponse. CountResult is gone. Wire JSON is still {"count":N}.

Testing

Existing cmd/audience tests cover the same paths; no behaviour change. go test ./cmd/audience/... passes.

@prolific-snyk

prolific-snyk commented Oct 2, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused refactor preserves existing behavior and has no unresolved review findings.

Review effort: Balanced
Findings: None

What changed in this PR

Refines the audience commands introduced in #527 by clarifying shared helpers and consolidating JSON output handling.

Changes:

  • Adds command-specific flag and validation helpers.
  • Centralizes --json registration and uses the API response type for count output, preserving {"count":N}.
File Description
cmd/​audience/​filter_input.go Adds named helpers and shared JSON flag binding.
cmd/​audience/​count.go Uses count helpers and the API response type.
cmd/​audience/​breakdown.go Uses breakdown helpers and shared JSON state.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sarahweeks-prolific
sarahweeks-prolific marked this pull request as ready for review October 2, 2026 13:56
@sarahweeks-prolific
sarahweeks-prolific requested a review from a team as a code owner October 2, 2026 13:56
@sarahweeks-prolific
sarahweeks-prolific merged commit 25e136c into main Oct 5, 2026
7 checks passed
@sarahweeks-prolific
sarahweeks-prolific deleted the feat/buzz-231-audience-review-followup branch October 5, 2026 16:01
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.

5 participants