Skip to content

Rename catalog task APIs to subscribe/unsubscribe#1140

Open
kixelated wants to merge 2 commits intodevfrom
catalog-rename
Open

Rename catalog task APIs to subscribe/unsubscribe#1140
kixelated wants to merge 2 commits intodevfrom
catalog-rename

Conversation

@kixelated
Copy link
Collaborator

Summary

  • Rename moq_consume_catalog()moq_consume_catalog_subscribe()
  • Rename moq_consume_catalog_close()moq_consume_catalog_unsubscribe()
  • Rename moq_consume_catalog_free()moq_consume_catalog_close()

This disambiguates the two kinds of catalog u32 handles (task vs snapshot) which previously both had "catalog" in the name with unclear close/free semantics.

Closes #1064

Test plan

  • cargo check -p libmoq passes
  • cargo test -p libmoq — all 14 tests pass
  • just check passes

🤖 Generated with Claude Code

Disambiguate the two kinds of catalog handles (task vs snapshot) by
renaming the task-side functions to use subscribe/unsubscribe terminology:

- moq_consume_catalog() → moq_consume_catalog_subscribe()
- moq_consume_catalog_close() → moq_consume_catalog_unsubscribe()
- moq_consume_catalog_free() → moq_consume_catalog_close()

Closes #1064

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

Walkthrough

The C API for catalog consumption in libmoq was changed: moq_consume_catalog was renamed to moq_consume_catalog_subscribe; moq_consume_catalog_close was renamed to moq_consume_catalog_unsubscribe; and moq_consume_catalog_free was renamed to moq_consume_catalog_close. Corresponding Rust FFI entrypoints and internal Consume methods were renamed to match, and tests were updated to call the new function names.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly and concisely summarizes the main change: renaming catalog task APIs to subscribe/unsubscribe terminology.
Description check ✅ Passed Description provides clear, specific changes and context: explains the three API renames, the motivation (disambiguating task vs snapshot handles), and verifies all tests pass.
Linked Issues check ✅ Passed Pull request fully addresses #1064 requirements: renames task-side APIs (catalog→subscribe, catalog_close→unsubscribe), renames snapshot-side free→close, keeps video/audio configs unchanged, and targets dev branch.
Out of Scope Changes check ✅ Passed All changes are in-scope: catalog API renames and tests updated accordingly. No unrelated modifications introduced.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch catalog-rename
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch catalog-rename
📝 Coding Plan
  • Generate coding plan for human review comments

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.

🧹 Nitpick comments (1)
rs/libmoq/src/api.rs (1)

392-396: Rename unsubscribe handle variable to task (or catalog_task) to complete disambiguation.

moq_consume_catalog_unsubscribe currently names its handle catalog, which can still mislead callers into passing snapshot IDs.

♻️ Proposed fix
-pub extern "C" fn moq_consume_catalog_unsubscribe(catalog: u32) -> i32 {
+pub extern "C" fn moq_consume_catalog_unsubscribe(task: u32) -> i32 {
 	ffi::enter(move || {
-		let catalog = ffi::parse_id(catalog)?;
-		State::lock().consume.catalog_unsubscribe(catalog)
+		let task = ffi::parse_id(task)?;
+		State::lock().consume.catalog_unsubscribe(task)
 	})
 }

Please mirror this naming in rs/libmoq/src/consume.rs and rs/libmoq/README.md for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rs/libmoq/src/api.rs` around lines 392 - 396, Rename the ambiguous "catalog"
handle in moq_consume_catalog_unsubscribe to "task" (or "catalog_task"): change
the function parameter name from catalog: u32 to task: u32, update the local let
catalog = ffi::parse_id(catalog)? to let task = ffi::parse_id(task)? (or let
catalog_task = ...), and use that new variable when calling
State::lock().consume.catalog_unsubscribe(...). Apply the same renaming for the
corresponding handle variable in the consume module (functions in consume.rs
that accept or document this handle) and update the handle name in
rs/libmoq/README.md so examples and docs use "task" or "catalog_task"
consistently.
🤖 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/libmoq/src/api.rs`:
- Around line 392-396: Rename the ambiguous "catalog" handle in
moq_consume_catalog_unsubscribe to "task" (or "catalog_task"): change the
function parameter name from catalog: u32 to task: u32, update the local let
catalog = ffi::parse_id(catalog)? to let task = ffi::parse_id(task)? (or let
catalog_task = ...), and use that new variable when calling
State::lock().consume.catalog_unsubscribe(...). Apply the same renaming for the
corresponding handle variable in the consume module (functions in consume.rs
that accept or document this handle) and update the handle name in
rs/libmoq/README.md so examples and docs use "task" or "catalog_task"
consistently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 58546526-3a41-48b2-acf8-1a32e7201400

📥 Commits

Reviewing files that changed from the base of the PR and between 2626a25 and 0048d19.

📒 Files selected for processing (4)
  • rs/libmoq/README.md
  • rs/libmoq/src/api.rs
  • rs/libmoq/src/consume.rs
  • rs/libmoq/src/test.rs

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/libmoq/src/api.rs (1)

393-397: Consider renaming the parameter for clarity.

Since the PR's goal is to disambiguate task handles from snapshot handles, the parameter catalog in this function could be renamed to subscription or task to make it clearer that this takes the handle returned by moq_consume_catalog_subscribe, not a snapshot handle from the callback.

💡 Optional: rename parameter
-pub extern "C" fn moq_consume_catalog_unsubscribe(catalog: u32) -> i32 {
+pub extern "C" fn moq_consume_catalog_unsubscribe(subscription: u32) -> i32 {
 	ffi::enter(move || {
-		let catalog = ffi::parse_id(catalog)?;
-		State::lock().consume.catalog_unsubscribe(catalog)
+		let subscription = ffi::parse_id(subscription)?;
+		State::lock().consume.catalog_unsubscribe(subscription)
 	})
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rs/libmoq/src/api.rs` around lines 393 - 397, Rename the parameter `catalog`
in the function `moq_consume_catalog_unsubscribe` to a clearer name like
`subscription` (or `task`) to reflect that it accepts the handle returned by
`moq_consume_catalog_subscribe` rather than a snapshot handle; update the local
binding passed to `ffi::parse_id` (e.g., `let subscription =
ffi::parse_id(subscription)?;`) and update the call into
`State::lock().consume.catalog_unsubscribe(subscription)` so the variable name
matches and intent is unambiguous.
🤖 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/libmoq/src/api.rs`:
- Around line 393-397: Rename the parameter `catalog` in the function
`moq_consume_catalog_unsubscribe` to a clearer name like `subscription` (or
`task`) to reflect that it accepts the handle returned by
`moq_consume_catalog_subscribe` rather than a snapshot handle; update the local
binding passed to `ffi::parse_id` (e.g., `let subscription =
ffi::parse_id(subscription)?;`) and update the call into
`State::lock().consume.catalog_unsubscribe(subscription)` so the variable name
matches and intent is unambiguous.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dccfbc54-7bf5-47da-8030-7fc05b033dab

📥 Commits

Reviewing files that changed from the base of the PR and between 0048d19 and 0494687.

📒 Files selected for processing (2)
  • rs/libmoq/src/api.rs
  • rs/libmoq/src/consume.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • rs/libmoq/src/consume.rs

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