Skip to content

Conversation

andrewbranch
Copy link
Member

I forgot to clean up the diskFile cache, so it was growing infinitely. The new logging exposed the problem.

@andrewbranch andrewbranch requested review from Copilot and gabritto and removed request for Copilot August 28, 2025 18:05
// during `npm install` or git operations.
// !!! This can probably be replaced by ScheduleDiagnosticsRefresh()
snapshotUpdateCancel context.CancelFunc
snapshotUpdateMu sync.Mutex
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing this and the related code was a bit of a drive-by cleanup. There’s really no reason to trigger a snapshot change internally; the only time we were using this we also scheduled a diagnostics refresh, and the subsequent diagnostics request would have updated the snapshot as needed. It's simpler and cleaner to let snapshot updates be purely reactive to a client request/notification.

@Copilot Copilot AI review requested due to automatic review settings August 28, 2025 18:16
Copy link
Contributor

@Copilot 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 improves logging infrastructure and fixes a memory leak in the disk file cache. The snapshot cloning process gains more detailed logging for debugging, while cached disk files are now properly cleaned up when projects are closed.

  • Added detailed reason logging for snapshot updates to improve debugging visibility
  • Fixed memory leak by implementing disk file cache cleanup when projects are no longer active
  • Enhanced cache statistics logging and removed redundant snapshot update scheduling

Reviewed Changes

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

Show a summary per file
File Description
internal/project/snapshot_test.go Adds test to verify disk file cache cleanup functionality
internal/project/snapshot.go Implements disk file cleanup logic and enhanced logging for snapshot cloning
internal/project/session.go Adds update reason tracking, removes redundant snapshot scheduling, and improves cache logging
internal/project/projectcollectionbuilder.go Preserves seenFiles when cloning programs to maintain file tracking
internal/project/overlayfs.go Removes unused IncludesWatchChangesOnly tracking
internal/project/filechange.go Removes IncludesWatchChangesOnly field from FileChangeSummary
internal/project/compilerhost.go Adds seenFiles tracking to compiler host for file access monitoring
internal/project/ata/ata_test.go Updates test to trigger diagnostics refresh for proper ATA testing
internal/lsp/server.go Adds support for LSP trace notifications to control logging verbosity

@andrewbranch andrewbranch added this pull request to the merge queue Aug 28, 2025
Merged via the queue into microsoft:main with commit 52f2ee4 Aug 28, 2025
22 checks passed
@andrewbranch andrewbranch deleted the snapshots/more-logging branch August 28, 2025 19:52
zshannon pushed a commit to zshannon/typescript-go that referenced this pull request Oct 6, 2025
zshannon pushed a commit to zshannon/typescript-go that referenced this pull request Oct 6, 2025
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.

3 participants