Skip to content

Fix .cup file parser and update README#116

Open
B-apt wants to merge 3 commits into
XCSoar:masterfrom
B-apt:fix/read-cup-file-for-bounds
Open

Fix .cup file parser and update README#116
B-apt wants to merge 3 commits into
XCSoar:masterfrom
B-apt:fix/read-cup-file-for-bounds

Conversation

@B-apt

@B-apt B-apt commented Jul 13, 2026

Copy link
Copy Markdown

Minimum fixes to be able to generate a new map using mapgen and uploading a .cup file.

#115

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of uploaded waypoint files, including stricter format acceptance, clearer unsupported-format errors, and more reliable processing.
    • Fixed waypoint destination output writing to use consistent binary transfers during job setup.
    • Enhanced SeeYou CSV parsing to support header-driven column layouts; invalid rows are skipped so valid waypoints still import correctly.
  • Documentation
    • Added development/deployment guidance for mounting Docker volumes and source files to enable faster iteration and automatic reload.
  • Chores
    • Updated git ignore rules for local Python/virtual environment artifacts.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d58e034e-e571-49c1-886b-c80defd1d56e

📥 Commits

Reviewing files that changed from the base of the PR and between dce356c and 1432e58.

📒 Files selected for processing (2)
  • .gitignore
  • lib/xcsoar/mapgen/waypoints/seeyou_reader.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • .gitignore
  • lib/xcsoar/mapgen/waypoints/seeyou_reader.py

📝 Walkthrough

Walkthrough

Waypoint uploads now validate supported formats and preserve binary contents. Seeyou waypoint parsing uses CSV headers and resilient coordinate and field extraction. README instructions and ignore patterns were expanded for local container development.

Changes

Waypoint and development updates

Layer / File(s) Summary
Dynamic Seeyou waypoint parsing
lib/xcsoar/mapgen/waypoints/seeyou_reader.py
Seeyou rows now use dynamic headers, decode byte input, filter malformed coordinates and bounds, and populate waypoint fields by name.
Waypoint upload validation and output
lib/xcsoar/mapgen/server/server.py
Uploaded waypoint files accept .dat and .cup, rewind before parsing, preserve unsupported-file errors, and copy to binary output.
Container development setup
.gitignore, README.md
Development documentation adds local Docker volume and source mounts, while Python environment artifacts are ignored.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 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 reflects the main change: fixing the .cup parser and updating the README.
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 unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
lib/xcsoar/mapgen/server/server.py (1)

102-105: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exception is caught but never logged.

except Exception as e: captures the underlying parse error but e is discarded — the user only sees a generic "Unsupported waypoint file" message, and operators have no way to diagnose failures (e.g. the malformed-field crashes noted in seeyou_reader.py). too_many_requests above already logs via traceback.print_exc(); consider doing the same here for consistency and debuggability.

♻️ Suggested logging
             except Exception as e:
+                print(("Error parsing waypoint file: {}".format(e)))
+                traceback.print_exc(file=sys.stdout)
                 return view.render(
                     error="Unsupported waypoint file " + waypoint_file.filename
                 ) | HTMLFormFiller(data=params)
🤖 Prompt for 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.

In `@lib/xcsoar/mapgen/server/server.py` around lines 102 - 105, Update the
exception handler around the waypoint file parsing in the server request flow to
log the caught exception and traceback before returning the existing generic
error response. Use the existing traceback logging approach from the nearby
too_many_requests handler, while preserving the current user-facing message and
HTMLFormFiller behavior.
🤖 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 @.gitignore:
- Line 18: Update the .gitignore entry for /bin/ so it no longer ignores the
repository-root bin directory; narrow the pattern to the intended
virtual-environment path while preserving ignores for environment-generated
files.

In `@lib/xcsoar/mapgen/waypoints/seeyou_reader.py`:
- Around line 82-92: The raw-line decoding in the SeeYou CUP parsing loop must
not silently discard undecodable bytes. Update the bytes branch before the
filtering logic to try UTF-8 decoding, fall back to Windows-1252 on decode
failure, and preserve the resulting text for stripping and marker checks.

---

Nitpick comments:
In `@lib/xcsoar/mapgen/server/server.py`:
- Around line 102-105: Update the exception handler around the waypoint file
parsing in the server request flow to log the caught exception and traceback
before returning the existing generic error response. Use the existing traceback
logging approach from the nearby too_many_requests handler, while preserving the
current user-facing message and HTMLFormFiller behavior.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: a3a92daa-1a6b-4f72-a066-9b4358af04b8

📥 Commits

Reviewing files that changed from the base of the PR and between 67e9f49 and dce356c.

📒 Files selected for processing (4)
  • .gitignore
  • README.md
  • lib/xcsoar/mapgen/server/server.py
  • lib/xcsoar/mapgen/waypoints/seeyou_reader.py

Comment thread .gitignore Outdated
Comment thread lib/xcsoar/mapgen/waypoints/seeyou_reader.py
@B-apt
B-apt force-pushed the fix/read-cup-file-for-bounds branch from dce356c to 44a8f4f Compare July 13, 2026 15:04
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