Skip to content

Change getFullPaths candidate language from "priority" to "preference"#2235

Merged
lawrence-forooghian merged 1 commit into
mainfrom
getFullPaths-preference-not-priority
Jun 16, 2026
Merged

Change getFullPaths candidate language from "priority" to "preference"#2235
lawrence-forooghian merged 1 commit into
mainfrom
getFullPaths-preference-not-priority

Conversation

@lawrence-forooghian

@lawrence-forooghian lawrence-forooghian commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

"Priority" implies something to do with importance; instead, use the "preference" language that I used in spec point RTO24b2a.

Summary by CodeRabbit

  • Improvements
    • Updated routing for path-based subscription events to prefer more direct, shorter matching candidate paths.
    • For live map updates, each changed key now contributes an additional preferred candidate path, improving accuracy when multiple subscriptions match.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

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: 0d022cb5-4cef-48c4-8012-2ff3b92503de

📥 Commits

Reviewing files that changed from the base of the PR and between 81e2864 and ae8a4d3.

📒 Files selected for processing (2)
  • src/plugins/liveobjects/liveobject.ts
  • src/plugins/liveobjects/pathobjectsubscriptionregister.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/plugins/liveobjects/liveobject.ts
  • src/plugins/liveobjects/pathobjectsubscriptionregister.ts

Walkthrough

The PR renames PathEvent's candidate-paths field to preferenceOrderedCandidatePaths, updates LiveObject to build preference-ordered candidate lists (including added map-key candidates), and updates the subscription register to choose the first matching candidate from that preference-ordered list.

Changes

Path candidate ordering refactor: priority-ordered to preference-ordered semantics

Layer / File(s) Summary
PathEvent contract update
src/plugins/liveobjects/pathobjectsubscriptionregister.ts
The PathEvent interface field priorityOrderedCandidatePaths is renamed to preferenceOrderedCandidatePaths and documentation updated to reflect preference-ordered semantics.
LiveObject preference-ordered path construction
src/plugins/liveobjects/liveobject.ts
_notifyPathSubscriptions initializes preferenceOrderedCandidatePaths and, for LiveMapUpdate, appends updated-key candidate paths after the direct pathToThis, then constructs PathEvent with preferenceOrderedCandidatePaths.
PathObjectSubscriptionRegister preference-ordered dispatch
src/plugins/liveobjects/pathobjectsubscriptionregister.ts
notifyPathEvent iterates event.preferenceOrderedCandidatePaths to find and surface the first covered subscription candidate as the chosen event.object for listeners.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • ably/ably-js#2223: Refactors path-based PathEvent candidate selection in a similar area, coordinating dispatcher logic to pick the first matching path from ordered candidates.

Suggested reviewers

  • mschristensen
  • sacOO7
  • VeskeR

Poem

🐰 I hopped through paths both short and long,
Preference now guides which match belongs,
From LiveObject's list to the register's choice,
First fitting path gets the listener's voice,
A small shuffle — and the routing sings along.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: renaming candidate path ordering language from 'priority' to 'preference' across the codebase, which aligns with the code changes in both files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 getFullPaths-preference-not-priority

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.

@github-actions github-actions Bot temporarily deployed to staging/pull/2235/bundle-report June 1, 2026 16:47 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2235/typedoc June 1, 2026 16:47 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the getFullPaths-preference-not-priority branch from 733c510 to c47fafb Compare June 1, 2026 16:56
@github-actions github-actions Bot temporarily deployed to staging/pull/2235/bundle-report June 1, 2026 16:57 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2235/typedoc June 1, 2026 16:57 Inactive

@VeskeR VeskeR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, one nitpick

Comment thread src/plugins/liveobjects/liveobject.ts Outdated

const pathEvent: PathEvent = {
priorityOrderedCandidatePaths,
preferenceOrderedCandidatePaths: preferenceOrderedCandidatePaths,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
preferenceOrderedCandidatePaths: preferenceOrderedCandidatePaths,
preferenceOrderedCandidatePaths,

just this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, fixed — surprised linter / formatter didn't catch / fix

@lawrence-forooghian lawrence-forooghian force-pushed the getFullPaths-preference-not-priority branch from c47fafb to 81e2864 Compare June 16, 2026 10:24
@github-actions github-actions Bot temporarily deployed to staging/pull/2235/bundle-report June 16, 2026 10:25 Inactive
@github-actions github-actions Bot temporarily deployed to staging/pull/2235/typedoc June 16, 2026 10:25 Inactive
"Priority" implies something to do with importance; instead, use the
"preference" language that I used in spec point RTO24b2a.
@lawrence-forooghian lawrence-forooghian force-pushed the getFullPaths-preference-not-priority branch from 81e2864 to ae8a4d3 Compare June 16, 2026 10:36
@lawrence-forooghian lawrence-forooghian merged commit 587eb3c into main Jun 16, 2026
12 of 14 checks passed
@lawrence-forooghian lawrence-forooghian deleted the getFullPaths-preference-not-priority branch June 16, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants