Skip to content

Add typeguards for frame processors in order to avoid dual package hazard#608

Merged
lukasIO merged 9 commits intomainfrom
lukas/processor-typeguards
Feb 12, 2026
Merged

Add typeguards for frame processors in order to avoid dual package hazard#608
lukasIO merged 9 commits intomainfrom
lukas/processor-typeguards

Conversation

@lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Feb 12, 2026

Instead of relying on unreliable instanceof checks we introduce a dedicated symbol and type to make it both easy to differentiate which kind of processor and also whether or not it is one in the first place.

@lukasIO lukasIO requested a review from 1egoman February 12, 2026 15:58
@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 3209a24

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

This PR includes changesets to release 6 packages
Name Type
@livekit/rtc-node Minor
@livekit/rtc-node-darwin-arm64 Minor
@livekit/rtc-node-darwin-x64 Minor
@livekit/rtc-node-linux-arm64-gnu Minor
@livekit/rtc-node-linux-x64-gnu Minor
@livekit/rtc-node-win32-x64-msvc Minor

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

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

🐛 1 issue in files not directly in the diff

🐛 New type guards and symbols not exported from package public API (packages/livekit-rtc/src/index.ts:53-57)

The new type guard functions (isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor), FrameProcessorSymbol, and FrameProcessorType are defined in frame_processor.ts but not re-exported from index.ts, which is the package's public entry point.

Root Cause and Impact

The entire purpose of this PR is to provide type guards to avoid the dual package hazard with instanceof checks. However, consumers of the @livekit/rtc-node package cannot access these new utilities because they are not exported from packages/livekit-rtc/src/index.ts:53-57:

export {
  FrameProcessor,
  type FrameProcessorStreamInfo,
  type FrameProcessorCredentials,
} from './frame_processor.js';

The new exports isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor, FrameProcessorSymbol, and FrameProcessorType are missing from this block. External consumers who want to use the type guards (the primary feature of this PR) will be unable to import them from the package.

Impact: The main feature of the PR is inaccessible to external users. They would have to resort to deep imports from internal module paths, which is fragile and not part of the public API contract.

View 6 additional findings in Devin Review.

Open in Devin Review

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

🐛 1 issue in files not directly in the diff

🐛 New type guards and symbols not exported from package public API (packages/livekit-rtc/src/index.ts:53-57)

The new type guard functions (isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor), FrameProcessorSymbol, and FrameProcessorType are defined in frame_processor.ts but not re-exported from index.ts, which is the package's public entry point.

Root Cause and Impact

The entire purpose of this PR is to provide type guards to avoid the dual package hazard with instanceof checks. However, consumers of the @livekit/rtc-node package cannot access these new utilities because they are not exported from packages/livekit-rtc/src/index.ts:53-57:

export {
  FrameProcessor,
  type FrameProcessorStreamInfo,
  type FrameProcessorCredentials,
} from './frame_processor.js';

The new exports isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor, FrameProcessorSymbol, and FrameProcessorType are missing from this block. External consumers who want to use the type guards (the primary feature of this PR) will be unable to import them from the package.

Impact: The main feature of the PR is inaccessible to external users. They would have to resort to deep imports from internal module paths, which is fragile and not part of the public API contract.

View 9 additional findings in Devin Review.

Open in Devin Review

}

export abstract class FrameProcessor<Frame extends VideoFrame | AudioFrame> {
readonly symbol = FrameProcessorSymbol;
Copy link
Contributor

@1egoman 1egoman Feb 12, 2026

Choose a reason for hiding this comment

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

todo: Since think this means that it won't work with frame processors defined with old @livekit/rtc-node versions, make sure you don't forget to update the peerDependency version in the aic package after you've tested all this locally and are ready to release your changes!

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

🐛 1 issue in files not directly in the diff

🐛 New type guards and symbols not exported from package public API (packages/livekit-rtc/src/index.ts:53-57)

The new type guard functions (isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor), FrameProcessorSymbol, and FrameProcessorType are defined in frame_processor.ts but not re-exported from index.ts, which is the package's public entry point.

Root Cause and Impact

The entire purpose of this PR is to provide type guards to avoid the dual package hazard with instanceof checks. However, consumers of the @livekit/rtc-node package cannot access these new utilities because they are not exported from packages/livekit-rtc/src/index.ts:53-57:

export {
  FrameProcessor,
  type FrameProcessorStreamInfo,
  type FrameProcessorCredentials,
} from './frame_processor.js';

The new exports isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor, FrameProcessorSymbol, and FrameProcessorType are missing from this block. External consumers who want to use the type guards (the primary feature of this PR) will be unable to import them from the package.

Impact: The main feature of the PR is inaccessible to external users. They would have to resort to deep imports from internal module paths, which is fragile and not part of the public API contract.

View 10 additional findings in Devin Review.

Open in Devin Review

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

🐛 1 issue in files not directly in the diff

🐛 New type guards and symbols not exported from package public API (packages/livekit-rtc/src/index.ts:53-57)

The new type guard functions (isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor), FrameProcessorSymbol, and FrameProcessorType are defined in frame_processor.ts but not re-exported from index.ts, which is the package's public entry point.

Root Cause and Impact

The entire purpose of this PR is to provide type guards to avoid the dual package hazard with instanceof checks. However, consumers of the @livekit/rtc-node package cannot access these new utilities because they are not exported from packages/livekit-rtc/src/index.ts:53-57:

export {
  FrameProcessor,
  type FrameProcessorStreamInfo,
  type FrameProcessorCredentials,
} from './frame_processor.js';

The new exports isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor, FrameProcessorSymbol, and FrameProcessorType are missing from this block. External consumers who want to use the type guards (the primary feature of this PR) will be unable to import them from the package.

Impact: The main feature of the PR is inaccessible to external users. They would have to resort to deep imports from internal module paths, which is fragile and not part of the public API contract.

View 8 additional findings in Devin Review.

Open in Devin Review

@lukasIO lukasIO merged commit e2c6c6c into main Feb 12, 2026
16 checks passed
@lukasIO lukasIO deleted the lukas/processor-typeguards branch February 12, 2026 19:10
Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

🐛 1 issue in files not directly in the diff

🐛 New type guards and symbols not exported from package public API (packages/livekit-rtc/src/index.ts:53-57)

The new type guard functions (isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor), FrameProcessorSymbol, and FrameProcessorType are defined in frame_processor.ts but not re-exported from index.ts, which is the package's public entry point.

Root Cause and Impact

The entire purpose of this PR is to provide type guards to avoid the dual package hazard with instanceof checks. However, consumers of the @livekit/rtc-node package cannot access these new utilities because they are not exported from packages/livekit-rtc/src/index.ts:53-57:

export {
  FrameProcessor,
  type FrameProcessorStreamInfo,
  type FrameProcessorCredentials,
} from './frame_processor.js';

The new exports isFrameProcessor, isAudioFrameProcessor, isVideoFrameProcessor, FrameProcessorSymbol, and FrameProcessorType are missing from this block. External consumers who want to use the type guards (the primary feature of this PR) will be unable to import them from the package.

Impact: The main feature of the PR is inaccessible to external users. They would have to resort to deep imports from internal module paths, which is fragile and not part of the public API contract.

View 11 additional findings in Devin Review.

Open in Devin Review

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.

2 participants