Skip to content

fix(ui): skip invalid MacOSPref entries (empty domain/key) in snapshot editor#48

Merged
fullstackjam merged 2 commits intomainfrom
claude/hopeful-kowalevski-5297e2
Apr 22, 2026
Merged

fix(ui): skip invalid MacOSPref entries (empty domain/key) in snapshot editor#48
fullstackjam merged 2 commits intomainfrom
claude/hopeful-kowalevski-5297e2

Conversation

@fullstackjam
Copy link
Copy Markdown
Collaborator

Summary

  • A corrupted or old-format snapshot file can contain a MacOSPref entry with an empty Key (e.g. Domain="cirruslabs/cli", Key=""), which caused that entry to appear in the macOS Prefs tab as "cirruslabs/cli." — visually indistinguishable from just "cirruslabs/cli" because the trailing dot is tiny and the "= ()" description renders in faint gray.
  • Every valid macOS preference requires both a non-empty Domain and a non-empty Key. Entries missing either are now skipped when building the macOS Prefs tab in NewSnapshotEditor.
  • The tap itself (cirruslabs/cli) is already correctly shown in the Taps tab from snap.Packages.Taps; only the phantom MacOSPref entry is dropped.

What changed

  • internal/ui/snapshot_editor.go: Changed pref-items loop from pre-allocated slice to append-with-guard, skipping any MacOSPref where Domain == "" or Key == "".
  • internal/ui/snapshot_editor_test.go: Added TestNewSnapshotEditorSkipsInvalidMacOSPrefs to cover tap-misclassified-as-pref entries, empty-domain entries, and valid new prefs.

Test plan

  • make test-unit passes
  • Run openboot snapshot capture and confirm no items appear in the macOS Prefs tab that look like Homebrew taps
  • Import a snapshot file containing a macos_prefs entry with empty key and confirm it is silently dropped from the macOS Prefs tab

…editor

A corrupted or old-format snapshot file can contain a MacOSPref entry
with an empty Key (e.g. Domain="cirruslabs/cli", Key=""), which would
render as "cirruslabs/cli." in the macOS Prefs tab instead of in Taps.

Filter out any MacOSPref entry where Domain or Key is empty in
NewSnapshotEditor, since every valid macOS preference requires both.
The tap itself is already correctly shown in the Taps tab.
@github-actions
Copy link
Copy Markdown

👋 Thanks for opening this pull request!

Before merging:

  • Code follows existing patterns in the codebase
  • go build ./... and go vet ./... pass
  • Commit message is clear and descriptive

@fullstackjam will review this soon. Thanks for contributing! 🚀

@github-actions github-actions Bot added tests Tests only ui Terminal UI labels Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullstackjam fullstackjam merged commit 6b33bdb into main Apr 22, 2026
9 checks passed
@fullstackjam fullstackjam deleted the claude/hopeful-kowalevski-5297e2 branch April 22, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests only ui Terminal UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant