Skip to content

test: cover theme.import.py's installed-theme marker - #1

Merged
kRHYME7 merged 3 commits into
HyDE-Project:mainfrom
Delcado19:feat/theme-import-installed-marker-coverage
Sep 13, 2026
Merged

kRHYME7 merged 3 commits into
HyDE-Project:mainfrom
Delcado19:feat/theme-import-installed-marker-coverage

Conversation

@Delcado19

Copy link
Copy Markdown
Contributor

Summary

  • Test coverage for the "More Themes" fzf picker's installed-theme marker in feat(theme): mark already-installed themes in the "More Themes" picker HyDE#2093.
  • Asserts the marker's JSON lookup actually succeeds with fzf's real --ansi-stripped output (bare glyph, no color codes), not just that the script doesn't crash — the first version of this test only checked "doesn't crash" and would have passed against the actual bug (the not-found fallback doesn't crash either).
  • Also covers a related crash: get_theme_preview() iterating JSON_DATA directly raised TypeError instead of the intended "not found" message when the gallery cache isn't populated yet.

Companion PR with the actual fix: HyDE-Project/HyDE#2093

Test plan

  • REPO_ROOT=<HyDE checkout> bash test_theme_import_installed_marker.sh passes against the fixed theme.import.py
  • Confirmed failing against the pre-fix code (the bug this test targets)

Covers the "More Themes" fzf picker marking already-installed themes with
a leading checkmark (HyDE-Project/HyDE#2093): the marker must round-trip
through fzf's --ansi, which strips SGR color codes from every value it
hands back via {} and keeps only the bare glyph. A first version of the
marker compared against the colored prefix, which fzf's {} never actually
contains, so every installed theme's JSON lookup silently failed. This
test asserts the JSON lookup actually succeeds with fzf's real,
already-stripped output, not just that the script doesn't crash on it --
the earlier, weaker version of this test passed against the buggy code,
since the not-found fallback doesn't crash either.

Also covers a related crash found while testing this: get_theme_preview()
iterated JSON_DATA directly, raising TypeError instead of the intended
"not found" fallback when the gallery cache isn't populated (--skip-clone
on a fresh machine, or a failed clone).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X1SjbyvkBXwHm4ZprDQc93
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 72ed1ada-f9ef-4141-bc60-31eaf10981d6


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Delcado19 and others added 2 commits September 13, 2026 17:49
main()'s --preview branch used to discard get_theme_preview()'s return
value entirely, so the not-found path (unknown theme, or missing gallery
data) never reached fzf's preview pane -- it was just blank. Fixed
alongside in HyDE-Project/HyDE#2093; this asserts the actual user-visible
output (stdout), which the debug-log-only checks here didn't cover.

Flagged by CodeRabbit on PR #2093.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X1SjbyvkBXwHm4ZprDQc93
CodeRabbit on HyDE-Project/HyDE#2093: strip_installed_marker() has two call
sites (get_theme_preview()'s JSON lookup, fzf_menu()'s final
SELECTED_THEMES list) and only the first was covered, via the --preview
subprocess path. Simulating fzf_menu()'s actual interactive selection
isn't practical from a black-box test, but the function itself is pure --
a direct unit test against all three prefix shapes (colored, ansi-stripped,
not-installed) covers both call sites at once, since they share it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X1SjbyvkBXwHm4ZprDQc93
@kRHYME7
kRHYME7 merged commit e32eb0d into HyDE-Project:main Sep 13, 2026
1 check passed
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.

2 participants