Skip to content

fix: resolve tech debt from PRs #226/#229 CR#235

Merged
jpr5 merged 5 commits into
mainfrom
fix/bucket-c-tech-debt
May 22, 2026
Merged

fix: resolve tech debt from PRs #226/#229 CR#235
jpr5 merged 5 commits into
mainfrom
fix/bucket-c-tech-debt

Conversation

@jpr5
Copy link
Copy Markdown
Contributor

@jpr5 jpr5 commented May 22, 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

  • All 3202 tests pass
  • Prettier formatting clean on all changed files
  • ESLint clean on all changed files
  • Each fix committed separately with descriptive message

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@235

commit: 38edd53

@jpr5 jpr5 force-pushed the fix/bucket-c-tech-debt branch 2 times, most recently from 923c96a to d63e152 Compare May 22, 2026 20:02
@jpr5 jpr5 changed the title fix: resolve bucket(c) tech debt from PRs #226/#229 CR fix: resolve tech debt from PRs #226/#229 CR May 22, 2026
jpr5 added 5 commits May 22, 2026 13:03
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 jpr5 force-pushed the fix/bucket-c-tech-debt branch from d63e152 to 38edd53 Compare May 22, 2026 20:03
@jpr5 jpr5 merged commit 97fb2a5 into main May 22, 2026
23 checks passed
@jpr5 jpr5 deleted the fix/bucket-c-tech-debt branch May 22, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant