fix: resolve tech debt from PRs #226/#229 CR - #235
Merged
Conversation
commit: |
jpr5
force-pushed
the
fix/bucket-c-tech-debt
branch
2 times, most recently
from
May 22, 2026 20:02
923c96a to
d63e152
Compare
When match.message is absent, the config loader was falling back to /.*/ which silently matched every incoming request and could shadow other fixtures. Now skips message matching when no pattern is specified.
Check that input.messages is an array after JSON.parse, return 400 with clear error instead of confusing downstream 404. Fix aguiInput() test helper to include threadId, runId, and id on messages.
Accept optional logger parameter consistent with other functions. Handle non-Error throws instead of silently swallowing them.
Align drift test helper with the fixed version in providers.ts — normalize line endings, strip data: prefixes per line, and rejoin.
jpr5
force-pushed
the
fix/bucket-c-tech-debt
branch
from
May 22, 2026 20:03
d63e152 to
38edd53
Compare
jpr5
added a commit
that referenced
this pull request
Jul 15, 2026
## Summary Fixes 4 tech debt items identified during code review of PRs #226/#229: - **Config loader catch-all**: When an AG-UI text-shorthand fixture omits `match.message`, the config loader was falling back to `/.*/` which matched every request. Now registers via `addFixture` without a message pattern so other criteria (toolCallId, toolName, stateKey) are honoured. - **Input validation**: Added runtime validation that `input.messages` is an array when provided, returning 400 with a clear error instead of letting downstream code fail. Also fixed the `aguiInput()` test helper to include `threadId`, `runId`, and `id` on messages matching the type definitions. - **Logger abstraction**: Replaced bare `console.warn` calls in `writeAGUIEventStream` with optional `logger` parameter (consistent with other functions in the file). Falls back to `console.warn` when no logger is provided. Added else branch for non-Error throws. - **SSE parser fragility**: Aligned `parseDataOnlySSE` in drift test helpers with the fixed version in `providers.ts` — normalizes `\r\n` line endings and handles multi-line data blocks by stripping `data:` prefixes and rejoining before `JSON.parse`. ## Test plan - [x] All 3202 tests pass - [x] Prettier formatting clean on all changed files - [x] ESLint clean on all changed files - [x] Each fix committed separately with descriptive message
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.
Summary
Fixes 4 tech debt items identified during code review of PRs #226/#229:
match.message, the config loader was falling back to/.*/which matched every request. Now registers viaaddFixturewithout a message pattern so other criteria (toolCallId, toolName, stateKey) are honoured.input.messagesis an array when provided, returning 400 with a clear error instead of letting downstream code fail. Also fixed theaguiInput()test helper to includethreadId,runId, andidon messages matching the type definitions.console.warncalls inwriteAGUIEventStreamwith optionalloggerparameter (consistent with other functions in the file). Falls back toconsole.warnwhen no logger is provided. Added else branch for non-Error throws.parseDataOnlySSEin drift test helpers with the fixed version inproviders.ts— normalizes\r\nline endings and handles multi-line data blocks by strippingdata:prefixes and rejoining beforeJSON.parse.Test plan