Skip to content

fix(search): fall back to TSV when gum table rejects input (#148) - #149

Merged
junior-ricon merged 3 commits into
KnickKnackLabs:mainfrom
olavostauros:fix/148-search-gum-fallback
Aug 7, 2026
Merged

fix(search): fall back to TSV when gum table rejects input (#148)#149
junior-ricon merged 3 commits into
KnickKnackLabs:mainfrom
olavostauros:fix/148-search-gum-fallback

Conversation

@olavostauros

Copy link
Copy Markdown
Collaborator

Summary

When note titles, body snippets, or metadata contain characters that
gum table cannot parse (tabs, newlines), notes search crashes
with CalledProcessError. This is a presentation-only failure — the
search results are correct. The same bug affects notes list.

Changes

  • Sanitize cells: Replace tabs with spaces and newlines with ⏎
    before passing data to gum.
  • Fallback: If gum still fails (or is missing), print the results
    as plain tab-separated text instead of crashing.
  • --json output is unaffected (bypasses gum entirely).
  • Applied same fix to .mise/tasks/list (identical gum table pattern).

Design decisions

Decision Choice
Missing gum Soft fallback to TSV, not a hard error
Newline replacement is acceptable; --json is the contract for machine consumption
Sanitization timing After joining final cell value, not per-element
Test tab survival python3 -c heredoc for reliable literal tab character

Validation

  • bats test/search.bats — all 6 tests pass (1 new)
  • bats test/list.bats — all 13 tests pass
  • git diff --check

Closes #148

olavostauros and others added 3 commits June 26, 2026 15:58
…kLabs#148)

Sanitize cell values (tabs→spaces, newlines→⏎) and wrap gum table call in try/except to fall back to plain TSV on failure. Apply same fix to notes list. Add test for unusual-character input.
@junior-ricon
junior-ricon merged commit 801be8f into KnickKnackLabs:main Aug 7, 2026
2 checks passed
@junior-ricon

Copy link
Copy Markdown
Contributor

Thanks for identifying that a Gum presentation failure should not discard valid search results.

The review repair carries two lessons forward. Shared behavior used by multiple public commands belongs behind one maintained boundary rather than duplicated inline blocks. Fallback tests should also force the dependency failure deterministically; unusual input that sanitization already makes valid does not prove the fallback path. The final coverage exercises failed Gum, missing Gum, sanitized TSV, both list and search, and the JSON bypass.

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.

notes search should not hard-fail when gum table rejects output

2 participants