Skip to content

Conversation

@lukemelia
Copy link
Contributor

  • FileDef instances already live in CardStoreWithGarbageCollection, but GC and reference counting only consider cards.
  • Requirement: file-meta instances should participate in GC and reference counting.

This PR creates the following behavior:

  • Keep FileDef instances alive when they have active references.
  • GC FileDef instances when their references drop to zero.

@github-actions
Copy link

Preview deployments

@lukemelia lukemelia requested review from a team, Copilot and habdelra January 22, 2026 23:45
@lukemelia lukemelia changed the title Add file-meta GC coverage Add FielDef GC coverage Jan 22, 2026
@lukemelia lukemelia changed the title Add FielDef GC coverage Add FileDef GC coverage Jan 22, 2026
@github-actions
Copy link

github-actions bot commented Jan 22, 2026

Host Test Results

    1 files  ±0      1 suites  ±0   1h 44m 33s ⏱️ + 1m 12s
1 900 tests +2  1 883 ✅ +2  17 💤 ±0  0 ❌ ±0 
1 915 runs  +2  1 898 ✅ +2  17 💤 ±0  0 ❌ ±0 

Results for commit 74c2cf2. ± Comparison against base commit 066245f.

♻️ This comment has been updated with latest results.

Copy link
Contributor

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 extends the garbage collection (GC) mechanism in CardStoreWithGarbageCollection to include FileDef instances, which previously only participated in storage but not in GC and reference counting.

Changes:

  • Renamed internal variables from "card" terminology to "instance" terminology to reflect that the maps now store both CardDef and FileDef instances
  • Updated the sweep method to handle FileDef instances separately from CardDef instances, since FileDef doesn't participate in the dependency graph
  • Enhanced the hasReferences method to work with both localIds (for CardDef) and remote URLs (for FileDef)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/host/tests/integration/store-test.gts Added two test cases verifying that FileDef instances are retained when referenced and garbage collected when references drop
packages/host/app/lib/gc-card-store.ts Extended GC logic to handle FileDef instances, renamed variables for clarity, and updated hasReferences to work with both card and file identifiers

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

#nonTrackedInstances = new Map<string, StoredInstance>();
#nonTrackedInstanceErrors = new Map<string, CardErrorJSONAPI>();

#cards = new TrackedMap<string, StoredInstance>();
Copy link
Contributor

Choose a reason for hiding this comment

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

to be consistent we should probably rename this to instances

Copy link
Contributor

Choose a reason for hiding this comment

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

i noticed u didn't change this--was that an oversight?

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