Skip to content

Conversation

@abey79
Copy link
Member

@abey79 abey79 commented Dec 2, 2025

Related

What

In this PR, we focus on re_uri:

  • update everything to using "segment"
  • remain backward compatible with url containing ?partition_id

The rest of the diff is essentially dealing with consequences, with some minor adjacent renames.

@abey79 abey79 added 📺 re_viewer affects re_viewer itself 🚜 refactor Change the code, not the functionality include in changelog labels Dec 2, 2025
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Web viewer built successfully.

Result Commit Link Manifest
c2b0d0e https://rerun.io/viewer/pr/12050 +nightly +main

View image diff on kitdiff.

Note: This comment is updated whenever you push a commit.

Comment on lines 57 to 107
pub fn new(origin: Origin, dataset_id: re_tuid::Tuid, url: &url::Url) -> Result<Self, Error> {
let mut partition_id = None;
let mut segment_id = None;
let mut legacy_partition_id = None;
let mut time_range = None;

for (key, value) in url.query_pairs() {
match key.as_ref() {
// Accept legacy `partition_id` query parameter.
"partition_id" => {
partition_id = Some(value.to_string());
legacy_partition_id = Some(value.to_string());
}

"segment_id" => {
segment_id = Some(value.to_string());
}
"time_range" => {
// `+` means whitespace in URLs.
// Ideally `+` should be encoded as `%2B`, but in case we missed that:
let value = value.replace(' ', "");
time_range = Some(value.parse::<TimeSelection>()?);
}
_ => {
// We ignore unknown query keys that may be from urls from prior/newer versions.
}
}
}

let Some(partition_id) = partition_id else {
return Err(Error::MissingPartitionId);
let segment_id = match (segment_id, legacy_partition_id) {
(Some(s), None) | (None, Some(s)) => s,

(None, None) => {
return Err(Error::MissingSegmentId);
}

(Some(_), Some(_)) => {
return Err(Error::AmbiguousSegmentId);
}
};

let mut fragment = Fragment::default();
if let Some(string) = url.fragment() {
fragment = Fragment::parse_forgiving(string);
}

Ok(Self {
origin,
dataset_id,
partition_id,
segment_id,
time_range,
fragment,
})
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the only business logic part of this pr

@abey79 abey79 marked this pull request as ready for review December 2, 2025 14:26
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Nice and simple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

include in changelog 📺 re_viewer affects re_viewer itself 🚜 refactor Change the code, not the functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants