To show a cached video thumbnail, the webview in LumenPod needs a directory path. Rust owns that path. Rebuilding it in TypeScript would give a directory rename a peculiar failure mode. The app could keep generating thumbnails while the UI kept looking in the old directory.
The frontend asks Rust for the directory. Here is the call from the app paths store:
const thumbsPath = await invokeCommand<string>(COMMANDS.GET_THUMBNAIL_CACHE_DIR); There are two claims in that line. TypeScript checks the command name against a list. The developer supplies the claim that the response is a string. Those claims have quite different failure modes.
Try deleting an entry
Here is the relevant slice of the registry in src/ipc/commands.ts:
export const COMMANDS = { GET_THUMBNAIL_CACHE_DIR: "get_thumbnail_cache_dir", } as const; export type CommandName = (typeof COMMANDS)[keyof typeof COMMANDS]; The real object has entries for other commands too. With as const, each value keeps its literal type. Indexing the object type by its keys gives the wrapper a union of allowed wire names for its first parameter.
Delete the property and the paths store fails to compile at the reference. Change only its value to "get_thumbnail_cache_directory" and the store still compiles. The union now includes the new spelling. A build whose Rust handler still uses the old name will reject the call at runtime. I use the registry to find frontend callers during a rename and check the handler registration separately.
Likewise, replacing <string> with <number> changes what TypeScript lets the caller do with the result. It has no effect on what Rust serializes. A successful type check alone tells me very little about a change to a command's return value.
Follow one thumbnail from disk to the screen
The old webview code called appCacheDir() and joined the literal "video_thumbs". That was a reasonable-looking line of code. Both pieces had the right type. The trouble was that the Rust thumbnail writer already had a definition of the cache layout in AppPaths::from_roots. A developer changing the layout could search the Rust references, update every writer, and still miss the second definition in JavaScript.
The current handler lives in src-tauri/src/app/paths.rs. Its signature is small enough to read in one line:
pub fn get_thumbnail_cache_dir(app: tauri::AppHandle) -> String Tauri supplies the app handle. The webview sends no arguments. A separate entry in src-tauri/src/commands.rs registers the handler so Tauri can dispatch to it. Those are two places I check when the desktop app reports an unknown command. Finding a function with the right name only answers half the question.
On startup, the Zustand paths store shares one in-flight promise across callers. Once the directory arrives, the store saves it and marks itself ready. Rendering a grid of a hundred local covers can then reuse that value. Asking Rust for the path on every card would buy us nothing because every answer would be the same.
Failure has a visible outcome too. If the lookup rejects, the store leaves the path empty and still marks itself ready. The cover resolver can fall back to a file-type icon, and the library opens. This gives me a useful clue when debugging a report about missing covers. Plain covers need an absolute path for the asset protocol. Encrypted covers use lumenpod-asset://thumb/<id> and Rust resolves the ID. If only the plain covers have disappeared, I start with the bootstrap lookup before investigating the thumbnail generator.
Which commands shipped in this binary?
The TypeScript registry includes names used across several builds. For example, the webview knows the name for updating a rating, while availability of rating commands depends on the native build. Checking that a name exists in COMMANDS would tell the UI exactly the same thing in every edition.
At startup the webview asks get_app_capabilities what this particular binary supports. A missing capability keeps its control out of the UI. This also explains why capabilities and paths live in separate stores, although both are values read from Rust at startup. If capability discovery fails, disabling optional controls is a sensible default. When the cache lookup fails, the app still has a perfectly usable library. Putting a single “bootstrap failed” screen in front of both would turn a missing cover into a much bigger problem.
Availability is also a separate question from the current user's entitlement. Consider two entries from our licensing map:
[COMMANDS.UPDATE_MEDIA_TAGS]: FEATURES.ORGANIZE_LIBRARY, [COMMANDS.GENERATE_SUBTITLES]: FEATURES.GENERATE_SUBTITLES, The map has type Partial<Record<CommandName, BillingFeature>>. The keys get checked against the same command union as the callers. The licensing code supplies a callback to the IPC wrapper, so the wrapper can ask about access before sending a command. Rust checks access on the backend as well. For a multi-step import, the UI can also check when the file picker opens. Finding out at that point saves the user from selecting files they cannot import.
Why a partial record? Some decisions need the arguments. A command that toggles encryption can add protection or remove it. LumenPod allows the user to decrypt their files, so assigning a single paid feature to that command name would also block the way out. The entry point can see the requested direction and check the action there. That's one place where centralizing another rule would lose information.
The call that can run twice
Routing calls through one wrapper also gave us one place to handle a locked vault. Some commands can reach Rust after the vault locks. Rust rejects them during admission, before the command changes anything, and returns a recognizable VAULT_LOCKED reason.
When the wrapper recognizes that reason and an unlock handler is available, it asks the handler to recover. If the user unlocks the vault, the wrapper sends the original command and arguments once more. A second failure propagates to the caller. Declining the unlock leaves the original failure in place.
That timing matters for write commands. Imagine a command that appends an import record and then reports a locked vault. Replaying it could append the record twice. The review question for a new handler is concrete: can it return VAULT_LOCKED after its first side effect? If so, the shared retry would be unsafe even with a perfectly spelled command name.
What shows up in a diagnostic report?
Suppose a user says, “The unlock dialog appeared and my edit disappeared.” There are several paths through that one sentence. The wrapper looks at the structured reason field to recognize a locked vault. A translated error message can change without changing recovery behavior. What gets logged depends on what happens next.
| What happened after the first rejection | What the caller sees | IPC failure log |
|---|---|---|
| The user unlocked and the retry succeeded | The result of the second call | None |
| The user cancelled the unlock dialog | The original rejection | None |
| The user unlocked and the second call failed | The second error | One entry for that error |
| No recovery handler was installed | The original rejection | One entry for the original error |
The failure entry is named ipc_failed. It carries the wire command, an error message, and structured code and reason values when present. The reporter returns the original error so the caller can still inspect its fields. Logging every first rejection would make a successful unlock look like a broken edit. Logging only in a button's toast handler would lose failures from bootstrap calls such as the paths lookup.
How I would review a command rename
For the thumbnail command, I would change the wire name in a development build and deliberately leave the Rust registration on the old name for one run. The expected observations are precise: TypeScript accepts the caller, the desktop invocation fails, and the library opens with fallback icons for affected covers. Then I would align the handler and registration, restart the desktop build, and open a library with a known plain thumbnail. An encrypted cover would exercise a different path and could give me a misleading pass.
For a vault-protected write, I would start with one identifiable item, lock the vault, request the change, and unlock when prompted. I want to see the change applied once. On a second run I would cancel the prompt and check that the item kept its original value. Those two runs exercise the contract that makes replay possible. Searching for every reference to a command constant is a good way to begin that review. The actual thumbnail on screen, or the record left on disk, is how I finish it.

