Skip to content

Hotfix/20260312#513

Merged
SvenVw merged 13 commits into
mainfrom
hotfix/20260312
Mar 13, 2026
Merged

Hotfix/20260312#513
SvenVw merged 13 commits into
mainfrom
hotfix/20260312

Conversation

@SvenVw
Copy link
Copy Markdown
Collaborator

@SvenVw SvenVw commented Mar 13, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed RVO shapefile uploads failing when parcel names are missing; system now assigns default placeholder names instead.
  • Improvements

    • Added cache-busting to map data URLs, ensuring users receive the latest data after app updates without stale cached versions.
    • Enhanced error monitoring infrastructure for better system reliability tracking.

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

👋 Hotfix Branch PR Detected!

Before merging this Pull Request into main, please ensure you have finalized the hotfix by manually running the 'Release' workflow on this hotfix/20260312 branch.

This will:

  1. Bump package versions.
  2. Generate changelogs.
  3. Create Git tags.

You can trigger the workflow from the 'Actions' tab, selecting the 'Release' workflow, and choosing this hotfix/20260312 branch.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 13, 2026

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b957f86d-dc07-461b-8218-bacd97c5b0b4

📥 Commits

Reviewing files that changed from the base of the PR and between 8029b1b and ad689db.

📒 Files selected for processing (5)
  • fdm-app/CHANGELOG.md
  • fdm-app/app/components/blocks/mijnpercelen/form-upload.tsx
  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.upload.tsx
  • fdm-app/app/routes/sentry-tunnel.tsx
  • fdm-app/package.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • fdm-app/app/routes/sentry-tunnel.tsx
  • fdm-app/app/components/blocks/mijnpercelen/form-upload.tsx
  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.upload.tsx

📝 Walkthrough

Walkthrough

This PR addresses three primary concerns: RVO shapefile uploads with missing parcel names now generate placeholder identifiers instead of failing; FlatGeobuf HTTP range requests proceed uninterrupted by removing AbortController checks that the library does not support; browser cache is refreshed via URL versioning on deployment; and a Sentry error-tracking tunnel proxy is added for CSP-compliant event routing.

Changes

Cohort / File(s) Summary
Sentry Integration & Configuration
app/entry.client.tsx, app/lib/cache.server.ts, app/lib/config.server.ts, app/types/config.d.ts, app/routes/sentry-tunnel.tsx
Added Sentry tunnel configuration option and DSN support; implemented new tunnel route handler that proxies Sentry envelope submissions with validation, DSN matching, upstream forwarding, timeout handling, and request header processing; updated CSP to permit Sentry ingest domain and added dsn field to Sentry configuration type.
FlatGeobuf & Atlas Loading
app/components/blocks/atlas/atlas-sources.tsx, app/components/blocks/atlas/atlas-url.ts
Removed signal.aborted check in FlatGeobuf data loading loop since the library does not support AbortController; added cache-busting query parameter with app version to URL to refresh stale browser caches on deployment.
RVO Shapefile Upload & Parcel Naming
app/components/blocks/mijnpercelen/form-upload.tsx, app/routes/farm.create.$b_id_farm.$calendar.upload.tsx
Refactored parcel name handling to preserve all rows; changed validation to allow undefined NAAM values and introduced fallback naming logic that generates placeholder identifiers ("Naamloos perceel N") with incrementing counter for rows with missing or empty NAAM.
Version & Release
CHANGELOG.md, package.json
Bumped version from 0.28.1 to 0.28.2 and documented three patch fixes related to RVO upload, Sentry tunnel, and FlatGeobuf cache-busting.

Sequence Diagram

sequenceDiagram
    actor Client as Browser / Client
    participant Tunnel as Sentry Tunnel Route
    participant Sentry as Upstream Sentry
    
    Client->>Tunnel: POST /sentry-tunnel<br/>(Sentry envelope)
    
    alt DSN Not Configured
        Tunnel-->>Client: 204 No Content
    else Invalid Method
        Tunnel-->>Client: 405 Method Not Allowed
    else Body > 1MB
        Tunnel-->>Client: 413 Payload Too Large
    else Header Parse Failed
        Tunnel-->>Client: 400 Bad Request
    else DSN Mismatch
        Tunnel-->>Client: 403 Forbidden
    else Valid Request
        Note over Tunnel: Extract DSN from envelope<br/>Validate against config<br/>Construct upstream URL
        Tunnel->>Sentry: POST /api/{projectId}/envelope/<br/>Content-Type: application/x-sentry-envelope<br/>X-Sentry-Auth header<br/>X-Forwarded-For (if present)<br/>10s timeout
        
        alt Upstream Timeout
            Sentry--xTunnel: (no response)
            Tunnel-->>Client: 504 Gateway Timeout
        else Upstream Error
            Sentry-->>Tunnel: Error response
            Tunnel-->>Client: 503 Service Unavailable
        else Upstream Success
            Sentry-->>Tunnel: 2xx response
            Tunnel-->>Client: Forward response<br/>(strip content-encoding<br/>& content-length)
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • nmi-agro/fdm#485: Modifies atlas-sources.tsx data-loading logic similarly; the PR removes signal.aborted check while the related PR adds AbortController-based cancellation, making them closely related in FlatGeobuf handling.
  • nmi-agro/fdm#33: Modifies FlatGeobuf-based field loading and atlas URL generation including FieldsSourceAvailable and cache-busting strategies.

