Skip to content

fix: remove dead child_ids field from _VSCodeDiscoveryCache (#1174)#1176

Open
microsasa wants to merge 1 commit intomainfrom
fix/remove-dead-child-ids-field-1174-ee1dd30e93807567
Open

fix: remove dead child_ids field from _VSCodeDiscoveryCache (#1174)#1176
microsasa wants to merge 1 commit intomainfrom
fix/remove-dead-child-ids-field-1174-ee1dd30e93807567

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Summary

Remove the unused child_ids field from _VSCodeDiscoveryCache which was stored on every cache miss but never consulted on cache hits, causing silent memory overhead proportional to the number of session directories.

Changes

src/copilot_usage/vscode_parser.py:

  • Removed child_ids: _ChildIds from _VSCodeDiscoveryCache frozen dataclass
  • Removed child_ids=child_ids from the cache construction in _cached_discover_vscode_logs
  • Updated dataclass docstring to remove mention of child_ids being retained
  • Kept child_ids as a local variable where it's used (no semantic change)
  • Kept _ChildIds type alias (still used by _scan_child_ids and _newest_child_from_ids)

tests/copilot_usage/test_vscode_parser.py:

  • Removed child_ids=cached.child_ids kwarg from test_cache_invalidated_on_root_mtime_change
  • Replaced assert cached.child_ids == _scan_child_ids(tmp_path) with assertions on newest_child_path and newest_child_id fields
  • Removed child_ids=frozenset() from TestVSCodeDiscoveryCacheIsFrozen

Closes #1174

Warning

⚠️ Firewall blocked 3 domains

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

  • astral.sh
  • pypi.org
  • repo.anaconda.com

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

network:
  allowed:
    - defaults
    - "astral.sh"
    - "pypi.org"
    - "repo.anaconda.com"

See Network Configuration for more information.

Generated by Issue Implementer · ● 9.9M ·

The `child_ids` field was stored on every cache miss but never read
on cache hits, causing dead memory overhead proportional to the number
of session directories. This removes the field from the dataclass while
keeping `child_ids` as a local variable in `_cached_discover_vscode_logs`
where it is actually used.

- Remove `child_ids: _ChildIds` from `_VSCodeDiscoveryCache` dataclass
- Update docstring to remove mention of stored child_ids
- Update tests to remove `child_ids` kwarg from constructor calls
- Replace `cached.child_ids` assertion with checks on remaining fields

Closes #1174

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

Removes an unused _VSCodeDiscoveryCache.child_ids field from the VS Code log discovery cache to eliminate unnecessary per-entry memory overhead while keeping cache-hit behavior unchanged.

Changes:

  • Dropped the child_ids field from _VSCodeDiscoveryCache and stopped persisting it in _VSCODE_DISCOVERY_CACHE.
  • Updated _VSCodeDiscoveryCache docstring to reflect the simplified cached state.
  • Adjusted unit tests to stop constructing/asserting against the removed field and validate the remaining sentinel fields instead.

Reviewed changes

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

File Description
src/copilot_usage/vscode_parser.py Removes the dead cached child_ids field and updates cache population + docstring accordingly.
tests/copilot_usage/test_vscode_parser.py Updates cache-related tests to match the new dataclass shape and assert on newest_child_* instead of child_ids.

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

2 participants