Skip to content

framing: give-up scan also looks inside a phantom header - #110

Merged
abdulsaheel merged 1 commit into
mainfrom
fix/giveup-scan-phantom
Dec 5, 2026
Merged

abdulsaheel merged 1 commit into
mainfrom
fix/giveup-scan-phantom

Conversation

@abdulsaheel

@abdulsaheel abdulsaheel commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

with giveUpTruncatedFrames on, the scan started at headerLen, so a real frame starting inside a phantom header (stray 0xAA that passes the header crc) got swallowed into the truncated span. scan from 1 now, payload slice clamped so it never runs backwards. replaced the old own-header test since that case is indistinguishable from a phantom.

Summary by Sourcery

Recover valid frames that begin within a phantom header when giving up on a truncated frame.

Bug Fixes:

  • Prevent give-up recovery from swallowing a valid frame that begins inside a phantom header.

Tests:

  • Replace the prior own-header recovery test with coverage for recovering a valid frame within a phantom header.

@sourcery-ai

sourcery-ai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Scan from inside the pending header so a real frame within a phantom header can be recovered, and clamp the truncated payload slice to avoid running backwards.

  • lib/src/framing.dart L239-242, L283-289

Tests

Replace the own-header case with a regression test proving give-up recovers a real frame that starts inside a phantom header.

  • test/framing_test.dart L247-250, L261-266

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Dec 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 97093d40-528d-4a46-9b5e-371fff62baa1
Commits

Reviewing files that changed from the base of the PR and between 13086d7 and c0b58e6.

Files selected for processing: 2

  • lib/src/framing.dart
  • test/framing_test.dart
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sourcery-ai sourcery-ai Bot 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@abdulsaheel
abdulsaheel merged commit 78bf8e7 into main Dec 5, 2026
4 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.

1 participant