Suggested labels

fdm-app, bug, branch:main

Suggested reviewers

  • BoraIneviNMI
  • gerardhros

Poem

🐰 A tunnel for Sentry now guides the way,
Cache-busting versioning saves the day,
Parcels unnamed get fallback names sweet,
FlatGeobuf flows without abort retreat! 🌾✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Hotfix/20260312' is vague and generic, using a branch naming convention rather than describing the actual changes (Sentry integration, FlatGeobuf fixes, RVO upload handling). Replace the title with a clear description of the main changes, such as 'Add Sentry reverse proxy and fix FlatGeobuf HTTP requests' or similar that conveys the primary purpose.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/20260312
📝 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.

@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!

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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
fdm-app/app/routes/sentry-tunnel.tsx (1)

15-26: Consider validating actual body size after reading.

The Content-Length header check can be bypassed if the client omits or spoofs the header. Since you're already reading the full body on line 23, validating the actual size provides stronger protection against oversized payloads.

♻️ Proposed fix to validate actual body size
     let body: string
     try {
         body = await request.text()
     } catch {
         return new Response("Failed to read request body", { status: 400 })
     }
+
+    if (body.length > MAX_BODY_SIZE) {
+        return new Response("Request too large", { status: 413 })
+    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@fdm-app/app/routes/sentry-tunnel.tsx` around lines 15 - 26, After reading the
request body into the variable body (via await request.text()), validate the
actual size against MAX_BODY_SIZE before proceeding: compute the byte length
(e.g., TextEncoder().encode(body).length) rather than relying solely on the
content-length header, and if it exceeds MAX_BODY_SIZE return a 413 Response
("Request too large"); keep the existing header-based check but add this
post-read validation around the body variable to fully prevent oversized
payloads.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@fdm-app/app/components/blocks/mijnpercelen/form-upload.tsx`:
- Around line 141-143: The mapping for names uses row?.NAAM ?? `Naamloos perceel
${++unnamedCount}` which doesn't treat empty or whitespace-only NAAM as missing;
update the dbfData.map callback (the names assignment) to check
row?.NAAM?.trim() (or similar truthy trimmed check) and only use row.NAAM when
it contains non-space characters, otherwise increment unnamedCount and return
the fallback `Naamloos perceel ${++unnamedCount}`; keep the unnamedCount
increment behavior but ensure you call .trim() on NAAM before deciding.

In `@fdm-app/app/routes/farm.create`.$b_id_farm.$calendar.upload.tsx:
- Line 230: The current assignment for b_name uses NAAM?.trim() ?? fallback
which still treats an empty/whitespace string as a valid value; change the logic
to treat a trimmed empty string as missing and use the fallback instead.
Specifically, compute a trimmedName from NAAM (call NAAM?.trim()), then set
b_name to trimmedName if trimmedName is a non-empty string, otherwise set b_name
to the fallback `Naamloos perceel ${++unnamedCount}`; update the code around the
b_name declaration to use this check so whitespace-only names no longer bypass
the fallback.

---

Nitpick comments:
In `@fdm-app/app/routes/sentry-tunnel.tsx`:
- Around line 15-26: After reading the request body into the variable body (via
await request.text()), validate the actual size against MAX_BODY_SIZE before
proceeding: compute the byte length (e.g., TextEncoder().encode(body).length)
rather than relying solely on the content-length header, and if it exceeds
MAX_BODY_SIZE return a 413 Response ("Request too large"); keep the existing
header-based check but add this post-read validation around the body variable to
fully prevent oversized payloads.
🪄 Autofix (Beta)

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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 945f93bb-2a86-477c-b19b-9954173e95bc

📥 Commits

Reviewing files that changed from the base of the PR and between 86338f0 and 8029b1b.

📒 Files selected for processing (12)
  • .changeset/eleven-phones-type.md
  • .changeset/strong-wolves-bow.md
  • .changeset/tiny-friends-doubt.md
  • fdm-app/app/components/blocks/atlas/atlas-sources.tsx
  • fdm-app/app/components/blocks/atlas/atlas-url.ts
  • fdm-app/app/components/blocks/mijnpercelen/form-upload.tsx
  • fdm-app/app/entry.client.tsx
  • fdm-app/app/lib/cache.server.ts
  • fdm-app/app/lib/config.server.ts
  • fdm-app/app/routes/farm.create.$b_id_farm.$calendar.upload.tsx
  • fdm-app/app/routes/sentry-tunnel.tsx
  • fdm-app/app/types/config.d.ts

Comment thread fdm-app/app/components/blocks/mijnpercelen/form-upload.tsx Outdated
Comment thread fdm-app/app/routes/farm.create.$b_id_farm.$calendar.upload.tsx Outdated
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