Merged
Conversation
Resolves panic that occurred when trying to acknowledge incidents by removing unsafe dereferences of m.selectedIncident in message handler closures. The closures were capturing the incident pointer at creation time, which could be nil, rather than at execution time when the incident data is guaranteed to be available. Changes: - Modified acknowledge/unacknowledge message handlers to create empty message structs instead of dereferencing m.selectedIncident in closures - Updated Update() function handlers to safely retrieve incident from model state when processing messages - Added nil check in silence incidents handler to prevent panic when appending selected incident The fix ensures that incident data is accessed only after it has been fetched from PagerDuty and stored in the model, preventing nil pointer dereferences. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Multiple performance and functionality improvements: - Fix re-escalation "Assignee cannot be empty" error by skipping unnecessary un-acknowledge step and going directly to re-escalation with proper user email authentication - Add comprehensive terminal escape sequence filtering to prevent fake keypresses from clogging the message queue (OSC, CSI, CPR responses) - Implement priority handling for all user keypresses to ensure responsive UI even when async messages are queued - Optimize auto-acknowledge feature with early return when disabled and cached on-call check to reduce API calls from N to 1 per cycle - Remove triple template rendering - now renders once on explicit request - Fix viewport consuming ESC and navigation keys with handledKey flag - Add debug logging to track re-escalation flow - Clean up unused code: remove unAcknowledgedIncidentsMsg and reEscalate parameter from acknowledgeIncidents() Performance impact: - ESC/Enter keys now respond immediately instead of waiting for queued messages - Auto-acknowledge overhead reduced to near-zero when feature is disabled - Eliminated redundant template renders (3x → 1x per incident view) Fixes: https://github.com/clcollins/srepd/issues/XXX 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Adds comprehensive unit tests for pure display/formatting functions in pkg/tui/views.go that were previously untested: - assigneeArea(): Tests formatting of "You", "Team", and custom assignee displays - statusArea(): Tests formatting of status messages with various content - refreshArea(): Tests all combinations of auto-refresh and auto-acknowledge flags - summarizeNotes(): Tests conversion of PagerDuty notes to display format - summarizeIncident(): Tests incident conversion including priority, assignments, and duplicate acknowledgement deduplication - addNoteTemplate(): Tests note template generation with incident context All 6 functions now have test coverage with 16 test cases total, covering: - Edge cases (empty inputs, nil values) - Normal operation (single/multiple items) - Business logic (deduplication, conditional formatting) Test coverage: pkg/tui/views_test.go Tests pass: go test ./pkg/tui -v 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Fixes ineffectual assignment warnings from golangci-lint and ensures
linting runs before tests to catch issues early.
Changes:
- pkg/tui/msgHandlers.go:
- Remove ineffectual assignments to handledKey in switchIncidentFocusMode()
- All removed assignments were in cases that return immediately, making
the assignment unreachable and unnecessary
- Affected cases: Refresh, Ack, UnAck, Silence, Note, Login, Open
- handledKey is only checked at the end of the function to determine
whether to pass the message to the viewport
- Makefile:
- Add lint as a dependency to the test target
- Ensures golangci-lint runs before tests to catch linting issues early
- Updated help text to "Run tests (after linting)"
Testing:
- All golangci-lint checks pass (0 issues)
- All unit tests pass
- `make test` now runs linting automatically before tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
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
Adds comprehensive unit tests for previously untested helper functions in
pkg/tui/views.go.Changes
Created
pkg/tui/views_test.gowith tests for 6 pure functions:Functions Tested
assigneeArea() - 3 test cases
statusArea() - 3 test cases
refreshArea() - 4 test cases
summarizeNotes() - 3 test cases
summarizeIncident() - 3 test cases
addNoteTemplate() - 1 test case
Test Coverage
pkg/tui/views_test.go(331 lines)Testing
All tests pass:
Notes
This PR focuses on testing pure display/formatting functions in views.go. The larger untested files (tui.go, msgHandlers.go) contain stateful Bubble Tea logic that will require more complex test setup and are deferred to future work.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com