fix: surface initial fields in lists.items.create method arguments#1600
Conversation
The `initial_fields` parameter was being sent as `intial_fields` (missing second 'i'), causing list items to be created without their initial field values. Fixes #1599 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Adds regression test for #1599 — ensures the created item's fields are populated when initialFields is provided. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Verify the exact column_id and rich_text content are returned on the created item, not just that fields are non-empty. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1600 +/- ##
============================================
- Coverage 73.32% 73.25% -0.07%
+ Complexity 4520 4516 -4
============================================
Files 478 478
Lines 14300 14300
Branches 1490 1490
============================================
- Hits 10486 10476 -10
- Misses 2923 2935 +12
+ Partials 891 889 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
left a comment
There was a problem hiding this comment.
🪐 A comment for the reviewers!
| assertThat(createItemResponse.getItem().getFields(), is(notNullValue())); | ||
| assertThat(createItemResponse.getItem().getFields().size(), is(1)); | ||
| assertThat(createItemResponse.getItem().getFields().get(0).getColumnId(), is(taskNameColId)); | ||
| assertThat(createItemResponse.getItem().getFields().get(0).getText(), is("Test task item")); |
There was a problem hiding this comment.
🪬 note: We now confirm the fields used above:
[DEBUG] createItemResponse item=ListRecord(id=Rec0B9VCSAABE, listId=F0B9KD6NECB, fields=[ListRecord.Field(key=task_name, columnId=Col0B9TKAUTND, value=[{"type":"rich_text","block_id":"h2z2t","elements":[{"type":"rich_text_section","elements":[{"type":"text","text":"Test task item"}]}]}], text=Test task item, richText=[RichTextBlock(type=rich_text, elements=[RichTextSectionElement(type=rich_text_section, elements=[RichTextSectionElement.Text(type=text, text=Test task item, style=null)])], blockId=h2z2t)], messages=null, message=null, number=null, select=null, date=null, user=null, attachment=null, checkbox=null, email=null, phone=null, channel=null, rating=null, timestamp=null, link=null, reference=null)], dateCreated=1781134963, createdBy=U09KU686163, threadTs=null, position=null, updatedTimestamp=1781134963, updatedBy=U09KU686163, viewPositions=null, platformRefs=null, isSubscribed=null, saved=null, savedFields=null)
| if (req.getInitialFields() != null) { | ||
| String json = getJsonWithGsonAnonymInnerClassHandling(req.getInitialFields()); | ||
| form.add("intial_fields", json); | ||
| form.add("initial_fields", json); |
There was a problem hiding this comment.
praise: Nice catch 🎉 Silent param-drops are the worst flavour of bug because nothing 4xxs and the request just succeeds with the field missing.
There was a problem hiding this comment.
💡 You're making me think erroring for unexpected fields might be ideal!
- Incorrect fields: should error
- Unexpected fields: removed as best practice
- New fields: added without issue
- Removed fields: makes noise for existing code! 👻
|
@mwbrooks Couldn't and wouldn't merge this without ya 🌟 Thanks a ton for kind review! |
Summary
Fix typo in
RequestFormBuilder.toForm(SlackListsItemsCreateRequest)whereinitial_fieldswas being sent asintial_fields(missing second 'i'), causing list items to be created without their initial field values set.Fixes #1599
Category
Example
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.