Skip to content

fix: mirror limits optional chaining#568

Merged
cameri merged 3 commits intocameri:mainfrom
tharu-jwd:fix/mirror-limits-optional-chaining
Apr 25, 2026
Merged

fix: mirror limits optional chaining#568
cameri merged 3 commits intocameri:mainfrom
tharu-jwd:fix/mirror-limits-optional-chaining

Conversation

@tharu-jwd
Copy link
Copy Markdown
Contributor

Description

Add optional chaining to this.config.limits?.event in StaticMirroringWorker.canAcceptEvent()

Related Issue

Fixes #567

Motivation and Context

Mirror.limits is typed as optional but was accessed without optional chaining. When a mirror entry has no limits block configured, this throws a TypeError inside the message handler which gets swallowed by the surrounding try/catch. So the mirror connects and subscribes fine, but silently drops every incoming event.

How Has This Been Tested?

Manually configured a mirror entry without a limits block and confirmed events are stored correctly after the fix.

Screenshots (if appropriate):

N/A

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a crash in StaticMirroringWorker.canAcceptEvent() when a static mirror entry omits the optional limits block, preventing mirrored events from being silently dropped.

Changes:

  • Use optional chaining when reading this.config.limits?.event to safely handle missing mirror limits.
  • Add a patch changeset documenting the bug fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/app/static-mirroring-worker.ts Prevents TypeError when Mirror.limits is undefined by using optional chaining.
.changeset/sunny-jars-try.md Adds a patch changeset entry for the static mirroring fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 25, 2026

Coverage Status

coverage: 75.491%. remained the same — tharu-jwd:fix/mirror-limits-optional-chaining into cameri:main

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 25, 2026

🦋 Changeset detected

Latest commit: e44ca9b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cameri cameri changed the title Fix/mirror limits optional chaining fix: mirror limits optional chaining Apr 25, 2026
@cameri cameri merged commit c0c1c35 into cameri:main Apr 25, 2026
13 checks passed
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.

[BUG] Static mirroring silently drops all events when mirror has no limits configured

4 participants