Skip to content

test(vscode_parser): cover three untested caching/discovery scenarios (#876)#1000

Merged
microsasa merged 2 commits intomainfrom
fix/876-vscode-parser-test-gaps-c7d8ea9f219a0a10
Apr 19, 2026
Merged

test(vscode_parser): cover three untested caching/discovery scenarios (#876)#1000
microsasa merged 2 commits intomainfrom
fix/876-vscode-parser-test-gaps-c7d8ea9f219a0a10

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Closes #876

Adds three tests addressing untested scenarios in vscode_parser.py:

Gap 1 — _scan_child_ids symlink exclusion

test_symlinked_directory_excluded verifies that symlinked directories are excluded from child_ids when follow_symlinks=False is used, documenting the current intentional behaviour.

Gap 2 — _cached_discover_vscode_logs child-dir cache invalidation

test_cache_misses_when_child_dir_added verifies that adding a new child directory under a watched root causes a cache miss (root st_mtime_ns changes) and triggers a re-glob that picks up log files in the new child. Uses a glob-counting spy to assert exactly two glob calls across two discovery invocations.

Gap 3 — get_vscode_summary partial OSError

test_partial_oserror_returns_data_from_surviving_files verifies that an OSError on one log file does not suppress data from other successfully parsed files. Uses real file discovery (no mock of _cached_discover_vscode_logs) with a monkeypatched _get_cached_vscode_requests to simulate a read failure on one specific path.

Verification

  • make fix — no formatting changes needed
  • make check — all checks pass (lint, typecheck, security, tests at 99% coverage)

Generated by Issue Implementer · ● 12.8M ·

…ation, and partial OSError

Add three tests addressing untested scenarios in vscode_parser.py:

1. _scan_child_ids symlink exclusion: Verify that symlinked directories
   are excluded from child_ids when follow_symlinks=False is used,
   documenting the intentional behaviour.

2. _cached_discover_vscode_logs child-dir cache miss: Verify that
   adding a new child directory under a watched root causes a cache
   miss (root mtime changes) and triggers a re-glob.

3. get_vscode_summary partial OSError: Verify that an OSError on one
   log file does not suppress data from other successfully parsed
   files, using real file discovery with monkeypatched read failure.

Closes #876

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsasa microsasa added the aw Created by agentic workflow label Apr 19, 2026
Copilot AI review requested due to automatic review settings April 19, 2026 07:57
@microsasa microsasa added the aw Created by agentic workflow label Apr 19, 2026
@microsasa microsasa enabled auto-merge April 19, 2026 07:57
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

Adds regression tests to improve confidence in src/copilot_usage/vscode_parser.py’s discovery/caching behavior and its ability to return partial results when one file read fails.

Changes:

  • Add a test documenting that _scan_child_ids() excludes symlinked directories (with follow_symlinks=False).
  • Add a test asserting _cached_discover_vscode_logs() re-globs when a new child session directory is added (via cache invalidation).
  • Add a test asserting get_vscode_summary() continues and returns data from readable files when one file raises OSError.

Comment thread tests/copilot_usage/test_vscode_parser.py Outdated
Comment thread tests/copilot_usage/test_vscode_parser.py
- Wrap symlink_to in try/except with pytest.skip for environments
  where symlinks are not supported
- Force deterministic mtime change via os.utime before cache-miss
  assertion to avoid flakiness on coarse-timestamp filesystems

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Commit pushed: 2f5845d

Generated by Review Responder

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@microsasa microsasa added the aw-quality-gate-approved Quality gate approved the PR label Apr 19, 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 three untested edge cases in vscode_parser.py (symlink exclusion, cache invalidation on new child dirs, partial OSError resilience). Tests are well-structured, follow existing patterns, and CI is fully green. Auto-approving for merge.

@microsasa microsasa merged commit e52d1b5 into main Apr 19, 2026
10 checks passed
@microsasa microsasa deleted the fix/876-vscode-parser-test-gaps-c7d8ea9f219a0a10 branch April 19, 2026 08:12
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

2 participants