Skip to content

Switch SUBSCRIBE_DROP to use start/end instead of start/count#997

Merged
kixelated merged 2 commits intomainfrom
group-drop-v3
Feb 25, 2026
Merged

Switch SUBSCRIBE_DROP to use start/end instead of start/count#997
kixelated merged 2 commits intomainfrom
group-drop-v3

Conversation

@kixelated
Copy link
Collaborator

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

Walkthrough

The SubscribeDrop message was refactored in both TypeScript and Rust to replace sequence and count with start and end. In TypeScript (js/lite/src/lite/subscribe.ts) the class now accepts a { start, end, error } props object and encodes/decodes start, end, error. In Rust (rs/moq-lite/src/lite/subscribe.rs) the struct fields and Message impl were updated to encode/decode start and end (range documented as inclusive).

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No description was provided by the author, which makes it impossible to evaluate relevance to the changeset. Add a pull request description explaining the rationale for switching from start/count to start/end semantics and any impact on the protocol or users.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: renaming SUBSCRIBE_DROP message fields from sequence/count to start/end throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch group-drop-v3

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
js/lite/src/lite/subscribe.ts (1)

265-296: ⚠️ Potential issue | 🟡 Minor

Document end semantics and add a JSDoc comment to the public class.

Same concern as the Rust struct: end is undocumented as inclusive or exclusive, and the public SubscribeDrop class lacks any JSDoc. As per coding guidelines, public APIs should be documented with clear docstrings or comments.

📝 Suggested doc update
-/// Indicates that one or more groups have been dropped.
-///
-/// Draft03 only.
+/**
+ * Indicates that one or more groups in the range `[start, end]` (inclusive) have been dropped.
+ *
+ * Draft03 only.
+ */
 export class SubscribeDrop {
+	/** First dropped group ID (inclusive). */
 	start: number;
+	/** Last dropped group ID (inclusive). */
 	end: number;
 	error: number;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@js/lite/src/lite/subscribe.ts` around lines 265 - 296, Add a JSDoc block to
the public class SubscribeDrop that documents the class purpose and the
meaning/semantics of each field (start, end, error), explicitly stating whether
end is inclusive or exclusive, and any units or bounds; update the constructor
and public methods (encode and static decode) signatures with short param/return
JSDoc tags referencing SubscribeDrop, Writer and Reader so the API surface is
clear (mention that encode delegates to Message.encode and decode uses
SubscribeDrop.#decode). Ensure the comment appears immediately above the class
declaration and uses consistent wording with other public types in the repo.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rs/moq-lite/src/lite/subscribe.rs`:
- Around line 204-208: Document the inclusive/exclusive semantics of
SubscribeDrop::end (and clarify start) by adding a doc comment on the
SubscribeDrop struct or directly on the start and end fields that explicitly
states whether end is the index of the last dropped group (inclusive) or the
first non-dropped group (exclusive), and include an example or brief note about
how consumers should interpret them; update the comment for the error field if
needed to explain its relation to the range. Reference: SubscribeDrop struct and
its fields start, end, error.

---

Outside diff comments:
In `@js/lite/src/lite/subscribe.ts`:
- Around line 265-296: Add a JSDoc block to the public class SubscribeDrop that
documents the class purpose and the meaning/semantics of each field (start, end,
error), explicitly stating whether end is inclusive or exclusive, and any units
or bounds; update the constructor and public methods (encode and static decode)
signatures with short param/return JSDoc tags referencing SubscribeDrop, Writer
and Reader so the API surface is clear (mention that encode delegates to
Message.encode and decode uses SubscribeDrop.#decode). Ensure the comment
appears immediately above the class declaration and uses consistent wording with
other public types in the repo.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f1e289 and a7aee34.

📒 Files selected for processing (2)
  • js/lite/src/lite/subscribe.ts
  • rs/moq-lite/src/lite/subscribe.rs

@kixelated kixelated enabled auto-merge (squash) February 25, 2026 18:21
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
rs/moq-lite/src/lite/subscribe.rs (1)

220-232: Consider validating start <= end in the decode path.

A malformed peer could send end < start, which would decode cleanly into an inverted range. Any consumer iterating start..=end (a Rust inclusive range) over such a value would silently produce incorrect behavior (e.g., an empty iteration if using a checked range, or a wrap-around/panic if not).

🛡️ Proposed defensive check
 		Ok(Self {
 			start: u64::decode(r, version)?,
 			end: u64::decode(r, version)?,
 			error: u64::decode(r, version)?,
 		})
+		let start = u64::decode(r, version)?;
+		let end = u64::decode(r, version)?;
+		if end < start {
+			return Err(DecodeError::InvalidMessage(end));
+		}
 		Ok(Self {
-			start: u64::decode(r, version)?,
-			end: u64::decode(r, version)?,
+			start,
+			end,
 			error: u64::decode(r, version)?,
 		})
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rs/moq-lite/src/lite/subscribe.rs` around lines 220 - 232, In decode_msg,
after decoding start and end (the fields on the returned Self), validate that
start <= end and return an appropriate DecodeError if the check fails; update
the function handling in decode_msg (and any related version-specific branches
if necessary) to perform this defensive check before constructing and returning
Self so malformed inputs with end < start are rejected instead of producing
inverted ranges at runtime.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@rs/moq-lite/src/lite/subscribe.rs`:
- Around line 220-232: In decode_msg, after decoding start and end (the fields
on the returned Self), validate that start <= end and return an appropriate
DecodeError if the check fails; update the function handling in decode_msg (and
any related version-specific branches if necessary) to perform this defensive
check before constructing and returning Self so malformed inputs with end <
start are rejected instead of producing inverted ranges at runtime.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7aee34 and 676bacf.

📒 Files selected for processing (1)
  • rs/moq-lite/src/lite/subscribe.rs

@kixelated kixelated merged commit d29b515 into main Feb 25, 2026
1 check passed
@kixelated kixelated deleted the group-drop-v3 branch February 25, 2026 18:41
@moq-bot moq-bot bot mentioned this pull request Feb 25, 2026
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