test(adapter): add finalize_body helper + 4-corner truth-table tests#4
Merged
dogzzdogzz merged 1 commit intoJun 22, 2026
Conversation
Addresses howie group-review 'Important #3' from PR openabdev#1115: the inline reset re-prepend branch at end of stream_prompt_blocks had no unit test. Extracts the four-line if-else into a pure helper finalize_body() and adds 4 tests covering every corner of (reset, keep_full_text, answer_start > 0). No behavior change — same truth table, just testable in isolation. Refs openabdev#1115 (comment)
dogzzdogzz
approved these changes
Jun 22, 2026
67ea868
into
dogzzdogzz:feat/slack-streaming-toggle
6 of 20 checks passed
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.
Adds a unit test for the
reset && !keep_full_text && answer_start > 0branch at the end ofstream_prompt_blocks— the inline if-else that re-prepends the session-reset notice when send-once trimming would otherwise drop it.Background — this addresses item #3 from my follow-up review on PR openabdev/openab#1115: that branch is the kind of edge case (
reset && !streaming && answer_start > 0) that's easy to break silently, and it had no dedicated test.What changes
stream_prompt_blocksinto a pure helperpub fn finalize_body(reset, keep_full_text, answer_start, body) -> String. No behavior change — same truth table, same call site, same conditions.(reset, keep_full_text, answer_start > 0):reset + send-once + tool ran→ notice re-prepended (the case from review item docs(slack): note reply_to bypass + clarify no-native-stream comment #3)reset + send-once + no tools→ pass through (notice already in slice viaanswer_start == 0)reset + keep_full_text→ pass through (slice already contains notice)no reset(both flag combos) → pass through (no notice to manage)Verification
cargo buildpasses on top of78fdee2cargo testpasses — all 4 new tests green, no existing tests brokenWhy a PR-to-PR
Layering this on top of openabdev#1115 rather than opening against
mainso it ships with the feature it tests. Merge intofeat/slack-streaming-toggleand it'll flow into openabdev#1115 automatically. Or pass entirely — the test gap is a nit, not a blocker.