Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 22
Stop echoing back step fields the caller never changed#620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -241,40 +241,41 @@ func (t *mockStepUpdateTransport) RoundTrip(req *http.Request) (*http.Response, | ||
| }, nil | ||
| } | ||
| // TestCardsStepUpdateAssigneesOnlyCarriesTitle verifies that updating only | ||
| // assignees fetches the current step and includes its title in the request — | ||
| // the API rejects step updates without a title. | ||
| func TestCardsStepUpdateAssigneesOnlyCarriesTitle(t *testing.T) { | ||
| // TestCardsStepUpdateAssigneesOnlySendsNoTitle verifies that updating only | ||
| // assignees sends assignees and nothing else. The server preserves attributes | ||
| // the request omits, so there is no title to carry over — and getCount is what | ||
| // proves the extra read is gone, since the body alone cannot. | ||
| func TestCardsStepUpdateAssigneesOnlySendsNoTitle(t *testing.T) { | ||
| transport := &mockStepUpdateTransport{} | ||
| app := setupCardsMockApp(t, transport) | ||
| cmd := newCardsStepUpdateCmd() | ||
| err := executeCommand(cmd, app, "456", "--assignees", "789") | ||
| require.NoError(t, err) | ||
| assert.Equal(t, 1, transport.getCount) | ||
| assert.Equal(t, 0, transport.getCount, "expected no read-before-write") | ||
| var body map[string]any | ||
| require.NoError(t, json.Unmarshal(transport.capturedPut, &body)) | ||
| assert.Equal(t, "Current title", body["title"]) | ||
| assert.NotContains(t, body, "title", "must not echo back a field the caller never changed") | ||
jeremy marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| assert.Equal(t, []any{float64(789)}, body["assignee_ids"]) | ||
| } | ||
| // TestCardsStepUpdateDueOnlyCarriesTitle verifies that updating only the due | ||
| // date fetches the current step and includes its title in the request. | ||
| func TestCardsStepUpdateDueOnlyCarriesTitle(t *testing.T) { | ||
| // TestCardsStepUpdateDueOnlySendsNoTitle verifies the same for a due-date-only | ||
| // update. | ||
| func TestCardsStepUpdateDueOnlySendsNoTitle(t *testing.T) { | ||
| transport := &mockStepUpdateTransport{} | ||
| app := setupCardsMockApp(t, transport) | ||
| cmd := newCardsStepUpdateCmd() | ||
| err := executeCommand(cmd, app, "456", "--due", "2026-07-04") | ||
| require.NoError(t, err) | ||
| assert.Equal(t, 1, transport.getCount) | ||
| assert.Equal(t, 0, transport.getCount, "expected no read-before-write") | ||
| var body map[string]any | ||
| require.NoError(t, json.Unmarshal(transport.capturedPut, &body)) | ||
| assert.Equal(t, "Current title", body["title"]) | ||
| assert.NotContains(t, body, "title", "must not echo back a field the caller never changed") | ||
| assert.Equal(t, "2026-07-04", body["due_on"]) | ||
| } | ||
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.