Skip to content

Do not flag embedded deck.gl rows as unloadable in the share-readiness check - #1823

Merged
giswqs merged 2 commits into
mainfrom
fix/share-readiness-embedded-rows
Aug 10, 2026
Merged

Do not flag embedded deck.gl rows as unloadable in the share-readiness check#1823
giswqs merged 2 commits into
mainfrom
fix/share-readiness-embedded-rows

Conversation

@giswqs

@giswqs giswqs commented Aug 10, 2026

Copy link
Copy Markdown
Member

Two follow-ups to the share-readiness check from #1812. Both came from review comments that landed after that PR was merged, so they could not be folded into it.

Refs #1671.

Embedded deck.gl rows were reported as unloadable

A non-GeoJSON deck.gl visualization (arc, heatmap, hexagon built from a CSV) keeps its rows in source.data as an array (createDeckVizStoreLayer in packages/plugins/src/plugins/deckgl-viz/store-layer.ts, read back by deckVizRows). carriesOwnData tested that field with isPlainObject, which explicitly excludes arrays, and layer.geojson is unset for these layers, so neither embedded-data check caught them.

The layer then fell through to the reference walk, which finds no string reference (source.data is skipped by nonEmptyString), and it was reported as no-source or, when sourcePath still held the original CSV name, as local-file. A layer whose data travels entirely inside the project file was told to the author as something the recipient cannot load.

An array data now counts as embedded, alongside an inline FeatureCollection. Only a string data is a URL, and that is a reference like any other.

A rejected ranged GET no longer condemns the host

The probe retries with Range: bytes=0-0 when a HEAD comes back 400/403/405/501, so a HEAD-refusing object store is not misread as credential-gated (and so the check never downloads a whole COG). But Range is CORS-safelisted only for a simple byte range, and an older webview may preflight it and get no matching Access-Control-Allow-Headers back, even where the plain GET a renderer issues would succeed. That rejection was being reported as blocked/cors: "a browser cannot fetch this host", about a host that works.

The HEAD that preceded the retry already proved the host answers and lets this origin read the response, so a rejection on the retry is about the ranged request rather than the host. The probe now falls back to the HEAD's own verdict: a 405 stays reachable, a 403 stays credentialed. Aborts and timeouts are still reported as such.

Testing

Three new cases in tests/share-readiness.test.ts: a row-based deck.gl layer with a sourcePath producing no findings, and the two ranged-GET fallbacks (HEAD 405 → reachable, HEAD 403 → credentialed). Full frontend suite green (5625 passing), build and pre-commit clean.

Summary by CodeRabbit

  • Bug Fixes

    • Inline map data is no longer incorrectly flagged as requiring an external source when preparing projects for sharing.
    • Share readiness checks now preserve successful availability results when follow-up requests fail, while continuing to handle authorization, cancellation, and timeout cases correctly.
  • Tests

    • Added coverage for inline data sources and request fallback behavior.

Two follow-ups to the share-readiness check in #1812, from review comments
that landed after that PR merged.

A non-GeoJSON deck.gl visualization (arc, heatmap, hexagon built from a CSV)
keeps its rows in `source.data` as an array. `isPlainObject` excludes arrays,
so `carriesOwnData` missed those layers, they fell through to the reference
walk, and a layer whose data travels inside the project file was reported as
"no source" or, when `sourcePath` still held the original CSV name, as a
local file. An array `data` now counts as embedded, like an inline
FeatureCollection. Only a string `data` is a URL.

Separately, a rejected ranged GET no longer condemns the host. `Range` is
CORS-safelisted only for a simple byte range, and an older webview may
preflight it and get no matching `Access-Control-Allow-Headers` back. The
HEAD that preceded the retry already proved the host answers and lets this
origin read the response, so a rejection there is about the ranged request
rather than the host: the probe falls back to the HEAD's verdict instead of
reporting "a browser cannot fetch this host" for a host whose plain GET a
renderer would fetch fine.

Refs #1671.
Copilot AI lite review requested due to automatic review settings August 10, 2026 01:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 30f37fab-ee17-4053-8b9c-d9e7c2f5023a

📥 Commits

Reviewing files that changed from the base of the PR and between cfbf25d and 0ee143f.

📒 Files selected for processing (1)
  • tests/share-readiness.test.ts

📝 Walkthrough

Walkthrough

The share-readiness logic excludes inline array data from external-source checks. It also preserves successful HEAD probe results when ranged GET requests fail, while keeping abort and timeout failures unchecked. Tests cover both behaviors.

Changes

Share readiness

Layer / File(s) Summary
Embedded data collection
apps/geolibre-desktop/src/lib/share-readiness.ts, tests/share-readiness.test.ts
source.data arrays now count as embedded data. Tests confirm that these sources produce no share-source references.
Probe fallback handling
apps/geolibre-desktop/src/lib/share-readiness.ts, tests/share-readiness.test.ts
Ranged GET failures now preserve successful HEAD results. Tests cover reachable 405 and credentialed 403 responses.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A rabbit checks the data stream,
Inline rows stay in the dream.
HEAD results remain in view,
When ranged GETs fail to get through.
Abort and timeout stay unchecked—
Share readiness stays correct!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change to prevent false share-readiness findings for embedded deck.gl data.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/share-readiness-embedded-rows

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🔍 Cloudflare PR preview

Item Value
Site https://cd894fe0.geolibre-preview.pages.dev
Demo app https://cd894fe0.geolibre-preview.pages.dev/demo/
Commit 0ee143f

@github-actions

Copy link
Copy Markdown
Contributor

