Skip to content

Fix FlatGeobuf deserialization error and add cache-busting#512

Merged
SvenVw merged 4 commits into
hotfix/20260312from
FDM509
Mar 13, 2026
Merged

Fix FlatGeobuf deserialization error and add cache-busting#512
SvenVw merged 4 commits into
hotfix/20260312from
FDM509

Conversation

@SvenVw
Copy link
Copy Markdown
Collaborator

@SvenVw SvenVw commented Mar 13, 2026

Summary by CodeRabbit

Bug Fixes

  • Fixed data loading reliability during map interactions
  • Resolved stale data appearing after map navigation
  • Implemented automatic cache refresh on app deployments to prevent display issues from corrupted caches

Closes #509

@SvenVw SvenVw self-assigned this Mar 13, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • main
  • development

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d52209a3-720f-4c4c-93da-8c13d69d5254

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR patches @nmi-agro/fdm-app to fix a production FlatGeobuf deserialization error affecting 2025/2026 atlas pages. Changes remove per-iteration abort checks to allow HTTP Range requests to complete uninterrupted and add a cache-busting query parameter to prevent stale cache corruption on deployment.

Changes

Cohort / File(s) Summary
Release metadata
.changeset/tiny-friends-doubt.md
Documents patch release with summary of abort check removal and cache-busting changes.
Abort handling & FlatGeobuf streaming
fdm-app/app/components/blocks/atlas/atlas-sources.tsx
Removes per-iteration signal.aborted check inside the for-await loop since FlatGeobuf HTTP Range requests are not interruptible; abort guard is retained after the loop before setData() to prevent stale data rendering.
Cache-busting URL construction
fdm-app/app/components/blocks/atlas/atlas-url.ts
Appends cache-busting query parameter ?v={APP_VERSION} to FlatGeobuf file URL using import.meta.env.PUBLIC_APP_VERSION to force fresh cache key on deployment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

fdm-app, bug

Suggested reviewers

  • BoraIneviNMI
  • gerardhros

Poem

🐰 A cache that's stale and requests that abort,
Made FlatGeobuf fail in every port,
But we've removed the checks that choke the flow,
Added versions to bust—now the data will go! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements fixes for the FlatGeobuf deserialization failure: removes per-iteration abort checks to prevent stream corruption and adds cache-busting to avoid stale cached files.
Out of Scope Changes check ✅ Passed All changes directly address issue #509: abort-handling fix, cache-busting query parameter, and changeset metadata are all in scope.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: fixing a FlatGeobuf deserialization error (by removing abort check during streaming) and adding cache-busting (via query parameter). Both are primary objectives addressed by the commit messages and changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch FDM509
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@SvenVw
Copy link
Copy Markdown
Collaborator Author

SvenVw commented Mar 13, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sentry
Copy link
Copy Markdown

sentry Bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot changed the title @coderabbitai Fix FlatGeobuf deserialization error and add cache-busting Mar 13, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
fdm-app/app/components/blocks/atlas/atlas-url.ts (1)

23-24: Consider handling undefined PUBLIC_APP_VERSION.

PUBLIC_APP_VERSION is typed as optional (string | undefined). If the Vite define injection fails or the build runs outside npm, the URL would contain ?v=undefined, which still works but defeats the cache-busting purpose since it won't change across deploys.

🛡️ Optional defensive fallback
     const appVersion = import.meta.env.PUBLIC_APP_VERSION
-    const availableFieldsUrl = `${datasetsUrl}/fields/nl/${year}/${version}.fgb?v=${appVersion}`
+    const availableFieldsUrl = `${datasetsUrl}/fields/nl/${year}/${version}.fgb?v=${appVersion ?? Date.now()}`

Alternatively, you could throw an error at build time if the version is missing, or use a fallback like a build timestamp.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@fdm-app/app/components/blocks/atlas/atlas-url.ts` around lines 23 - 24, The
code uses import.meta.env.PUBLIC_APP_VERSION directly (assigned to appVersion
and interpolated into availableFieldsUrl) without handling the optional
undefined case; update the appVersion assignment to check
import.meta.env.PUBLIC_APP_VERSION and if undefined either (a) substitute a
deterministic fallback (e.g., a build timestamp or process.env commit hash) or
(b) fail early at build time, and then use that safe value when creating
availableFieldsUrl; ensure the change touches the appVersion binding and the
availableFieldsUrl template so the query param never becomes "?v=undefined".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@fdm-app/app/components/blocks/atlas/atlas-url.ts`:
- Around line 23-24: The code uses import.meta.env.PUBLIC_APP_VERSION directly
(assigned to appVersion and interpolated into availableFieldsUrl) without
handling the optional undefined case; update the appVersion assignment to check
import.meta.env.PUBLIC_APP_VERSION and if undefined either (a) substitute a
deterministic fallback (e.g., a build timestamp or process.env commit hash) or
(b) fail early at build time, and then use that safe value when creating
availableFieldsUrl; ensure the change touches the appVersion binding and the
availableFieldsUrl template so the query param never becomes "?v=undefined".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2e578470-631a-4d79-b094-bef9dc452b3c

📥 Commits

Reviewing files that changed from the base of the PR and between 08719fb and 38ddf3a.

📒 Files selected for processing (3)
  • .changeset/tiny-friends-doubt.md
  • fdm-app/app/components/blocks/atlas/atlas-sources.tsx
  • fdm-app/app/components/blocks/atlas/atlas-url.ts

@SvenVw SvenVw requested a review from BoraIneviNMI March 13, 2026 09:19
@SvenVw SvenVw merged commit 8029b1b into hotfix/20260312 Mar 13, 2026
5 of 6 checks passed
Copy link
Copy Markdown
Collaborator

@gerardhros gerardhros left a comment

Choose a reason for hiding this comment

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

hope this helps

// browser cache key on each app deploy, clearing any corrupted HTTP Range
// response entries that may have accumulated in the browser cache.
const appVersion = import.meta.env.PUBLIC_APP_VERSION
const availableFieldsUrl = `${datasetsUrl}/fields/nl/${year}/${version}.fgb?v=${appVersion}`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would namespace this search param like, for example, ?fdm-app-v=PUBLIC_APP_VERSION. This minimizes the chances of collision with valid Google Cloud search parameters.

You might not want to make it obvious that this is fdm-app making the request, but I don't know why this might be a concern.

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