Skip to content

fix: reject conflicting body flags in broadcast create/update#214

Merged
felipefreitag merged 3 commits intomainfrom
fix/broadcast-body-flag-conflicts-8b66
Apr 9, 2026
Merged

fix: reject conflicting body flags in broadcast create/update#214
felipefreitag merged 3 commits intomainfrom
fix/broadcast-body-flag-conflicts-8b66

Conversation

@bukinoshita
Copy link
Copy Markdown
Member

@bukinoshita bukinoshita commented Apr 9, 2026

Summary by cubic

Rejects conflicting broadcast body flags to prevent unintended campaign content. broadcasts create and broadcasts update now exit with invalid_options when both inline and file sources are provided, resolving BU-660.

  • Bug Fixes
    • Treat --html + --html-file and --text + --text-file as mutually exclusive; throw invalid_options instead of warning and overwriting.
    • Streamlined body resolution order: React Email HTML, then file, then inline.
    • Updated tests to assert errors and ensure the SDK is not called on conflicts.

Written for commit 8672605. Summary will update on new commits.

@bukinoshita bukinoshita marked this pull request as ready for review April 9, 2026 18:49
@bukinoshita
Copy link
Copy Markdown
Member Author

@cubic-dev-ai review this PR?

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai bot commented Apr 9, 2026

@cubic-dev-ai review this PR?

@bukinoshita I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/broadcasts/update.ts">

<violation number="1" location="src/commands/broadcasts/update.ts:113">
P2: Move the new body-flag conflict checks before `pickId()`, otherwise invalid input can still prompt/fetch broadcasts or surface `missing_id` before `invalid_options`.</violation>
</file>

<file name="src/commands/broadcasts/create.ts">

<violation number="1" location="src/commands/broadcasts/create.ts:189">
P2: Validate the new mutually exclusive body flags before any prompting or API-dependent setup so invalid options fail immediately.</violation>

<violation number="2" location="src/commands/broadcasts/create.ts:189">
P2: Check for option presence (`!== undefined`) instead of truthiness, or empty-string inline values bypass the new conflict rejection.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Copy link
Copy Markdown
Contributor

@felipefreitag felipefreitag left a comment

Choose a reason for hiding this comment

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

I consider the Cubic issues valid, I'm open to discussing them

cursoragent and others added 3 commits April 9, 2026 17:39
Replace warning-and-overwrite behavior with hard errors when both
--html and --html-file, or --text and --text-file, are provided to
broadcasts create and broadcasts update commands.

This matches the safer pattern already used in templates update, which
rejects --html/--html-file conflicts as invalid_options. The previous
behavior silently used the file content, which could lead to unintended
campaign content being saved or sent.

Closes BU-660

Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Move --html/--html-file and --text/--text-file conflict checks before
pickId() and interactive prompts so invalid options fail immediately.
Use !== undefined instead of truthiness in create.ts to catch empty
string values from variable substitution or scripts.
@felipefreitag felipefreitag force-pushed the fix/broadcast-body-flag-conflicts-8b66 branch from 2a52a91 to 7d45bed Compare April 9, 2026 20:39
@felipefreitag felipefreitag merged commit c0126d7 into main Apr 9, 2026
6 checks passed
@felipefreitag felipefreitag deleted the fix/broadcast-body-flag-conflicts-8b66 branch April 9, 2026 20:47
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.

3 participants