Skip to content

test: cover untested behavioral branches (#44)#46

Merged
microsasa merged 3 commits intomainfrom
fix/issue-44-untested-behavioral-branches-ce289d60d8573a5e
Mar 14, 2026
Merged

test: cover untested behavioral branches (#44)#46
microsasa merged 3 commits intomainfrom
fix/issue-44-untested-behavioral-branches-ce289d60d8573a5e

Conversation

@microsasa
Copy link
Owner

Closes #44

Changes

Adds direct test coverage for three behavioral branches that had no tests:

1. last_resume_time display in report.py

  • TestRenderLiveSessions.test_last_resume_time_used_over_start_time — verifies render_live_sessions shows duration from last_resume_time (not start_time) when both are set.
  • TestRenderFullSummary.test_active_section_uses_last_resume_time — same guarantee for _render_active_section in the full summary view.

2. _FileChangeHandler debounce in cli.py

  • TestFileChangeHandler.test_dispatch_sets_event_on_first_call — first dispatch sets the change event.
  • TestFileChangeHandler.test_dispatch_suppresses_within_debounce_window — rapid second call within 2 s is suppressed.
  • TestFileChangeHandler.test_dispatch_fires_again_after_debounce_gap — dispatch fires again after > 2 s gap.
  • test_stop_observer_none_is_noop_stop_observer(None) returns without raising.

3. _read_config_model non-string values in parser.py

  • test_config_model_integer_returns_none{"model": 42}None
  • test_config_model_null_returns_none{"model": null}None
  • test_config_model_list_returns_none{"model": []}None

Testing

All 10 new tests follow existing patterns and conventions. No source code changes — tests only.

Generated by Issue Implementer ·

Warning

⚠️ Firewall blocked 2 domains

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

  • astral.sh
  • pypi.org

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

network:
  allowed:
    - defaults
    - "astral.sh"
    - "pypi.org"

See Network Configuration for more information.

@microsasa microsasa marked this pull request as ready for review March 14, 2026 19:49
@microsasa microsasa requested a review from Copilot March 14, 2026 20:02
Copy link

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

Adds regression tests to ensure resumed-session runtime is calculated from last_resume_time, improves parser robustness around malformed config.json model fields, and adds coverage for CLI watchdog observer utilities.

Changes:

  • Add report rendering tests to verify last_resume_time takes precedence over start_time when computing “running time”.
  • Add parser tests ensuring non-string config.json["model"] values result in summary.model is None.
  • Add CLI tests for _stop_observer(None) and _FileChangeHandler debounce behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/copilot_usage/test_report.py New regression tests for “running time” display using last_resume_time in live + full summary views.
tests/copilot_usage/test_parser.py New tests for config model parsing when model is invalid type (int/null/list).
tests/copilot_usage/test_cli.py New tests for observer stop guard and file-change debounce behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

github-actions bot and others added 3 commits March 14, 2026 13:12
Add tests for three uncovered behavioral branches:

1. report.py: render_live_sessions and _render_active_section now have
   tests verifying that last_resume_time is used over start_time when
   both are set.

2. cli.py: _FileChangeHandler.dispatch debounce logic is tested for
   first-call event setting, suppression within 2s, and re-firing
   after the debounce window. _stop_observer(None) no-op guard is
   also tested.

3. parser.py: _read_config_model non-string model values ({"model": 42},
   {"model": null}, {"model": []}) are tested to return None.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use large time gaps (days vs minutes) for resume-time assertions
and explicitly set _last_trigger for debounce test determinism.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsasa microsasa force-pushed the fix/issue-44-untested-behavioral-branches-ce289d60d8573a5e branch from 66790d8 to cac623c Compare March 14, 2026 20:12
@microsasa microsasa merged commit 1a33a3d into main Mar 14, 2026
4 checks passed
@microsasa microsasa deleted the fix/issue-44-untested-behavioral-branches-ce289d60d8573a5e branch March 16, 2026 07:08
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.

[aw][test audit] Untested behavioral branches: last_resume_time display, FileChangeHandler debounce, config non-string model

2 participants