Skip to content

Comments

Rename path back to name.#989

Merged
kixelated merged 3 commits intomainfrom
no-path
Feb 24, 2026
Merged

Rename path back to name.#989
kixelated merged 3 commits intomainfrom
no-path

Conversation

@kixelated
Copy link
Collaborator

IDK I think it's easier to understand.
And moq-transport calls it namespace

IDK I think it's easier to understand.
And moq-transport calls it namespace
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Walkthrough

The change renames the broadcast identifier from path to name across the repository. Public-facing surfaces updated include Web Component attributes (moq-publish, moq-watch), documentation examples (React, SolidJS, Vue, HTML), demo pages and scripts, and TypeScript/JS component props and signals. Internal classes and modules (publish/watch Broadcast implementations, element classes, and demo config) have their public getters/setters, observedAttributes, event payloads, and constructor/property names changed from path to name. Control flow and runtime behavior are unchanged.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Rename path back to name' clearly and concisely describes the main change—a semantic rename of a broadcast identifier attribute throughout the codebase from 'path' to 'name'.
Description check ✅ Passed The description explains the rationale for the change and relates it to broader API design considerations, providing meaningful context about why 'name' is preferred over 'path'.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 no-path

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: 2

Caution

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

⚠️ Outside diff range comments (1)
js/demo/src/publish.html (1)

45-45: ⚠️ Potential issue | 🟡 Minor

Stale prose — "broadcast path" should be "broadcast name"

Line 45 still reads "Reusing the same broadcast path…" after the rename to name. This is inconsistent with the rest of the file.

📝 Proposed fix
-		Reusing the same broadcast path means viewers will automatically reconnect to the new session.
+		Reusing the same broadcast name means viewers will automatically reconnect to the new session.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@js/demo/src/publish.html` at line 45, Update the stale text "Reusing the same
broadcast path means viewers will automatically reconnect to the new session."
to use the new identifier by replacing "broadcast path" with "broadcast name" so
the prose matches the renamed variable `name` (search for that exact sentence in
publish.html and change "path" → "name").
🧹 Nitpick comments (2)
js/watch/src/element.ts (1)

89-96: Minor note: name attribute may collide with HTML semantics in certain contexts.

Using "name" as an HTML attribute on a custom element works fine, but be aware that name is a well-known attribute in HTML (form elements). If <moq-watch> is ever placed inside a <form>, the browser may treat the name attribute as the form control name. This is unlikely to be an issue for a media playback component, but worth noting.

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

In `@js/watch/src/element.ts` around lines 89 - 96, The code sets the HTML "name"
attribute in the reactive effect (this.signals.run -> effect.get(this.name) ->
setAttribute("name") / removeAttribute("name")), which can collide with form
semantics; change to a nonstandard or namespaced attribute (e.g. "data-name" or
"watch-name") by introducing a single attribute constant (e.g. const
ATTRIBUTE_NAME = "data-name") and use that constant in place of the literal
"name" in setAttribute/removeAttribute and any related lookups or consumers;
update any code that reads this attribute to use the new attribute name.
js/demo/src/config.ts (1)

9-9: Internal naming still references path while public API uses name.

The private field #pathInput (line 9), the method #onPathChange (line 107), and the comment "Create path input" (line 32) still use the old path terminology while the public API (get name(), observed attribute "name", event detail name) has been renamed. This creates a mild disconnect for future maintainers.

Consider renaming these internals in a follow-up for consistency:

♻️ Suggested internal renames
-	`#pathInput`: HTMLInputElement;
+	`#nameInput`: HTMLInputElement;
-	// Create path input
+	// Create name input
 	const pathLabel = document.createElement("label");
