fix: make thread view --unread filter correctly across all output modes - #86
Merged
Conversation
…t modes The --unread flag had two bugs: JSON/NDJSON output ignored the flag entirely (returning all comments), and when no unread comments existed the command exited without showing the original post. Move unread filtering before the output branches so it applies uniformly, and always display the original post for context when --unread is set. Closes #75 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
This PR improves the consistency of the --unread filter across all output modes and ensures the original post is always displayed for context even when no new comments are present. These changes provide a much more reliable experience for users working with structured data while maintaining helpful context in the CLI. Some efficiency gains could be achieved by limiting user lookups to only those users appearing in the filtered comment set, and the test isolation could be further strengthened to prevent state leaking between test blocks.
…tion Build user ID set from displayComments/contextComments instead of all comments, avoiding unnecessary batch calls when --unread filters most comments out. Use vi.resetAllMocks() in unread test block for proper mock isolation between describe blocks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Mar 15, 2026
## [2.14.1](v2.14.0...v2.14.1) (2026-03-15) ### Bug Fixes * make thread view --unread filter correctly across all output modes ([#86](#86)) ([92478c9](92478c9))
|
🎉 This PR is included in version 2.14.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
--unread: Previously the structured output paths returned early before unread filtering was applied, so--unread --jsonreturned all comments unfiltered--unreadwith no unread data just printed "No unread comments in this thread." and exited; now the thread title, channel, and original post are displayed for context before the message--unreadacross human-readable, JSON, and NDJSON output modesCloses #75
Test plan
npm run type-checkpassesnpm testpasses (268 tests, 6 new)tw thread view <url> --unreadshows original post + "No unread comments."tw thread view <url> --unread --jsonreturns thread with empty comments arraytw thread view <url> --json(without --unread) still returns all comments🤖 Generated with Claude Code