Repository navigation
fix: send thread_ts once in chat.postMessage requests - #1684
WilliamBergamin merged 7 commits into
Conversation
|
hey again @mwbrooks! this one’s much simpler than my last PR 😄 caught |
WilliamBergamin
left a comment
There was a problem hiding this comment.
🧪 Thanks @Adam-Schildkraut! Pinning every chat.postMessage field to exactly one occurrence is a nice way to guard this, and it fails on the old double insert.
Left a couple of comments 💯
- : 💯 praise: Nice catch, this duplicate has been riding along since 2019. The call that stays has the same null guard, so this is a clean fix with no behavior change for anyone 🙏
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1684 +/- ##
============================================
+ Coverage 74.06% 75.81% +1.75%
- Complexity 4828 4931 +103
============================================
Files 490 490
Lines 15033 15032 -1
Branches 1584 1584
============================================
+ Hits 11134 11397 +263
+ Misses 2972 2776 -196
+ Partials 927 859 -68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
🔭 question: Thanks for finding this duplicate! Could this be solved more generically in |
|
hey @WilliamBergamin! thanks, good catch 😄 i’ve added that assert, so the test now checks that |
|
heya @zimeg!! i took your broader-test suggestion and pushed it! so the existing RequestFormBuilderTest now checks every |
|
@Adam-Schildkraut could you resolve the merge conflict once addressed I can give this another review 🙏 |
|
@WilliamBergamin fixed! |
|
@WilliamBergamin just brought this back up to date if you have time to review this week :) |
WilliamBergamin
left a comment
There was a problem hiding this comment.
🧪 Thanks @Adam-Schildkraut! The thread_ts value assert landed, and checking every toForm for duplicate fields guards the whole builder against this bug.
Left one comment, nothing blocking 🙏
| } | ||
|
|
||
| @Test | ||
| public void testAllFormsSerializeFieldNamesOnce() throws ReflectiveOperationException { |
There was a problem hiding this comment.
💯 praise: Running every toForm with all fields set catches this whole class of duplicate field bug, not just thread_ts.
| checked++; | ||
| assertUniqueFormFields(method, "all fields", Collections.emptySet()); | ||
|
|
||
| // JSON strings take precedence over objects, so an all-fields request skips those object paths. |
There was a problem hiding this comment.
🪓 suggestion (non-blocking): Could the comments here and at lines 124, 570, and 595 become names instead? For example a jsonStringFields(requestType) helper here and an emptySlackModel(valueType) helper at 595; the variant labels and "unused-by-toForm" already explain the other two.
When
chat.postMessageis given a thread timestamp, the SDK addsthread_tsto the form body twice. Both entries contain the same value, but clients inspecting the request can fail when they expect one value per field.The field is already added earlier in the same method. This removes the second insertion. The test checks that each expected field in a populated message form appears exactly once, regardless of order. It fails before the fix and passes afterwards.
Validation:
RequestFormBuilderTestand the localChatTestsuite on Java 17.Category (place an
xin each of the[ ])Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.