Skip to content

[TS-3287] Cached ecosystem fetch#2126

Open
ethangreen-dev wants to merge 14 commits into
developfrom
ecosystem-fetch
Open

[TS-3287] Cached ecosystem fetch#2126
ethangreen-dev wants to merge 14 commits into
developfrom
ecosystem-fetch

Conversation

@ethangreen-dev
Copy link
Copy Markdown
Collaborator

@ethangreen-dev ethangreen-dev commented Apr 14, 2026

Fetches the latest schema from the API on game selection with a 12 hour refresh window (can be tuned or removed if not necessary). Schema is cached locally and update requests make proper use of the 304 response to avoid pulling the schema when it hasnt been updated.

This was initially a PR from the Thunderstore fork. Deleted that, make a new PR in this repo.

Depends on #2113

@ebkr ebkr changed the base branch from develop to ecosystem-merge April 14, 2026 12:49
@ethangreen-dev ethangreen-dev marked this pull request as ready for review April 14, 2026 23:04
@ethangreen-dev ethangreen-dev requested a review from ebkr April 14, 2026 23:04
Comment thread src/r2mm/ecosystem/EcosystemSchema.ts Outdated
Comment thread src/r2mm/ecosystem/EcosystemSchema.ts Outdated
Comment thread src/r2mm/ecosystem/EcosystemSchema.ts Outdated
Comment thread test/vitest/tests/unit/EcosystemSchema/EcosystemSchema.spec.ts Outdated
@ebkr ebkr force-pushed the ecosystem-merge branch from 385e74c to d8825c9 Compare April 15, 2026 09:52
@ethangreen-dev ethangreen-dev requested a review from ebkr April 20, 2026 04:54
@ebkr ebkr requested a review from Copilot April 20, 2026 05:30
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

This PR adds a network-backed update path for the Thunderstore ecosystem schema: when the game selection screen loads, the app fetches the latest schema from the API, caches it to disk, and uses If-Modified-Since / 304 Not Modified to avoid downloading unchanged data.

Changes:

  • Implement schema fetching, merge logic, and Last-Modified persistence in EcosystemSchema.ts.
  • Trigger schema update from GameSelectionScreen.vue on mount.
  • Expand unit tests to cover fetch success, 304 handling, failure behavior, merge behavior, and modloader package deduplication.

Reviewed changes

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

File Description
src/r2mm/ecosystem/EcosystemSchema.ts Implements the cached fetch flow (including If-Modified-Since / Last-Modified) and merges fetched data with the bundled schema.
src/pages/GameSelectionScreen.vue Calls the update routine when the game selection screen mounts.
test/vitest/tests/unit/EcosystemSchema/EcosystemSchema.spec.ts Adds mocks and new test cases to validate fetch/caching/merge behavior.

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

Comment thread test/vitest/tests/unit/EcosystemSchema/EcosystemSchema.spec.ts Outdated
Comment thread src/r2mm/ecosystem/EcosystemSchema.ts Outdated
Comment thread src/pages/GameSelectionScreen.vue Outdated
Comment thread src/pages/GameSelectionScreen.vue Outdated
@ethangreen-dev ethangreen-dev changed the title Cached ecosystem fetch [TS-3287] Cached ecosystem fetch Apr 20, 2026
@ethangreen-dev ethangreen-dev changed the base branch from ecosystem-merge to develop May 2, 2026 05:42
Fetches the latest schema from the API on game selection. Uses the 304
response of the API to determine if the remote version has been updated
since the last request. Not a huge difference in performance locally but
more efficient on the server side.
This is basically a four-step approach. The provider:
1. Checks to see if the images are bundled.
2. Checks to see if an instance of the schema is being served on
   localhost:1337
3. Checks to see if any images have been cached locally.
4. Retrieves the image from the CDN.

Notably this also features the fire-once-and-fail-quick CDN check where
it checks the connection once during startup and, if it fails, attempts
steps 1-3 and then uses a default image.
[TS-3696] Use CDN image assets
[TS-3708] Pull game images from cdn / localhost in sync script
[TS-3714] Add new game image placeholder asset
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