Skip to content

test: cover _safe_event_data exception paths and wildcard case (#885)#887

Merged
microsasa merged 1 commit intomainfrom
test/render-detail-safe-event-data-885-516adeb9515fb1cd
Apr 9, 2026
Merged

test: cover _safe_event_data exception paths and wildcard case (#885)#887
microsasa merged 1 commit intomainfrom
test/render-detail-safe-event-data-885-516adeb9515fb1cd

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Closes #885

Adds tests for two uncovered code paths in render_detail.py:

Gap 1 — _safe_event_data exception recovery

New TestSafeEventData class with three tests:

  • test_returns_none_on_validation_error — constructs a SessionEvent with invalid data (attachments: 123 instead of list[str]) so Pydantic raises ValidationError; asserts the function catches it and returns None.
  • test_returns_none_on_value_error — passes a parser that raises ValueError; asserts the function catches it and returns None.
  • test_returns_none_propagates_to_build_event_details — confirms _build_event_details returns "" when _safe_event_data returns None due to invalid data.

Gap 2 — _build_event_details wildcard case _:

  • test_build_event_details_returns_empty_for_unrecognized_type — passes a SESSION_RESUME event (not handled by any explicit case) and asserts the wildcard branch returns "".

All existing checks pass (make check: lint, typecheck, security, tests at 99% coverage).

Generated by Issue Implementer · ● 4.5M ·

Add tests for two uncovered code paths in render_detail.py:

- _safe_event_data: ValidationError and ValueError recovery branches
- _build_event_details: wildcard case returning '' for unhandled event types

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 9, 2026 15:26
@microsasa microsasa added the aw Created by agentic workflow label Apr 9, 2026
@microsasa microsasa enabled auto-merge April 9, 2026 15:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes #885 by adding unit tests that exercise previously uncovered exception-recovery paths in render_detail._safe_event_data() and the wildcard (case _:) branch in render_detail._build_event_details().

Changes:

  • Add targeted tests to ensure _safe_event_data() returns None on ValidationError and ValueError.
  • Add a test ensuring _build_event_details() returns "" when _safe_event_data() returns None.
  • Add a test covering _build_event_details()’s wildcard branch for unrecognized event types.

@microsasa microsasa added the aw-quality-gate-approved Quality gate approved the PR label Apr 9, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low-impact test-only addition covering _safe_event_data exception recovery paths and _build_event_details wildcard case. Tests are meaningful, well-structured, follow existing patterns, and comply with coding guidelines. All CI checks pass. Auto-approving for merge.

@microsasa microsasa merged commit 70626ed into main Apr 9, 2026
8 checks passed
@microsasa microsasa deleted the test/render-detail-safe-event-data-885-516adeb9515fb1cd branch April 9, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow aw-quality-gate-approved Quality gate approved the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw][test audit] render_detail: _safe_event_data exception paths and wildcard case are never exercised

2 participants