Skip to content

Snapshot rosdistro dependency metadata - #146

Merged
baszalmstra merged 3 commits into
RoboStack:masterfrom
mini-1235:codex/snapshot-distribution-cache
Sep 4, 2026
Merged

Snapshot rosdistro dependency metadata#146
baszalmstra merged 3 commits into
RoboStack:masterfrom
mini-1235:codex/snapshot-distribution-cache

Conversation

@mini-1235

@mini-1235 mini-1235 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Closes #144.

Summary

  • store each package direct ROS dependencies in the existing, diffable rosdistro_snapshot.yaml
  • derive source pins and dependency metadata from the same fetched rosdistro DistributionCache
  • resolve recursive snapshot dependencies entirely from the local dependency lists
  • keep the existing package.xml handling for recipe metadata, including the matching-live-cache optimization
  • require snapshots without dependency metadata to be regenerated

A generated entry now looks like:

moveit_py:
  dependencies:
    - geometry_msgs
    - moveit_core
    - rclcpp
  tag: release/rolling/moveit_py/2.15.1-1
  url: https://github.com/ros2-gbp/moveit2-release.git
  version: 2.15.1

This avoids committing the complete compressed rosdistro cache or introducing a second snapshot file. Newly generated snapshots contain the metadata Vinca needs for recursive ROS dependency selection while remaining readable and reviewable.

Rolling results

  • previous source-only snapshot: 231,904 bytes
  • snapshot with direct dependencies: 518,567 bytes (about 506 KiB)
  • complete uncompressed DistributionCache for comparison: 2,080,764 bytes
  • snapshot generation: 6.10 seconds
  • recipe generation: 63.54 seconds
  • generated the expected two sbg_driver recipes

Validation

  • pixi run fmt-check
  • pixi run lint-check
  • pixi run test (161 passed)
  • git diff --check

@mini-1235

Copy link
Copy Markdown
Contributor Author

@traversaro, is there a repository where I could refresh the snapshot and test this change? I originally planned to try it on Jazzy, but I noticed that its full-rebuild PR was recently merged and the rebuild has not yet completed due to some failures.

@mini-1235

Copy link
Copy Markdown
Contributor Author

Or perhaps I could pick up either the Lyrical or Rolling one? Either would be fine with me.

@traversaro

Copy link
Copy Markdown
Member

@traversaro, is there a repository where I could refresh the snapshot and test this change? I originally planned to try it on Jazzy, but I noticed that its full-rebuild PR was recently merged and the rebuild has not yet completed due to some failures.

I would try in rolling.

@traversaro

Copy link
Copy Markdown
Member

