Skip to content

fix(stream): guard convertValue to prevent stream crash on unknown field type#100

Merged
zeevdr merged 2 commits into
mainfrom
fix/ts92-guard-convertvalue
May 25, 2026
Merged

fix(stream): guard convertValue to prevent stream crash on unknown field type#100
zeevdr merged 2 commits into
mainfrom
fix/ts92-guard-convertvalue

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 25, 2026

Summary

Test plan

  • Unknown field type does not crash the stream
  • Warning is logged for unconvertible values
  • Stream continues after a bad value
  • Existing stream tests pass

…eld type

Wrap convertValue calls in _loadInitial() and _update() with try/catch.
On conversion error the field falls back to its default (loadInitial) or
retains its last good value (_update), emits a non-fatal conversionError
event on the WatchedField, logs a warning, and returns — the gRPC stream
continues processing remaining fields.

Add WatchedFieldEvents type map with change and conversionError events.

Closes #92

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/watcher.ts 88.88% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zeevdr zeevdr merged commit 69a38bf into main May 25, 2026
12 checks passed
@zeevdr zeevdr deleted the fix/ts92-guard-convertvalue branch May 25, 2026 20:29
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.

Guard convertValue in stream handler to prevent crash

1 participant