fix: show mediaId instead of displayIconId in icon commands - #10
Open
nate-kelley-buster wants to merge 5 commits into
Open
nate-kelley-buster wants to merge 5 commits into
nate-kelley-buster wants to merge 5 commits into
Conversation
Requesting "profile offline_access openid" during device-code login causes Yoto's auth server to reject the authorization with access_denied as soon as the user confirms the code (see TheBestMoshe#6). The CLI only needs an access/refresh token to call the Yoto API, so trim the request to the minimal "offline_access" scope. Verified end-to-end: device flow now reaches the consent screen and completes successfully. Fixes TheBestMoshe#6 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182auKxRRCcLdZrBotvbJ6K
The Yoto API returns display.icon16x16 as null for chapters/tracks that don't have a custom icon set, but DisplaySchema only allowed string|undefined for that field. This made `playlist show` (and any other command that parses card content) throw a Zod validation error on any playlist with unset icons instead of rendering. Verified against a real 25-chapter playlist that previously failed to display. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182auKxRRCcLdZrBotvbJ6K
\`icon list\`, \`icon list --mine\`, and \`icon upload\` all displayed
\`displayIconId\` in their "ID" column / success message. But
\`entry|chapter|track --icon\` (per its own --help text: "file path,
mediaId, or yoto:#mediaId") requires the \`mediaId\`, a different,
longer token — not the displayIconId.
Copy-pasting the ID shown by these commands into --icon silently
builds an invalid \`yoto:#{displayIconId}\` reference, which the API
rejects with:
icon16x16 must be in format "yoto:#{mediaId}" where mediaId is 43
characters
Fix: print \`mediaId\` (renamed column to "Media ID") everywhere an
icon reference is surfaced to the user, since that's the value
--icon actually consumes.
## Verification
Reproduced end-to-end against the live API: copying a displayIconId
from \`icon list\` into \`entry update --icon\` failed with the error
above. After this fix, \`icon list\`/\`icon upload\` print the mediaId,
and passing that value to \`entry update --icon\` succeeds.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0182auKxRRCcLdZrBotvbJ6K
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
yoto icon list,yoto icon list --mine, andyoto icon uploadall printdisplayIconIdin their "ID" column / success message. Butentry|chapter|track update --icon(per its own--help: "file path, mediaId, or yoto:#mediaId") requires the mediaId — a different, longer (43-char) token, not the displayIconId.Copying the ID these commands show you into
--iconbuilds an invalidyoto:#{displayIconId}reference under the hood (seeresolveIconinsrc/commands/entry.ts), which the API rejects:This is a real footgun — it's the natural, documented workflow (
icon list→ copy ID →entry update --icon <id>) and it silently fails.Fix
Print
mediaIdinstead ofdisplayIconIdeverywhere an icon reference is surfaced to the user (column renamed "ID" → "Media ID" for clarity), since that's the value--iconactually consumes.Verification
Reproduced end-to-end against the live API: copying a
displayIconIdfromicon listintoentry update --iconfails with the error above. After this fix,icon list/icon uploadprint themediaId, and passing that value toentry update --iconsucceeds — verified by setting icons on all 25 chapters of a real playlist and confirming via a direct API read thatdisplay.icon16x16was set correctly on every chapter.