Skip to content

fix(streams): safely parse stream flags without throwing on malformed ScVal (closes #617) - #690

Open
Ranjeet2063 wants to merge 1 commit into
conduit-protocol:mainfrom
Ranjeet2063:fix/issue-617-malformed-stream-flags
Open

fix(streams): safely parse stream flags without throwing on malformed ScVal (closes #617)#690
Ranjeet2063 wants to merge 1 commit into
conduit-protocol:mainfrom
Ranjeet2063:fix/issue-617-malformed-stream-flags

Conversation

@Ranjeet2063

Copy link
Copy Markdown

Summary

Closes #617.

This pull request ensures parseStreamInfo handles malformed or non-u32 flags values gracefully by falling back to 0 rather than raising an unhandled exception.

Changes Made

  • src/streams.ts: Wrapped scValToU32(m['flags']) in a safe conversion block with fallback to 0 if m['flags'] is present but contains an invalid/unexpected ScVal type.
  • src/tests/parse-stream-info.test.ts: Added unit test verifying that parseStreamInfo falls back to flags = 0 when flags is not a u32 ScVal (e.g. scvString('not-a-u32')), keeping paused, cancelled, and clawbackEnabled safely false.

Acceptance Verification

  1. npm test -- src/tests/parse-stream-info.test.ts passes with 7/7 tests green.
  2. Clean production ESM & CJS build (npm run build).

Copilot AI lite review requested due to automatic review settings September 6, 2026 00:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

parseStreamInfo must not throw on a malformed flags value

2 participants