Skip to content

feat(assets): accept both depot filename schemas in the GUI resolver#76

Merged
AprilNEA merged 2 commits into
masterfrom
feat/asset-multi-schema
Jun 2, 2026
Merged

feat(assets): accept both depot filename schemas in the GUI resolver#76
AprilNEA merged 2 commits into
masterfrom
feat/asset-multi-schema

Conversation

@AprilNEA
Copy link
Copy Markdown
Owner

@AprilNEA AprilNEA commented Jun 2, 2026

What

Teach the asset resolver and the two sync paths to accept both depot
filename schemas Logi ships, instead of hardcoding the newer *_core names:

slot newer depots older depots
hotspot metadata core_metadata.json metadata.json
hero render front_core.png front.png
buttons render side_core.png side.png

A depot commits to one schema or the other; each slot now resolves to
whichever filename the depot's index.json entry actually lists. The
manifest.json (device_image / device_buttons_image) already maps to
the concrete render, so colour-variant resolution is unchanged.

Why

The full asset mirror now hosts every Logi Options+ device, but the older
schema covered most keyboards, the MX Vertical, and the older mice.
The GUI gated on core_metadata.json + front_core.png literally, so
those depots fell through to the synthetic silhouette even though their
assets were present.

Changes

  • openlogi-assets: replace the CORE_FILES const with METADATA_FILES
    / FRONT_RENDER_FILES / BUTTONS_RENDER_FILES preference lists plus
    DeviceEntry::{preferred_file, baseline_files}.
  • GUI resolver (asset/mod.rs): probe both metadata names on disk and
    fall through both render schemas before giving up.
  • GUI + CLI sync: fetch the per-depot baseline in whichever schema the
    depot ships; warn (don't error) when a depot has no metadata/render.

Testing

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace — all green.
  • New unit tests: baseline_files resolution for core/old/missing schemas,
    plus an end-to-end load_files test that resolves an old-schema depot
    (metadata.json + front.png, no manifest) from a temp dir.

Note

MX Vertical now renders fully (it has a device_buttons_image, so hotspots
work). Keyboards render their hero image, but their key-level hotspots live
under a different metadata image key (device_keys_image) and need a
keyboard button model — that stays a separate feature.

Older depots (the MX Vertical, most keyboards, older mice) ship
metadata.json + front.png; newer ones ship core_metadata.json +
front_core.png. Resolve each schema slot — hotspot metadata, hero
render, buttons render — to whichever filename the depot's registry
entry actually lists, instead of hardcoding the *_core names.

- openlogi-assets: replace the CORE_FILES const with METADATA_FILES /
  FRONT_RENDER_FILES / BUTTONS_RENDER_FILES preference lists plus
  DeviceEntry::{preferred_file, baseline_files}.
- gui resolver: probe both metadata names on disk and fall through both
  render schemas so an old-schema depot resolves instead of dropping to
  the synthetic silhouette.
- gui + cli sync: fetch the per-depot baseline in either schema; warn,
  don't error, when a depot ships no metadata or render.

Keyboards now render their hero image; key-level hotspots live under a
different metadata image key (device_keys_image) and stay a separate
feature.
Copy link
Copy Markdown

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

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

ℹ️ One stale comment reference — everything else is clean.

Reviewed changes — The GUI resolver and both sync paths now accept both Logi depot filename schemas (*_core and bare names) via preference-list constants and a new DeviceEntry::preferred_file/baseline_files API, fixing GUI rendering for MX Vertical and older depots.

  • Add METADATA_FILES, FRONT_RENDER_FILES, BUTTONS_RENDER_FILES — Preference-list constants replacing the single CORE_FILES array, one per schema slot
  • Add DeviceEntry::preferred_file — Resolves a schema slot to the first matching filename in the depot's registry
  • Add DeviceEntry::baseline_files — Composes the per-depot baseline (metadata + manifest + hero render) with optional slots
  • Update GUI resolver — Probes both metadata names on disk; fallback chain includes both schema names for each render slot
  • Update CLI and GUI sync — Use baseline_files() and preferred_file() instead of hardcoded constants
  • Update is_optional_asset — Accepts both front_ext and front_ext_ prefixes for colour variants
  • New unit testsbaseline_files resolution for core/old/missing schemas, plus end-to-end load_files test with old-schema depot

Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:

  • crates/openlogi-gui/src/asset/sync.rs:125 (RIGHT) — line 125 (RIGHT) is not inside a diff hunk

Pullfrog  | Fix it ➔View workflow run | Using Big Pickle (free) (credentials for Anthropic not configured) | 𝕏

@pullfrog
Copy link
Copy Markdown

pullfrog Bot commented Jun 2, 2026

Quick follow-up: the dropped inline was about a stale comment at crates/openlogi-gui/src/asset/sync.rs:125 that still references CORE_FILES (removed in this PR). Not blocking — worth updating when you touch this file next.

Pullfrog  | View workflow run | via Pullfrog | Using Big Pickle (free) (credentials for Anthropic not configured) | 𝕏

The variant second-pass comment still pointed at CORE_FILES, removed in
this PR in favour of DeviceEntry::baseline_files(). Per Pullfrog review.
@AprilNEA AprilNEA merged commit bebca81 into master Jun 2, 2026
7 checks passed
@AprilNEA AprilNEA deleted the feat/asset-multi-schema branch June 2, 2026 09:10
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