Hotfix/20260312#513
Conversation
… null NAAM and assign fallback name 'Naamloos perceel N'
Fix validation for RVO shapefiles with null NAAM attributes
Fix FlatGeobuf deserialization error and add cache-busting
|
👋 Hotfix Branch PR Detected! Before merging this Pull Request into This will:
You can trigger the workflow from the 'Actions' tab, selecting the 'Release' workflow, and choosing this |
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
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-Lengthheader 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
📒 Files selected for processing (12)
.changeset/eleven-phones-type.md.changeset/strong-wolves-bow.md.changeset/tiny-friends-doubt.mdfdm-app/app/components/blocks/atlas/atlas-sources.tsxfdm-app/app/components/blocks/atlas/atlas-url.tsfdm-app/app/components/blocks/mijnpercelen/form-upload.tsxfdm-app/app/entry.client.tsxfdm-app/app/lib/cache.server.tsfdm-app/app/lib/config.server.tsfdm-app/app/routes/farm.create.$b_id_farm.$calendar.upload.tsxfdm-app/app/routes/sentry-tunnel.tsxfdm-app/app/types/config.d.ts
Summary by CodeRabbit
Release Notes
Bug Fixes
Improvements