Skip to content

test(companion): sessionId correlation on invalid command bodies - #9

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/test-coverage-automation-93ad
Draft

test(companion): sessionId correlation on invalid command bodies#9
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/test-coverage-automation-93ad

Conversation

@cursor

@cursor cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Summary

Extends companion HTTP tests so invalid POST /commands bodies keep lifecycle.sessionId when present and omit it when empty.

Risky behavior now covered

  • Zod validation failures on command bodies still correlate to the caller session when sessionId is present
  • Empty sessionId is not echoed into lifecycle envelopes

Test files added/updated

  • services/companion/src/server.test.ts

Why these tests materially reduce regression risk

Session correlation in error envelopes is part of the companion lifecycle contract used by MCP/clients. Prior coverage only checked invalid bodies without a session id.

Validation

  • pnpm --filter @webchain/companion exec vitest run src/server.test.ts (15 passed)
Open in Web View Automation 

Assert lifecycle envelopes keep a present sessionId and omit empty
ones when Zod rejects POST /commands payloads.

Co-authored-by: esadrianno <esadrianno@gmail.com>
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