Skip to content

refactor(net): expose route cost fields - #3802

Merged
kixelated merged 4 commits into
mainfrom
quest/m1/api-route-cost
Sep 20, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/m1/api-route-cost

Conversation

@kixelated

@kixelated kixelated commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Problem

Route construction exposed a fallible single-hop builder and an unnamed tuple conversion for warm and cold costs. Callers had to infer tuple positions, while Cost being non-exhaustive prevented the clearest named construction.

Approach

  • Make Cost exhaustively constructible with its public warm and cold fields.
  • Remove the tuple conversion without adding a replacement constructor.
  • Make libmoq and moq-ffi validate complete Hops before constructing a Route with Cost { warm, cold }.
  • Remove Route::with_hop and complete the route-cost quest.

Impact

  • Breaking Rust API: removes Route::with_hop and From<(u64, u64)> for Cost; callers build Hops, call Route::with_hops, and construct Cost { warm, cold }.
  • Breaking Rust API: removes #[non_exhaustive] from Cost, allowing downstream struct literals and exhaustive destructuring.
  • No replacement Cost::from_warm_cold constructor is added.
  • C and UniFFI route structures are unchanged.
  • Wire impact: none.

Alternatives

A named constructor was considered, but the public fields already provide the shortest and clearest named construction without growing the API.

Testing

  • just check
  • just rs test -p moq-net -p moq-ffi -p libmoq: 1,457 passed

Follow-ups

None.

(written by GPT-5)

@kixelated
kixelated marked this pull request as ready for review September 20, 2026 17:46
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 4edface8-1aaf-476f-a675-e953f51359d5

📥 Commits

Reviewing files that changed from the base of the PR and between 344d6f8 and dc6165b.

📒 Files selected for processing (9)
  • quest/m1/README.md
  • quest/m1/api-review-gate.md
  • quest/m1/api-route-cost.md
  • rs/libmoq/src/api.rs
  • rs/moq-ffi/src/origin.rs
  • rs/moq-ffi/src/test.rs
  • rs/moq-hls/src/export/mod.rs
  • rs/moq-net/CHANGELOG.md
  • rs/moq-net/src/model/origin.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 8e46e464-1368-44f9-9cee-7b0dd4588a5e

📥 Commits

Reviewing files that changed from the base of the PR and between 97bcd5a and 344d6f8.

📒 Files selected for processing (8)
  • quest/m1/README.md
  • quest/m1/api-review-gate.md
  • quest/m1/api-route-cost.md
  • rs/libmoq/src/api.rs
  • rs/moq-ffi/src/origin.rs
  • rs/moq-ffi/src/test.rs
  • rs/moq-net/CHANGELOG.md
  • rs/moq-net/src/model/origin.rs
💤 Files with no reviewable changes (4)
  • quest/m1/README.md
  • rs/moq-net/src/model/origin.rs
  • quest/m1/api-review-gate.md
  • quest/m1/api-route-cost.md

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.


Walkthrough

The public Cost API now uses named fields, and Route::with_hop and tuple-based cost conversion are removed. The libmoq and moq-ffi route parsers now build Hops collections and apply them with with_hops. FFI tests use explicit Cost values. The changelog and route-cost quest records reflect the completed API change.

Priority: ➖ Normal

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main API refactor: route cost fields become publicly constructible. It is concise and related to the changeset.
Description check ✅ Passed The description accurately explains the route cost API changes, removed APIs, migration approach, compatibility impact, and testing.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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.

@moq-bot

moq-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor
  1. Breaking removals (Route::with_hop, From<(u64,u64)> for Cost) target main but published moq-net 0.2.22 breaks require dev (rs/moq-net/CHANGELOG.md:20, AGENTS.md#Development). Retarget PR to dev, set upstream to origin/dev, then rebase.

Verdict: request changes
(Written by Muse Spark)

New%20session%20-%202026-09-20T17%3A46%3A40.414Z
opencode session  |  github run

Comment thread rs/moq-net/src/model/origin.rs Outdated
}

