Skip to content

Namespace the extracted game-asset cache by installation root - #116

Merged
Frotty merged 1 commit into
masterfrom
fix/namespace-game-asset-cache-by-root
Sep 7, 2026
Merged

Namespace the extracted game-asset cache by installation root#116
Frotty merged 1 commit into
masterfrom
fix/namespace-game-asset-cache-by-root

Conversation

@Frotty

@Frotty Frotty commented Sep 7, 2026

Copy link
Copy Markdown
Member

Closes #110.

The cache under ~/.wurst/casc_cache/{casc|mpq}/... was keyed only by storage kind, so pointing wurst.wc3path at a different install of the same kind (two Reforged builds, a PTR beside retail) kept serving assets extracted from whichever one was cached first.

Each cache path is now keyed by kind + a short hash of the install root, and lookups return the exact path they read or wrote instead of re-deriving it from a root that may have changed in between. The tag hashes the root's realpath, so one install reached via a symlink, a different drive-letter case, or a hand-typed setting shares a single bucket rather than duplicating the whole extracted tree — the path handed to the native storage openers is unchanged.

Three routes that bypassed the namespace are closed: the pre-kind-split casc_cache/<asset> layout is no longer read, getCandidateRoots() no longer offers the cache as a generic local asset root, and no path inside the cache can become one (previewing a file that itself lives in the cache used to walk ancestors back into another install's bucket).

Top-level cache dir path is unchanged, so the webview localResourceRoots entry still works.

Deliberate trade-offs

  • Cached bytes are only readable while an install is detected. With no live root there's no way to tell which bucket belongs to the active install, so a lookup reports a miss rather than guessing. Previously a populated cache still served icons with no install detected; now it doesn't.
  • Existing caches are orphaned and re-extracted once, which is the option the issue called for. Nothing prunes the old trees — worth a follow-up if it matters.

Not covered

Parsed SLK/profile/catalog data cached in memory (wc3Data.ts, objModPreview.ts) isn't cleared when wurst.wc3path changes, so it can still answer with the previous install's data until a window reload. Pre-existing and a separate subsystem — filed as #117.

Checks

tsc --noEmit, npm run lint, npm test, and npm run test:e2e (44 passed) all green.

@Frotty

Frotty commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T08:29:43.484526Z c34241d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 542cd3ec63

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/preview/cascStorage.ts Outdated
@Frotty

Frotty commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a42a470b2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/preview/cascStorage.ts Outdated
@Frotty

Frotty commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@Frotty
Frotty force-pushed the fix/namespace-game-asset-cache-by-root branch from b4a54a6 to 7874ead Compare September 7, 2026 07:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4a54a64bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/preview/cascStorage.ts Outdated
@Frotty

Frotty commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7874ead4bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/preview/cascStorage.ts
@Frotty

Frotty commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23015750f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/preview/cascStorage.ts Outdated
@Frotty

Frotty commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 885b7bb27a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/preview/cascStorage.ts Outdated
Comment thread src/features/preview/cascStorage.ts Outdated
@Frotty

Frotty commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c34241d90b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/features/preview/cascStorage.ts Outdated
The cache under ~/.wurst/casc_cache/{casc|mpq}/... was keyed only by
storage kind, so pointing wurst.wc3path at a different install of the
same kind (two Reforged builds, a PTR beside retail) kept serving
assets extracted from whichever one was cached first. #109 made a root
switch take effect at runtime, which made it easy to hit.

Each cache path is now keyed by kind + a short hash of the install
root, and the lookups hand back the exact path they read or wrote
rather than re-deriving it afterwards from a root that may have
changed in between. The tag hashes the root's realpath, so the same
install reached via a symlink, a different drive-letter case or a
hand-typed setting shares one bucket instead of duplicating the whole
extracted tree; the path given to the storage openers is unchanged.

Three routes that bypassed the namespace are closed: the pre-kind-split
casc_cache/<asset> layout is no longer read, getCandidateRoots() no
longer offers the cache as a generic local asset root, and no path
inside the cache can become one — previewing a file that itself lives
in the cache used to walk ancestors back into another install's bucket.

Cache entries can only be read back when an install is detected, since
otherwise there is no way to know which bucket belongs to the active
one. Existing caches are orphaned and re-extracted once, the trade-off
the issue called for.

Closes #110.
@Frotty
Frotty force-pushed the fix/namespace-game-asset-cache-by-root branch from c34241d to ddfc51b Compare September 7, 2026 08:46
@Frotty
Frotty merged commit b99ab87 into master Sep 7, 2026
1 check passed
@Frotty
Frotty deleted the fix/namespace-game-asset-cache-by-root branch September 7, 2026 08:54
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.

Namespace the extracted game-asset cache by installation root

1 participant