block / block/trailblaze

Waypoint graph UI shows "(no screenshot)" for classifier-labeled example captures

Open
#215 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
310
Forks
28
Avg merge
7h 45m
Merged PRs (30d)
8

Description

## Summary

Waypoints captured with a device classifier render as "(no screenshot)" in the waypoint graph UI until their example files are hand-renamed, because the UI's example loader only resolves the bare `.example.json` sibling and ignores classifier-labeled example files.

## Details

`trailblaze waypoint capture-example` writes classifier-labeled example pairs when the source log records a device classifier — e.g. `.example.android-phone.json` plus its screenshot (see `WaypointCaptureExampleCommand.kt`). It does **not** write a bare `.example.json` in that case.

The example loader used by the waypoint graph UI (`/waypoints/graph`) and the Compose waypoints tab only resolves the bare sibling:

- `trailblaze-host/src/main/java/xyz/block/trailblaze/ui/tabs/waypoints/WaypointsTabComposable.kt` — `tryLoadFilesystemExample` builds `File(waypointFile.parentFile, "$basename.example.json")` (~line 454).
- The trailmap-side loader has the same limitation with `exampleJsonPath = "$basename.example.json"` (~line 605).

As a result, a freshly captured classifier-labeled waypoint has no matching example file from the UI's perspective and renders with no screenshot. The current workaround is to manually rename the classifier-labeled files to the bare form.

## Expected

`WaypointValidateCommand.kt` already understands the full example **set** — the bare `.example.json` plus any `.example..json` siblings (see `resolveSiblingExamples`, ~lines 204–221). The UI loader should mirror that resolution: prefer the bare example, and fall back to a classifier-labeled example (deterministically, e.g. first sorted classifier) when no bare file exists.

## Suggested fix

- Update the example resolution in `WaypointsTabComposable.kt` (both the filesystem loader at ~line 454 and the trailmap loader at ~line 605) to fall back to `.example..json` when the bare file is absent, choosing deterministically.
- Add a test alongside the existing loader tests in `trailblaze-host/src/test/java/xyz/block/trailblaze/ui/tabs/waypoints/`.

Contributor guide

Open the contributing guide

Research direction

Start in trailblaze-host/src/main/java/xyz/block/trailblaze/ui/tabs/waypoints/WaypointsTabComposable.kt, where the filesystem and trailmap loaders resolve example files, and compare their behavior with resolveSiblingExamples in WaypointValidateCommand.kt. Add loader tests alongside the existing tests in trailblaze-host/src/test/java/xyz/block/trailblaze/ui/tabs/waypoints/. Done means classifier-labeled examples load when the bare example is absent, while the bare example remains preferred and fallback selection is deterministic.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.