fix: coerce numeric fallback values in contact-properties update command#226
Merged
felipefreitag merged 5 commits intomainfrom Apr 9, 2026
Merged
Conversation
The update command forwarded --fallback-value as a raw string from Commander, so numeric inputs like '42' were sent to the Resend API as strings instead of numbers. This violated the API contract requiring fallback_value to match the property's declared type. Now the update command fetches the existing property to determine its type and coerces/validates --fallback-value accordingly, mirroring the create command's behavior. Added regression tests for numeric coercion, string passthrough, and invalid numeric fallback validation on update. Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
1 issue found across 2 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/contact-properties/update.ts">
<violation number="1" location="src/commands/contact-properties/update.ts:93">
P2: Help metadata error code list is outdated and omits newly introduced runtime errors (`fetch_error`, `invalid_fallback_value`).</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.
felipefreitag
requested changes
Apr 9, 2026
Contributor
felipefreitag
left a comment
There was a problem hiding this comment.
Just the issue Cubic pointed out
Add `fetch_error` and `invalid_fallback_value` to the errorCodes list in the help text, matching the error codes actually used in the command.
felipefreitag
approved these changes
Apr 9, 2026
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.
The update command never looks up the property's declared type and never coerces
--fallback-value. Commander supplies option values asstrings, so--fallback-value 42becomes'42'and is forwarded unchanged.By contrast, the create command explicitly converts numeric fallbacks to numbers and rejects non-numeric input for
type === 'number':The test suite also encodes this inconsistency: