refactor(ui): type registry dispatch in templates.rs (completes #369) - #967
Merged
Conversation
Completes #369. The UI templates were the last string-dispatch sites: render_package_detail, render_registry_list_paginated, and get_registry_icon / get_registry_title matched on registry_type string literals. Parse once to RegistryType and match on the enum (icon/title become exhaustive matches — a new variant is now a compile error there too). No behavioral change: mount points, install commands, icons and titles are identical. The type-safety ratchet drops from 53 to 0 string-dispatch sites.
|
🐳 Test image pushed: docker pull ghcr.io/getnora-io/nora:pr-967
docker run --rm -p 4000:4000 ghcr.io/getnora-io/nora:pr-967 |
ertime037
approved these changes
Sep 6, 2026
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.
Completes #369. The UI templates were the last stringly-typed registry-dispatch sites —
render_package_detail,render_registry_list_paginated, and theget_registry_icon/get_registry_titlehelpers all matched onregistry_type: &strstring literals.This parses once to
RegistryTypeand matches on the enum. The icon/title helpers become exhaustive matches, so adding a registry variant is now a compile error there too (the consumer-side complement of the enum being the single source of truth).No behavioral change: mount points, install commands, icons, and titles are identical.
Tests
Full suite green (1798 unit + doctests); the
ui::templatesrender tests pass unchanged. The type-safety ratchet drops from 53 to 0 string-dispatch sites.