Skip to content

viewer: storage origin follows the env, not the first stamp - #1191

Merged
wass08 merged 1 commit into
mainfrom
fix/texture-origin-cache
Oct 28, 2026
Merged

wass08 merged 1 commit into
mainfrom
fix/texture-origin-cache

Conversation

@wass08

@wass08 wass08 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

texture-reference cached the Pascal storage origin on its first read. When a texture was stamped before NEXT_PUBLIC_SUPABASE_URL was set, the cache pinned a null origin for the whole process. The native-texture tests from #1190 stamp textures, and on Linux materials.test.ts runs before texture-reference.test.ts, so 3 texture-reference tests failed in private-editor's CI. The origin is now cached by the URL it was read from, so it follows the env.

How to test

  1. cd packages/viewer && bun test ./src/lib/materials.test.ts ./src/lib/texture-reference.test.ts: before this change, 3 fail; now 15 pass. The reverse order also passes.
  2. bun test in packages/viewer: 913 pass.

Screenshots / screen recording

N/A — non-visual change

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

🤖 Generated with Claude Code


Note

Low Risk
Small cache invalidation change in texture URL classification; behavior improves when the Supabase URL is set after module use (mainly tests), with no auth or data-path impact.

Overview
Fixes flaky texture-reference tests when another suite (e.g. materials.test.ts) stamps textures first in the same Bun process.

pascalStorageOrigin() no longer caches a single origin forever on first use. It stores { url, origin } from the current NEXT_PUBLIC_SUPABASE_URL and re-reads the env when that value changes, so an early stamp with a missing env cannot lock null for later tests that set the URL.

The texture-reference.test.ts comment is updated to describe env-driven caching instead of “set env before any stamp in this file.”

Reviewed by Cursor Bugbot for commit 451c1fe. Bugbot is set up for automated code reviews on this repo. Configure here.

…ocess

A texture stamped before NEXT_PUBLIC_SUPABASE_URL is read (the native texture
tests from #1190, run first on Linux) pinned a null origin, so later storage
URLs resolved to no reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wass08
wass08 merged commit f6f435c into main Oct 28, 2026
4 checks passed
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.

1 participant