Skip to content

fix(gui): resolve depot metadata named only by the manifest - #836

Open
4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:fix/lift-manifest-metadata
Open

fix(gui): resolve depot metadata named only by the manifest#836
4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:fix/lift-manifest-metadata

Conversation

@4ni1ak

@4ni1ak 4ni1ak commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes device renders never appearing for the Lift, and the variant sync defect
sitting behind it.

Split out of #802 at your request. Per your note the two commits stay together:
the second is what makes the first hold once two variants of one depot are
connected.

Fixes #782

Changes

openlogi-desktopload_files

  • Depot metadata is resolved through the manifest's image_metadata resource
    before the well-known METADATA_FILES names. Depots whose variants are
    handed rather than coloured ship none of those names — the Lift keys its
    metadata core_metadata_left.json / core_metadata_right.json and names the
    right one in the manifest — so the name lookup missed, resolve returned
    None for every root, and every Lift and Lift for Business rendered the
    generic silhouette with a complete, checksum-verified bundle on disk.
  • Every model-id candidate is tried as the variant base, as the image lookup
    already did: a manifest is keyed on whichever pid Logi authored it against,
    which is not always the index primary.
  • Manifest-sourced filenames are attacker-influenced, so they go through
    safe_component_path like every other asset file.
  • The metadata resolution moved into its own function; load_files was already
    at the line limit.

openlogi-desktop — sync

  • image_metadata added to the manifest-mapped resource pass, or the resolver
    above looks for a file no sync ever fetched. pick_variant_filename now
    consults every model-id candidate too, for the same reason as above.
  • The depot list is deduplicated on (depot, ext) rather than the depot alone.
    Two devices sharing a depot but differing in extended_model_id — a colour
    pair, or the Lift's left- and right-handed variants — collapsed to one target,
    so the second never had its device_image / device_buttons_image /
    image_metadata fetched and stayed on fallback artwork with no hotspot
    metadata, undoing the fix above for that device. The collection step moved into
    its own function so the decision is testable without the surrounding HTTP.
    (Found by the Greptile review on feat(i18n): add Turkish locale, plus four Linux/asset fixes #802.)

openlogi-cli

  • assets sync treats core_metadata_*.json / metadata_*.json as optional
    assets, so an offline bundle carries the variant metadata rather than shipping
    a depot the resolver will reject.

Testing

Linux, x86_64, Rust 1.98.0:

cargo test -p openlogi-desktop --bins services::assets
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings   # RUSTFLAGS=-D warnings
cargo test --workspace
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items \
  --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay --exclude openlogi-agent

All green. New tests:
resolves_depot_whose_metadata_is_only_named_by_the_manifest,
two_variants_of_one_depot_are_both_synced,
the_same_variant_twice_is_synced_once.
The two sync tests were checked against the old dedup key — the first fails on
it — so they pin the defect rather than the implementation.

Not run on this host: tests (macos), cargo-deny, macOS clippy.

Not runtime-tested on hardware. To verify: connect a Lift, let the bundle
download, and confirm the device card shows the render rather than the
silhouette with no core_metadata.json copy in the depot. For the sync half,
connect two Lifts of different handedness (or two colour variants of one model)
and confirm both render.

@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Greptile Summary

The PR aligns packaged and runtime asset handling with manifest-selected, variant-specific metadata.

  • Resolves manifest-named metadata through safe component paths before falling back to conventional filenames.
  • Fetches manifest-mapped metadata for every applicable model-ID candidate.
  • Includes handed and other variant metadata in offline bundles.
  • Keeps distinct depot variants independently eligible for synchronization.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/openlogi-cli/src/cmd/assets/sync.rs Extends packaging selection to include the known variant-metadata filename families needed for offline rendering.
crates/openlogi-desktop/src/services/assets.rs Adds safe manifest-first metadata resolution while preserving conventional metadata fallbacks.
crates/openlogi-desktop/src/services/assets/images.rs Adds a focused helper for resolving each variant's image_metadata resource.
crates/openlogi-desktop/src/services/assets/sync.rs Fetches manifest-selected metadata and consults all registry model-ID candidates during variant lookup.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Registry[Asset registry] --> PackageSync[CLI asset sync]
  Registry --> RuntimeSync[Desktop runtime sync]
  Manifest[Depot manifest] --> PackageSync
  Manifest --> RuntimeSync
  PackageSync --> Bundle[Packaged asset bundle]
  RuntimeSync --> Cache[Verified user cache]
  Bundle --> Resolver[Asset resolver]
  Cache --> Resolver
  Device[Device model and variant] --> Resolver
  Resolver --> Metadata[Manifest-selected metadata]
  Resolver --> Render[Variant render]
  Metadata --> View[Device view]
  Render --> View
Loading

Reviews (4): Last reviewed commit: "fix(gui): resolve depot metadata named o..." | Re-trigger Greptile

@davidbudnick davidbudnick added the type: bug Something is broken or behaves incorrectly label Aug 24, 2026
@4ni1ak
4ni1ak force-pushed the fix/lift-manifest-metadata branch from f354d9e to 591d93f Compare August 24, 2026 19:17
@davidbudnick davidbudnick added the area: gui Graphical user interface label Aug 25, 2026
@4ni1ak
4ni1ak force-pushed the fix/lift-manifest-metadata branch from 591d93f to a41dcf5 Compare August 25, 2026 05:54
`load_files` accepted a depot only when it carried one of the three
hardcoded `METADATA_FILES` names. Depots whose variants are handed rather
than coloured ship none of them: the Lift keys its hotspot metadata
`core_metadata_left.json` / `core_metadata_right.json` and names the right
one in the manifest's `image_metadata` resource. The name lookup missed,
`resolve` returned `None` for every root, and every Lift and Lift for
Business rendered the generic silhouette with a complete bundle on disk.

Resolve the metadata filename through the manifest first — same model-id
candidates as the image lookup, since a manifest is keyed on whichever pid
Logi authored it against — then fall back to the well-known names for
bundles without a manifest. Manifest-sourced names now pass through
`safe_component_path` like every other asset file.

The download side has to follow, or the resolver looks for a file no sync
ever fetched: the desktop sync adds `image_metadata` to its manifest-mapped
resource pass (and consults every model-id candidate there too), and the
CLI bundle treats `core_metadata_*.json` / `metadata_*.json` as optional
assets so an offline bundle carries the variant metadata.

Fixes AprilNEA#782
@4ni1ak
4ni1ak force-pushed the fix/lift-manifest-metadata branch from a41dcf5 to 1e41333 Compare August 25, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: gui Graphical user interface type: bug Something is broken or behaves incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Lift always renders the generic silhouette — resolver ignores the manifest's image_metadata and only accepts hardcoded metadata names

2 participants