One thing that I am a bit afraid is that the full cache (like https://repo.ros2.org/rosdistro_cache/rolling-cache.yaml.gz) is ~2 MB uncompressed, so I am not sure if we want to commit it to the repo. I wonder if we can store it somewhere else (but that is tricky to handle seamlessly) or we could somehow store only the dependencies information to avoid storing too much data.

@traversaro

Copy link
Copy Markdown
Member

xref: ros/rosdistro#50112, I guess in bazel's ros central registry they had a similar problem.

@mini-1235

Copy link
Copy Markdown
Contributor Author

One thing that I am a bit afraid is that the full cache (like https://repo.ros2.org/rosdistro_cache/rolling-cache.yaml.gz) is ~2 MB uncompressed, so I am not sure if we want to commit it to the repo. I wonder if we can store it somewhere else (but that is tricky to handle seamlessly) or we could somehow store only the dependencies information to avoid storing too much data.

I think we could keep the compressed version in the repository, no? The current Rolling cache is only about 211 KiB compressed

@traversaro

Copy link
Copy Markdown
Member

One thing that I am a bit afraid is that the full cache (like https://repo.ros2.org/rosdistro_cache/rolling-cache.yaml.gz) is ~2 MB uncompressed, so I am not sure if we want to commit it to the repo. I wonder if we can store it somewhere else (but that is tricky to handle seamlessly) or we could somehow store only the dependencies information to avoid storing too much data.

I think we could keep the compressed version in the repository, no? The current Rolling cache is only about 211 KiB compressed

I do not know, I am not a big fan of adding compressed files to a git repo, as they remain in the history forever. But if that the easiest option, no objection for me, but I would like to hear the opinion also of @Tobias-Fischer, @ruben-arts or @baszalmstra .

@ruben-arts

Copy link
Copy Markdown
Contributor

I might be misunderstanding the question, but if we can download the snapshot cache from the rosdistro repo releases then we can just do that right?

@baszalmstra

Copy link
Copy Markdown
Collaborator

Yeah I would prefer the solution from ros/rosdistro#50112 as well! I am also not a fan of storing the gzipped file in the history.

Alternatively we could unpack the files into directories (as text files) and let git do its regular magic.

@mini-1235

Copy link
Copy Markdown
Contributor Author

I might be misunderstanding the question, but if we can download the snapshot cache from the rosdistro repo releases then we can just do that right?

To clarify, this PR currently does the following:

  1. Downloads the current rosdistro cache once.
  2. Creates an upstream DistributionCache from those exact bytes.
  3. Uses that cache to obtain every package’s URL, tag, and version for rosdistro_snapshot.yaml.
  4. Saves those same cache bytes as rosdistro_snapshot_cache.yaml.gz.

This ensures that the snapshot YAML and cache match when they are generated. If an immutable cache corresponding to that exact rosdistro state is available as a release asset, then downloading it later should work.

The potential mismatch only occurs if we later download the latest mutable cache: the snapshot YAML may still reference an older package version while the latest cache contains metadata for a newer version.

@traversaro

Copy link
Copy Markdown
Member

Alternatively we could unpack the files into directories (as text files) and let git do its regular magic.

That would gives us ~2 MB for snapshot, not sure if I prefer that.

@baszalmstra

Copy link
Copy Markdown
Collaborator

Uses that cache to obtain every package’s URL, tag, and version for rosdistro_snapshot.yaml.

So between different runs, this information must match? Wouldn't it make more sense to store only that in a file then? Preferably a diff-able text file?

@traversaro

Copy link
Copy Markdown
Member

I might be misunderstanding the question, but if we can download the snapshot cache from the rosdistro repo releases then we can just do that right?

No, we are downloading the cache of the package.xml of each repo from http://repo.ros2.org/rosdistro_cache, that only contains the latest version.

@mini-1235

Copy link
Copy Markdown
Contributor Author

Uses that cache to obtain every package’s URL, tag, and version for rosdistro_snapshot.yaml.

So between different runs, this information must match? Wouldn't it make more sense to store only that in a file then? Preferably a diff-able text file?

If I understand correctly, this would be similar to storing the cache uncompressed. As @traversaro mentioned earlier, the downside is that it would add a roughly 2 MB file unless we post-process the cache and remove the data Vinca does not need.

@mini-1235

Copy link
Copy Markdown
Contributor Author

post-process the cache and remove the data Vinca does not need

If this is the preferred direction, I can try updating this PR

@baszalmstra

Copy link
Copy Markdown
Collaborator

If we only extract the URL, tag, and version from the downloaded file, ideally we only cache that.

@traversaro

Copy link
Copy Markdown
Member

If we only extract the URL, tag, and version from the downloaded file, ideally we only cache that.

That is what we already store in the snapshot file. But to quickly generate the recipes, we need at least also the dependencies

@mini-1235
mini-1235 force-pushed the codex/snapshot-distribution-cache branch from 5aee14d to 545017a Compare September 2, 2026 16:34
@baszalmstra

Copy link
Copy Markdown
Collaborator

Does it store it for the packages that are added, or for all packages in the distro?

@mini-1235

Copy link
Copy Markdown
Contributor Author

Does it store it for the packages that are added, or for all packages in the distro?

All packages, something like this
Screenshot 2026-09-02 at 23-49-54

@mini-1235

Copy link
Copy Markdown
Contributor Author

I asked my agent to uncompress it and keep only the important information, so it now looks like this:

Screenshot 2026-09-02 at 23-54-49

It is around ~500 KB now. What do you guys think about this approach?

@baszalmstra

Copy link
Copy Markdown
Collaborator

Thats still quite extensive but better than the gzipped content for sure! I would still prefer ros/rosdistro#50112 but while we wait this is the best solution I think!

@mini-1235

Copy link
Copy Markdown
Contributor Author

Thats still quite extensive but better than the gzipped content for sure! I would still prefer ros/rosdistro#50112 but while we wait this is the best solution I think!

Great. If @traversaro also agrees with this approach, I can include it in my Lyrical full rebuild PR to make sure it doesn't break anything.

@traversaro

Copy link
Copy Markdown
Member

If @traversaro also agrees with this approach

Go for me!

Signed-off-by: Maurice <mauricepurnawan@gmail.com>
@mini-1235
mini-1235 force-pushed the codex/snapshot-distribution-cache branch from 545017a to 45d6e8b Compare September 3, 2026 10:12
…ribution-cache

Signed-off-by: Maurice <mauricepurnawan@gmail.com>

# Conflicts:
#	vinca/snapshot.py
@mini-1235
mini-1235 marked this pull request as ready for review September 4, 2026 14:19

@traversaro traversaro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good to go for me!

@traversaro

Copy link
Copy Markdown
Member

Sorry, I guess there was a conflict with #151, can you please fix the conflicts? Once that is done, it would be great if @baszalmstra could also put the thumbs up.

…ribution-cache

Signed-off-by: Maurice <mauricepurnawan@gmail.com>

# Conflicts:
#	vinca/distro.py
@baszalmstra
baszalmstra merged commit 435ebd6 into RoboStack:master Sep 4, 2026
3 checks passed
@mini-1235

Copy link
Copy Markdown
Contributor Author

Thanks!

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.

Slowdown in recipe generation

4 participants