Skip to content

test: add direct tests for _build_event_details TOOL_EXECUTION_COMPLETE branch (#1180)#1181

Open
microsasa wants to merge 1 commit intomainfrom
fix/1180-tool-execution-complete-tests-924481e3da181d1d
Open

test: add direct tests for _build_event_details TOOL_EXECUTION_COMPLETE branch (#1180)#1181
microsasa wants to merge 1 commit intomainfrom
fix/1180-tool-execution-complete-tests-924481e3da181d1d

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Closes #1180

Summary

Adds TestBuildEventDetailsToolExecutionComplete in tests/copilot_usage/test_render_detail.py with direct tests for the TOOL_EXECUTION_COMPLETE branch of _build_event_details.

Tests Added

Test Coverage
test_success_with_tool_name_and_model success=True, tool_name from telemetry, model present → exact joined output "bash ✓ model=claude-sonnet-4"
test_failure_indicator success=False, no telemetry → present, absent
test_model_absent model=None → no model= in output
test_model_empty_string model="" → no model= in output
test_tool_name_absent_no_telemetry toolTelemetry=None → detail starts with indicator, no leading separator
test_malformed_data_returns_empty Invalid event data triggers ValidationError → returns ""

Each test calls _build_event_details(ev) directly with precise string assertions, following the same pattern used by TestBuildEventDetailsSessionShutdown and TestBuildEventDetailsUserMessage.

Warning

⚠️ Firewall blocked 3 domains

The following domains were blocked by the firewall during workflow execution:

  • astral.sh
  • pypi.org
  • releaseassets.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "astral.sh"
    - "pypi.org"
    - "releaseassets.githubusercontent.com"

See Network Configuration for more information.

Generated by Issue Implementer · ● 20.7M ·

…TE branch (#1180)

Add TestBuildEventDetailsToolExecutionComplete class covering:
- Success + tool name + model (joined output assertion)
- Failure indicator (✗ present, ✓ absent)
- Model absent (None and empty string)
- Tool name absent (no telemetry, no leading separator)
- Malformed data guard (ValidationError → empty string)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 4, 2026 06:22
@microsasa microsasa added the aw Created by agentic workflow label May 4, 2026
@microsasa microsasa enabled auto-merge May 4, 2026 06:22
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 adds direct unit tests for the EventType.TOOL_EXECUTION_COMPLETE branch of _build_event_details in copilot_usage.render_detail, closing the test gap identified in #1180.

Changes:

  • Adds TestBuildEventDetailsToolExecutionComplete with focused assertions on the composed detail string (tool name, success/failure indicator, optional model).
  • Covers malformed event payload behavior to ensure _build_event_details returns "" when validation fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw][test audit] _build_event_details has no direct tests for the TOOL_EXECUTION_COMPLETE branch

2 participants