cog_range_viewer: range a bundled COG hosted via _asset (drop the daemon) - #2
Open
isaacbrodsky wants to merge 3 commits into
Open
cog_range_viewer: range a bundled COG hosted via _asset (drop the daemon)#2isaacbrodsky wants to merge 3 commits into
isaacbrodsky wants to merge 3 commits into
Conversation
…mon) The viewer used a 127.0.0.1 range daemon (range_server.py) to stream a local file into geotiff.js — impossible on a hosted page. With HTTP Range now on the hosted _asset route (and /api/fs/raw locally), a Range-capable URL comes from fused.rawUrl() in both environments, so the daemon is unnecessary everywhere. - Bundle a real tiled COG (sample_cog.tif) so a hosted page has one to stream. - Resolve COG_URL via fused.rawUrl(): hosted -> _asset (Range), local -> /api/fs/raw (Range); an explicit ?url= still ranges a remote COG, and the no-params local default stays the 316 MB public Sentinel-2 demo. On a hosted page the bundled COG is the default, streamed with no daemon. - Remove range_server.py and drop the boot() daemon path. - README: document the daemon-free range sources and URL params. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BvGT8apyoNifxd26L9KbYn
Two fixes to the hosted bundled-COG path:
- Use a string-literal fused.rawUrl("./sample_cog.tif"): the deploy exporter
scans literal rawUrl paths to bundle the file and the hosted runtime maps that
literal to the _asset route. The previous fused.rawUrl("./" + BUNDLED_COG)
concatenation is a computed path -> the COG would be left unbundled/unmapped
and range fetches would 404 hosted. The local ?file= path is genuinely dynamic,
so it hits /api/fs/raw directly rather than through rawUrl (no export warning).
- Detect hosted via window.__FUSED_RENDER__ as well as fused.env === "hosted":
the serve runtime does not (yet) expose fused.env, so the env check alone
silently fails on open.fused.io and the page falls back to the remote default
instead of the bundled COG. Every hosted artifact is seeded with
window.__FUSED_RENDER__ before any script runs (matches hexagon_lab).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BvGT8apyoNifxd26L9KbYn
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7086413. Configure here.
On a hosted page resolveCogUrl ignores ?file= (no local FS) and streams the bundled COG, but FILE_NAME and the lede still treated LOCAL_FILE as authoritative — so a hosted ?file= page could name a disk path and say "on your disk" while actually ranging sample_cog.tif. Gate the UI on LOCAL_ACTIVE (LOCAL_FILE && !HOSTED) so it reflects the file that is really served. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BvGT8apyoNifxd26L9KbYn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
The COG range viewer used a
127.0.0.1range daemon (range_server.py) to stream a local file into geotiff.js — impossible on a hosted page, which is why the daemon-dependent path couldn't be served. With HTTP Range now on the hosted_assetroute (fusedio/fused#336) and on/api/fs/rawlocally, a Range-capable URL comes fromfused.rawUrl()in both environments, so the daemon is unnecessary everywhere.What changed
sample_cog.tif) so a hosted page has a file to stream.COG_URLviafused.rawUrl(): hosted → the Range-capable_assetroute; local →/api/fs/raw(also Range-capable). An explicit?url=still ranges a remote COG, and the no-params local default stays the 316 MB public Sentinel-2 demo. On a hosted page the bundled COG is the default, streamed with no daemon.range_server.pyand drop theboot()daemon path._asset//api/fs/raware same-origin with the page, the cross-origin CORS dance the daemon needed goes away.Depends on
fusedio/fused#336 for the hosted case; the local case works today.🤖 Generated with Claude Code
https://claude.ai/code/session_01BvGT8apyoNifxd26L9KbYn
Generated by Claude Code
Note
Medium Risk
Behavior depends on Range-capable
_assetand/api/fs/raw(hosted case tied to fused #336); incorrect hosted detection or non-literalrawUrlwould break the default COG on deploy.Overview
Removes the localhost
range_server.pypath so geotiff.js always reads a normal HTTP URL withRangesupport—no127.0.0.1daemon orfused.runPythonbootstrap inboot().Adds hosted/local COG resolution at load time:
?url=for any remote COG; on hosted pages,fused.rawUrl("./sample_cog.tif")for a bundledsample_cog.tifserved from the_assetroute; locally,?file=via/api/fs/rawor the existing public Sentinel-2 default. Hosted detection useswindow.__FUSED_RENDER__(andfused.env === "hosted"when available), matchinghexagon_lab. UI copy distinguishes disk vs bundled vs remote sources.Docs describe daemon-free byte sources, deploy, and URL params;
range_server.pyis dropped from the file list in favor ofsample_cog.tif.Reviewed by Cursor Bugbot for commit 8cace66. Bugbot is set up for automated code reviews on this repo. Configure here.