Skip to content

Rename catalog task APIs to subscribe/unsubscribe#1140

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

Rename catalog task APIs to subscribe/unsubscribe#1140
kixelated wants to merge 4 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af7153cf-a222-443a-8d5d-c3a7c90ceebb

📥 Commits

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

📒 Files selected for processing (1)
  • doc/rs/crate/libmoq.md

Walkthrough

The catalog consumption C API in libmoq was reorganized: moq_consume_catalogmoq_consume_catalog_subscribe, moq_consume_catalog_freemoq_consume_catalog_close, and moq_consume_catalog_closemoq_consume_catalog_unsubscribe. Corresponding Rust FFI entrypoints and internal Consume methods were renamed to match the new subscribe/close/unsubscribe semantics. Public C API documentation (rs/libmoq/README.md) and tests were updated to reflect the new function names.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: renaming catalog task APIs from ambiguous names to subscribe/unsubscribe terminology.
Description check ✅ Passed The description is related to the changeset, listing the three specific function renames and providing the rationale for disambiguating task vs snapshot handles.
Linked Issues check ✅ Passed All coding requirements from issue #1064 are met: task-side APIs renamed to subscribe/unsubscribe, snapshot-side renamed from _free to _close, and video/audio config functions left unchanged.
Out of Scope Changes check ✅ Passed All changes are directly related to the renaming objective: function renames in README, api.rs, consume.rs, tests, and documentation updates explaining the new API semantics.
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.

Important

Merge conflicts detected (Beta)

  • Resolve merge conflict in branch catalog-rename
✨ Finishing Touches
🧪 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

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