/// A discounted warm cost alongside the same route's undiscounted cold cost.
pub const fn from_warm_cold(warm: u64, cold: u64) -> Self {

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.

I'm not a fan. IMO it's better to require Cost { warm: x, cold: y } instead of from_warm_cold(x, y)

@kixelated
kixelated force-pushed the quest/m1/api-route-cost branch from d3eaae3 to 91f5c86 Compare September 20, 2026 21:07
@kixelated kixelated changed the title refactor(net): name route cost construction refactor(net): expose route cost fields Sep 20, 2026
@moq-bot

moq-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor
  1. Breaking removals target main but need dev (rs/moq-net/CHANGELOG.md:20, AGENTS.md#Development). Retarget PR to dev, set upstream to origin/dev, then rebase.

Verdict: request changes
(Written by Muse Spark)

New%20session%20-%202026-09-20T21%3A07%3A51.897Z
opencode session  |  github run

@kixelated
kixelated force-pushed the quest/m1/api-route-cost branch from 91f5c86 to f8ec26f Compare September 20, 2026 21:23
@moq-bot

moq-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor
  1. Breaking removals (Route::with_hop, From<(u64,u64)> for Cost) target main but published moq-net 0.2.22 breaks require dev (rs/moq-net/CHANGELOG.md:20, AGENTS.md#Development). Retarget PR to dev, set upstream to origin/dev, then rebase.

Verdict: request changes
(Written by Muse Spark)

New%20session%20-%202026-09-20T21%3A23%3A52.380Z
opencode session  |  github run

@kixelated
kixelated force-pushed the quest/m1/api-route-cost branch from f8ec26f to 344d6f8 Compare September 20, 2026 21:44
@moq-bot

moq-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor
  1. Breaking removals (Route::with_hop, From<(u64,u64)> for Cost) target main but published moq-net 0.2.22 breaks require dev (rs/moq-net/CHANGELOG.md:20, AGENTS.md#Development). Retarget PR to dev, set upstream to origin/dev, then rebase.
    Verdict: request changes
    (Written by Muse Spark)

New%20session%20-%202026-09-20T21%3A45%3A59.823Z
opencode session  |  github run

@kixelated
kixelated enabled auto-merge (squash) September 20, 2026 22:04
kixelated and others added 3 commits September 20, 2026 15:08
Co-Authored-By: GPT-5 <noreply@openai.com>
Co-Authored-By: GPT-5 <noreply@openai.com>
Co-Authored-By: GPT-5 <noreply@openai.com>
@kixelated
kixelated force-pushed the quest/m1/api-route-cost branch from 344d6f8 to 51f739a Compare September 20, 2026 22:11
@moq-bot

moq-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor
  1. Breaking removals target main but published moq-net 0.2.22 requires dev (rs/moq-net/CHANGELOG.md:20, AGENTS.md#Development). Retarget PR to dev, set upstream to origin/dev, then rebase.

Verdict: request changes
(Written by Muse Spark)

New%20session%20-%202026-09-20T22%3A15%3A24.339Z
opencode session  |  github run

Co-Authored-By: GPT-5 <noreply@openai.com>
@moq-bot

moq-bot Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor
  1. Breaking Rust removals target main but published moq-net 0.2.22 requires dev (rs/moq-net/CHANGELOG.md:20, AGENTS.md#Development). Retarget PR to dev, set upstream to origin/dev, then rebase.

Verdict: request changes
(Written by Muse Spark)

New%20session%20-%202026-09-20T22%3A31%3A15.731Z
opencode session  |  github run

@kixelated
kixelated merged commit e739249 into main Sep 20, 2026
7 checks passed
@kixelated
kixelated deleted the quest/m1/api-route-cost branch September 20, 2026 22:49
@moq-bot moq-bot Bot mentioned this pull request Sep 20, 2026
@moq-bot moq-bot Bot mentioned this pull request Sep 23, 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