-	`#onPathChange`() {
-		this.setAttribute("name", this.#pathInput.value);
+	`#onNameChange`() {
+		this.setAttribute("name", this.#nameInput.value);
 		this.#dispatchChange();
 	}

(Plus updating all #pathInput references to #nameInput and #onPathChange to #onNameChange throughout.)

Also applies to: 32-33, 107-110

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

In `@js/demo/src/config.ts` at line 9, Private internals still use "path" naming
causing inconsistency with the public API; rename the private field `#pathInput`
to `#nameInput`, rename the private method `#onPathChange` to `#onNameChange`, and
update the comment "Create path input" to "Create name input" (also update every
reference to `#pathInput` and `#onPathChange` throughout the file), ensuring the
getters/setters get name(), observedAttributes include "name", and event.detail
uses name remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@js/demo/src/index.html`:
- Line 74: The example uses a stale room attribute on the custom element
<moq-watch>; remove the unsupported room="demo" attribute from the tag so the
snippet only uses the element's observed attributes (url, name, controls,
paused, muted, volume, jitter, reload), i.e., update the <moq-watch ...> example
to omit room and keep only valid attributes like url and name.

In `@js/demo/src/index.ts`:
- Line 16: The assignment to const name currently uses
urlParams.get("broadcast") ?? urlParams.get("name") which drops support for the
legacy ?path=... parameter; update the expression in the initialization of name
(the const named "name") to include the old key as an additional fallback (e.g.,
urlParams.get("broadcast") ?? urlParams.get("name") ?? urlParams.get("path")) so
existing ?path=... links continue to work, or alternatively accept both by
checking for path first if you want backward priority.

---

Outside diff comments:
In `@js/demo/src/publish.html`:
- Line 45: Update the stale text "Reusing the same broadcast path means viewers
will automatically reconnect to the new session." to use the new identifier by
replacing "broadcast path" with "broadcast name" so the prose matches the
renamed variable `name` (search for that exact sentence in publish.html and
change "path" → "name").

---

Nitpick comments:
In `@js/demo/src/config.ts`:
- Line 9: Private internals still use "path" naming causing inconsistency with
the public API; rename the private field `#pathInput` to `#nameInput`, rename the
private method `#onPathChange` to `#onNameChange`, and update the comment "Create
path input" to "Create name input" (also update every reference to `#pathInput`
and `#onPathChange` throughout the file), ensuring the getters/setters get name(),
observedAttributes include "name", and event.detail uses name remain unchanged.

In `@js/watch/src/element.ts`:
- Around line 89-96: The code sets the HTML "name" attribute in the reactive
effect (this.signals.run -> effect.get(this.name) -> setAttribute("name") /
removeAttribute("name")), which can collide with form semantics; change to a
nonstandard or namespaced attribute (e.g. "data-name" or "watch-name") by
introducing a single attribute constant (e.g. const ATTRIBUTE_NAME =
"data-name") and use that constant in place of the literal "name" in
setAttribute/removeAttribute and any related lookups or consumers; update any
code that reads this attribute to use the new attribute name.

// If query params are provided, use them.
const urlParams = new URLSearchParams(window.location.search);
const path = urlParams.get("broadcast") ?? urlParams.get("path");
const name = urlParams.get("broadcast") ?? urlParams.get("name");
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Breaking change for existing ?path= query parameter users.

The query parameter fallback changed from urlParams.get("path") to urlParams.get("name"). Users who bookmarked or shared URLs with ?path=... will need to update to ?name=.... The ?broadcast= param is still supported as the primary key, which is good.

This is expected given the PR's intent, but worth noting in release notes if applicable.

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

In `@js/demo/src/index.ts` at line 16, The assignment to const name currently uses
urlParams.get("broadcast") ?? urlParams.get("name") which drops support for the
legacy ?path=... parameter; update the expression in the initialization of name
(the const named "name") to include the old key as an additional fallback (e.g.,
urlParams.get("broadcast") ?? urlParams.get("name") ?? urlParams.get("path")) so
existing ?path=... links continue to work, or alternatively accept both by
checking for path first if you want backward priority.

kixelated and others added 2 commits February 20, 2026 19:09
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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 (3)
js/publish/src/element.ts (2)

230-235: Add a short doc comment for the public name API.

A brief JSDoc clarifying what “name” represents will help consumers use it correctly. As per coding guidelines, "Document public APIs with clear docstrings or comments".

📝 Example
+	/** Broadcast name (full namespace/path, if applicable). */
	get name(): Moq.Path.Valid | undefined {
		return this.broadcast.name.peek();
	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@js/publish/src/element.ts` around lines 230 - 235, Add a short JSDoc for the
public property "name" on the class: describe what the getter (name ->
this.broadcast.name.peek()) returns (type Moq.Path.Valid | undefined) and what
the setter (name(value) -> this.broadcast.name.set(value ? Moq.Path.from(value)
: undefined)) accepts and does (accepts string or Moq.Path.Valid, converts via
Moq.Path.from and stores it). Place the doc comment immediately above the get
name()/set name(...) pair and mention any semantics (nullable/optional,
normalized via Moq.Path.from) so callers know expected input and behavior.

123-129: Consider a deprecated path alias for smoother upgrades.

Removing path is a breaking change for existing consumers of the web component. If you want a softer transition, keep path as a deprecated alias that maps to name for at least one release (and optionally log a deprecation warning).

♻️ Suggested compatibility shim
-		} else if (name === "name") {
+		} else if (name === "name" || name === "path") {
			this.broadcast.name.set(newValue ? Moq.Path.from(newValue) : undefined);
// Also keep the deprecated attribute in OBSERVED for one release:
const OBSERVED = ["url", "name", "path", "muted", "invisible", "source"] as const;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@js/publish/src/element.ts` around lines 123 - 129, The
attributeChangedCallback currently handles "url" and "name" but drops "path"
which breaks existing consumers; keep "path" as a deprecated alias by adding
"path" to the OBSERVED list and treat it the same as "name" inside
attributeChangedCallback (map "path" to set this.broadcast.name using
Moq.Path.from(newValue)), and optionally emit a single deprecation warning
(e.g., console.warn or a logger) when "path" is used so consumers see the
migration hint.
js/watch/src/element.ts (1)

172-177: Add a short doc comment for the public name API.

A brief JSDoc clarifying what “name” represents will help consumers use it correctly. As per coding guidelines, "Document public APIs with clear docstrings or comments".

📝 Example
+	/** Broadcast name (full namespace/path, if applicable). */
	get name(): Moq.Path.Valid | undefined {
		return this.broadcast.name.peek();
	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@js/watch/src/element.ts` around lines 172 - 177, Add a short JSDoc comment
above the public name getter/setter describing what the property represents
(e.g., the broadcast's logical path/identifier), the accepted types (string |
Moq.Path.Valid | undefined) and behavior (setter converts string via
Moq.Path.from and stores undefined to clear), and mention any constraints or
expected format so callers know how to use the name API (place the comment
directly above the get name()/set name(...) declarations).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@js/publish/src/element.ts`:
- Around line 230-235: Add a short JSDoc for the public property "name" on the
class: describe what the getter (name -> this.broadcast.name.peek()) returns
(type Moq.Path.Valid | undefined) and what the setter (name(value) ->
this.broadcast.name.set(value ? Moq.Path.from(value) : undefined)) accepts and
does (accepts string or Moq.Path.Valid, converts via Moq.Path.from and stores
it). Place the doc comment immediately above the get name()/set name(...) pair
and mention any semantics (nullable/optional, normalized via Moq.Path.from) so
callers know expected input and behavior.
- Around line 123-129: The attributeChangedCallback currently handles "url" and
"name" but drops "path" which breaks existing consumers; keep "path" as a
deprecated alias by adding "path" to the OBSERVED list and treat it the same as
"name" inside attributeChangedCallback (map "path" to set this.broadcast.name
using Moq.Path.from(newValue)), and optionally emit a single deprecation warning
(e.g., console.warn or a logger) when "path" is used so consumers see the
migration hint.

In `@js/watch/src/element.ts`:
- Around line 172-177: Add a short JSDoc comment above the public name
getter/setter describing what the property represents (e.g., the broadcast's
logical path/identifier), the accepted types (string | Moq.Path.Valid |
undefined) and behavior (setter converts string via Moq.Path.from and stores
undefined to clear), and mention any constraints or expected format so callers
know how to use the name API (place the comment directly above the get
name()/set name(...) declarations).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 235dbf4 and e10740a.

📒 Files selected for processing (2)
  • js/publish/src/element.ts
  • js/watch/src/element.ts

@kixelated kixelated merged commit ba5e3f5 into main Feb 24, 2026
1 check passed
@kixelated kixelated deleted the no-path branch February 24, 2026 03:36
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