Good, all necessary imports already exist. The implementation and tests are consistent and well-reasoned. I've reviewed both hunks of the diff thoroughly against the surrounding source and did not find bugs — the logic changes match their stated rationale and the new tests correctly exercise the new branches. I won't post inline comments since no issues rose to a level worth flagging.

Code review

Bugs: None found. Both changes were checked against their surrounding code:

  • carriesOwnData's new Array.isArray(data) branch (share-readiness.ts:380-385) — confirmed against createDeckVizStoreLayer/deckVizRows in packages/plugins/src/plugins/deckgl-viz/store-layer.ts that source.data is an array only for deck.gl row-based visualizations, and a survey of other source.data usages in the codebase shows only strings (URLs) or GeoJSON objects elsewhere — no other layer kind stores a meaningful array there, so the new embedded check shouldn't misclassify anything. High confidence.
  • The ranged-GET failure fallback (share-readiness.ts:521-536) — traced outcomeForStatus against every status in RETRY_WITH_RANGED_GET (400/403/405/501) and confirmed the fallback values match the new tests (HEAD 405 → reachable, HEAD 403 → credentialed). Abort/timeout are still passed through distinctly rather than swallowed into the HEAD fallback. High confidence, correct.

Security: None. Credentials are still withheld (credentials: "omit") on both HEAD and GET attempts; no new injection surface.

Performance: None. No new requests are added — the fallback only changes how an existing ranged-GET failure is interpreted.

Quality: Minor, low confidence: the fallback treats any non-abort/non-timeout failure (classifyFetchFailure's "network" and "unknown" kinds) the same way, attributing it to the Range CORS-preflight scenario described in the comment. A genuinely different failure between the HEAD and GET calls (e.g., the host going down in that window) would also be reported using the earlier HEAD verdict. This mirrors the existing outer-catch pattern in the same function, so it's consistent with the codebase's existing tradeoffs rather than a new risk — not blocking.

CLAUDE.md: No violations — no touched files intersect the mirrored-constant or catalog-regeneration rules, and the frontend test suite (per the PR description) was run and passes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/share-readiness.test.ts`:
- Around line 361-364: Update the fallback test fetch mocks and assertions
around the ranged-read cases to record each request method, then assert the
sequence is HEAD followed by GET. For bounded-retry coverage, also assert that
the GET includes the Range header value bytes=0-0, ensuring the tests fail when
the implementation stops after HEAD.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ad9f3661-2339-4c1b-8aab-db9f946cf26d

📥 Commits

Reviewing files that changed from the base of the PR and between 925d5cc and cfbf25d.

📒 Files selected for processing (2)
  • apps/geolibre-desktop/src/lib/share-readiness.ts
  • tests/share-readiness.test.ts

Comment thread tests/share-readiness.test.ts Outdated
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🔍 GitHub Pages PR preview

Item Value
Site https://opengeos.org/pages-preview/GeoLibre/pr-1823/
Demo app https://opengeos.org/pages-preview/GeoLibre/pr-1823/demo/
Commit 0ee143f

Note

GitHub Pages built this preview successfully, but its serving edge returned HTTP 403 when checked. The links may still be propagating.

Both fallback tests rejected every non-HEAD request but never checked that a
GET was attempted, so they would have kept passing if the retry were dropped
entirely: a bare HEAD 405 already reads as reachable and a bare 403 as
credentialed. They now record each attempt through a shared helper and assert
HEAD followed by GET with `Range: bytes=0-0`. Verified by deleting the retry
locally, which takes the suite from 26 passing to 3 failing instead of 1.
@github-actions

Copy link
Copy Markdown
Contributor

I have no substantive findings that warrant an inline comment — the change is correct, minimal, and well-tested. No comments to post.

Code review

Bugs: None found. The carriesOwnData fix correctly scopes the new Array.isArray(data) check — confirmed by tracing that source.data is only ever set to an array by createDeckVizStoreLayer (row data for non-GeoJSON deck.gl visualizations), so no other layer type's array-typed field could be misclassified as embedded data. High confidence.

Bugs: The ranged-GET fallback correctly maps only to the HEAD statuses that can trigger the retry (400/403/405/501 via RETRY_WITH_RANGED_GET), and outcomeForStatus handles each sensibly (403 → credentialed, others → reachable), matching the PR's stated rationale. High confidence, no issue.

Security: None found. Fetch calls still use credentials: "omit" and existing failure classification (abort/timeout/network) is preserved before falling back to the HEAD verdict. High confidence.

Performance: None found. No new requests are introduced; the fallback only changes how an already-issued ranged GET's rejection is interpreted.

Quality: Very minor, unrelated to correctness — the pre-existing comment at share-readiness.ts:344-345 ("data is either a URL or an inline FeatureCollection") is now slightly incomplete since source.data can also be an inline array for deck.gl row layers. It doesn't affect behavior (the array is still correctly excluded by the nonEmptyString check on that line), so not worth a blocking comment. Low confidence this is worth fixing at all.

CLAUDE.md: No violations — the change doesn't touch any of the mirrored-constant or generated-catalog areas called out in CLAUDE.md, and the new tests follow the existing tests/*.test.ts (node --test) convention.

Both new tests are well-constructed: they assert not just the final status but the actual request sequence (attempts), which correctly guards against a regression where the retry is silently dropped rather than fixed.

@giswqs
giswqs merged commit 829c544 into main Aug 10, 2026
26 checks passed
@giswqs
giswqs deleted the fix/share-readiness-embedded-rows branch August 10, 2026 01:34
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.

2 participants