Skip to content

Add RustGIS: pure-Rust desktop GIS with a ribbon UI - #1

Merged
giswqs merged 13 commits into
mainfrom
feat/initial-app
Oct 10, 2026
Merged

giswqs merged 13 commits into
mainfrom
feat/initial-app

Conversation

@giswqs

@giswqs giswqs commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds RustGIS, an open-source desktop GIS written in pure Rust with a ribbon-based workflow: maps and layers, symbology, labeling, selection, editing, geoprocessing and export. Every action is a command with an id, shared by the ribbon, keyboard shortcuts, command search (Ctrl+K) and the rustgis-cli command line.

RustGIS

Architecture

Layer Crate Job
L0 rustgis-geom coordinates, extents, Web Mercator, geodesic distance/area, scale
L1 rustgis-data features and typed attributes; GeoJSON, CSV, Shapefile; SQL where clauses
L2 rustgis-map, rustgis-analysis layers, symbology, labeling, camera, basemaps; geoprocessing tools
L3 rustgis-render tiny-skia renderer, collision-free labels, PNG export
L4 rustgis-engine session, undo, command registry, ribbon feature catalog, sample project
L6 rustgis-ui-egui ribbon front end (swappable)
apps rustgis, rustgis-cli desktop and command line

cargo xtask layers enforces that nothing below L6 depends on egui/eframe/rfd.

Features

  • Data: GeoJSON, CSV (lon/lat), Shapefile in; GeoJSON/CSV out; .rgisx project files
  • Map: smooth pan/zoom, five basemaps, graticule, bookmarks, previous/next extent, Go To XY, multiple maps
  • Symbology: single symbol, unique values, graduated colours (natural breaks, equal interval, quantile), proportional symbols, eight colour schemes, transparency, scale ranges, definition queries
  • Labeling: per-layer labels with halos and collision-free placement
  • Selection: click/box select, Select By Attributes (live SQL validation), Select By Location, attribute table synced with the map
  • Editing: create points/lines/polygons, delete, edit cells, add/delete/calculate fields, undo/redo
  • Analysis: Buffer, Clip, Erase, Dissolve, Minimum Bounding Geometry, Feature To Point, Simplify, Summarize Within, Calculate Geometry, Summary Statistics, Export Features, with history
  • UI: ribbon with a contextual Feature Layer tab group, Contents/Catalog/Geoprocessing/Symbology/History/Details panes, identify pop-ups, geodesic measure tools, dark mode; ~100 icons drawn in code
  • Sample data: Natural Earth (public domain)

Test plan

  • cargo xtask ci (fmt, clippy -D warnings, 37 tests, layering check)
  • pre-commit run --all-files
  • Hostile-parameter tests run every command and geoprocessing tool with junk input
  • Headless UI smoke test drives every tab, pane and dialog; screenshots via the ui_shot example
  • CLI: geoprocessing chain, project save/open round trip, PNG export
  • Desktop app launched and run locally

Summary by CodeRabbit

  • New Features
    • Added a desktop GIS app and CLI for viewing and managing projects, importing data, styling maps, selecting and editing features, and running geoprocessing tools.
    • Added support for GeoJSON, CSV, and Shapefile data, plus map and data exports.
    • Added sample World Atlas data, map rendering, project saving, and undo/redo.
  • Documentation
    • Added getting-started, installation, user, and CLI guides, along with project and feature-coverage information.
  • Chores
    • Added automated checks and cross-platform build and test workflows.

Layered workspace:
- geom: coordinates, extents, Web Mercator, geodesic measurement
- data: feature model, GeoJSON/CSV/Shapefile I/O, SQL where clauses
- map: layers, symbology, labeling, camera, basemaps
- analysis: geoprocessing tools on `geo` (buffer, clip, erase,
  dissolve, summarize within, statistics, ...)
- render: tiny-skia renderer, label placement, PNG export
- engine: session, undo, command registry, feature catalog, sample
- ui-egui: ribbon with contextual tabs, panes, map view, attribute
  table, dialogs, code-drawn icons, light and dark themes

Apps: `rustgis` (desktop) and `rustgis-cli`; `cargo xtask ci`
runs fmt, clippy, tests and the layering check.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Free
  • Run ID: 1366cbd0-c498-4385-95dc-19d5291208cc

📥 Commits

Reviewing files that changed from the base of the PR and between e541eb9 and ee7a308.


📒 Files selected for processing (1)
  • crates/data/src/io.rs

opengeos is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.

  • Ask an admin to upgrade

Open in CodeRabbit

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Free
  • Run ID: 1a198ee1-98d1-4a66-acfd-692b40c299b4


📥 Commits

Reviewing files that changed from the base of the PR and between f0a0b3f and e541eb9.



⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock


📒 Files selected for processing (36)
  • .github/workflows/ci.yml
  • .github/workflows/docs-preview.yml
  • .github/workflows/docs.yml
  • .gitignore
  • .pre-commit-config.yaml
  • AGENTS.md
  • ATTRIBUTION.md
  • README.md
  • apps/rustgis-cli/src/main.rs
  • apps/rustgis/src/main.rs
  • crates/data/src/io.rs
  • crates/data/src/query.rs
  • crates/engine/src/cmd/edit.rs
  • crates/engine/src/cmd/project.rs
  • crates/engine/src/cmd/share.rs
  • crates/engine/src/lib.rs
  • crates/engine/src/project.rs
  • crates/engine/src/sample.rs
  • crates/engine/src/tests.rs
  • crates/render/build.rs
  • crates/render/src/lib.rs
  • crates/render/src/logo.rs
  • crates/ui-egui/src/backstage.rs
  • crates/ui-egui/src/chrome.rs
  • crates/ui-egui/src/icons.rs
  • crates/ui-egui/src/lib.rs
  • docs/CNAME
  • docs/architecture.md
  • docs/cli.md
  • docs/contributing.md
  • docs/getting-started.md
  • docs/index.md
  • docs/installation.md
  • docs/user-guide.md
  • requirements_docs.txt
  • zensical.toml


Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.




📝 Walkthrough
📝 Walkthrough

Walkthrough

RustGIS is added as a Rust workspace with data, mapping, analysis, rendering, engine, desktop UI, and CLI crates. The change also adds project storage, development checks, CI workflows, and project and user documentation.

Changes

RustGIS application

Layer / File(s) Summary
Geometry and dataset model
crates/geom/*, crates/data/src/{geometry.rs,lib.rs,value.rs}, crates/data/Cargo.toml
Adds coordinate and extent math, serializable geometry and value types, and dataset operations.
Vector file I/O and queries
crates/data/src/{io.rs,query.rs}
Adds GeoJSON, CSV, and Shapefile readers, GeoJSON and CSV writers, and a SQL-like query parser and evaluator.
Map state and symbology
crates/map/*
Adds cameras, maps, layers, hit testing, color ramps, renderers, classification, and labeling settings.
Geoprocessing tools
crates/analysis/*
Adds geometry conversions, a tool API, and tools for overlays, selection, geometry calculations, statistics, and feature export.
Projects, sessions, and commands
crates/engine/src/{project.rs,lib.rs,sample.rs,catalog.rs}, crates/engine/src/cmd/*
Adds project persistence, session command dispatch and history, sample-project setup, a ribbon feature catalog, and commands for project, map, layer, selection, editing, geoprocessing, and export operations.
Map rendering and image output
crates/render/*
Adds CPU map rendering, text and label placement, font discovery, bundled sample data, logo rendering, and PNG output.
Desktop and CLI applications
apps/rustgis/*, apps/rustgis-cli/*
Adds desktop startup and CLI commands for command and tool listing, project information, rendering, and command execution.
Egui application interface
crates/ui-egui/src/*
Adds the application shell, ribbon, panes, dialogs, map interactions, attribute table, themes, icons, and interface controls.
Application validation
crates/engine/src/tests.rs, crates/ui-egui/tests/*, crates/ui-egui/examples/*
Adds engine integration tests, a UI smoke test, and a scripted headless screenshot example.

Workspace, delivery, and documentation

Layer / File(s) Summary
Workspace and quality checks
Cargo.toml, .cargo/config.toml, .pre-commit-config.yaml, clippy.toml, rustfmt.toml, xtask/*, .github/workflows/ci.yml
Configures the workspace, formatting and lint checks, xtask tasks, and multi-platform CI builds and tests.
Project and user documentation
README.md, AGENTS.md, ATTRIBUTION.md, ROADMAP.md, docs/{architecture.md,cli.md,contributing.md,getting-started.md,index.md,installation.md,user-guide.md,parity.md}
Adds project, architecture, contributor, usage, installation, roadmap, parity, and asset-attribution information.
Documentation site and delivery
zensical.toml, requirements_docs.txt, .gitignore, docs/CNAME, .github/workflows/docs*.yml
Configures the documentation site and adds Pages deployment and pull request preview workflows.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EguiUI
  participant EngineSession
  participant GpCommand
  participant AnalysisTools
  EguiUI->>EngineSession: Run the gp.run command
  EngineSession->>GpCommand: Dispatch command with parameters
  GpCommand->>AnalysisTools: Execute tool with datasets and selections
  AnalysisTools->>GpCommand: Return output, messages, or error
  GpCommand->>EngineSession: Apply output and record history
Loading


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit hops through RustGIS maps,
Finds fields and features, paths and gaps.
It paints a shore, then saves the view,
And checks each command before it’s through.
“A tidy workspace!” says the hare,
While carrots wait beside the lair.

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

Comment thread crates/engine/src/cmd/project.rs Resolved
Comment thread crates/data/src/io.rs Resolved
Comment thread crates/data/src/io.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I did a focused review of this very large PR (about 78 files, mostly new code). I read crates/engine/src/lib.rs (Session::run and the undo logic), crates/engine/src/cmd/project.rs and crates/data/src/io.rs. I did not review the UI, render, analysis, symbology or catalog code in depth.

Bugs

  • Save and open mishandle dirty and undo (high). project.new, project.sample, project.open, project.save and project.saveAs are not marked .view(), so they count as mutating commands (cmd/project.rs:16).
    • After a successful save, Session::run sets dirty = true, so the "•" in the title never clears.
    • reset() doesn't clear the undo/redo or extent history. After Open, Ctrl+Z swaps the previous project back in while s.path still points at the newly opened file.
    • Each save also clones the whole project for a useless undo entry.
  • CSV rows are dropped silently (medium). filter_map(|r| r.ok()) discards malformed rows without counting them in ReadReport (io.rs:231). The GeoJSON reader does report skipped features. txt is also accepted by read_path but is missing from READ_EXTENSIONS.

Performance

  • Large GeoJSON files are copied (medium). read_geojson clones the features array and the whole root, which can mean a 1 GiB document duplicated in memory (io.rs:113).
  • Every mutating command clones the full project for its undo snapshot (lib.rs:220). Large datasets will make each command slow and memory-hungry. Consider copy-on-write layers (Arc datasets). Confidence: medium.

Security

  • Nothing significant found in the files I read. File size is capped and coordinates are validated as finite.

Quality

  • s_tool is a poor name for a function that parses the tool parameter (cmd/project.rs:112). Low confidence.

CLAUDE.md

  • CLAUDE.md is added in this PR with the same 44 lines as AGENTS.md. The git status also shows it as deleted in the working tree. Check that this is intentional, for example a symlink, so the two files don't drift apart. Confidence: low.

Runs pre-commit (fmt, clippy, file checks) on Ubuntu, and tests, the
layering check and a release build on Linux, macOS and Windows.
Comment thread crates/data/src/io.rs Resolved
Comment thread crates/data/src/io.rs Resolved
Comment thread CLAUDE.md Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

This PR is very large (about 18k lines). I read the diff metadata and the I/O layer (crates/data/src/io.rs), share.rs and the CI workflow. I also grepped the whole crates/ tree for panicking constructs. I did not review the UI crates, the analysis tools or the symbology code line by line, so this is not a full audit.

Bugs

  • No definite bugs found in the code I read.
  • CSV rows dropped without notice (crates/data/src/io.rs:231): malformed records are discarded with filter_map(|r| r.ok()). They aren't counted in ReadReport, so the user gets no warning. Confidence: medium.
  • Generic x/y columns become WGS84 points (crates/data/src/io.rs:222): x and y are in the lon/lat name lists, so any CSV with those headers gets point geometry assumed to be WGS84. Confidence: low–medium.

Security

  • No injection or secret-handling issues found. File reads are capped at 1 GiB and share.exportMap clamps its size parameters. The renderer also clamps pixel dimensions with MAX_SIDE.
  • The shapefile path has no check_size call, unlike GeoJSON and CSV. The shapefile crate reads it, so the risk looks low. Confidence: low.

Performance

  • Extra copy of the GeoJSON features (crates/data/src/io.rs:113): .cloned() on the features array and root.clone() for a single Feature duplicate the parsed JSON. Near the 1 GiB cap, peak memory could be several times the file size. Taking ownership of root avoids the copy. Confidence: medium.

Quality

  • read_path accepts txt, but READ_EXTENSIONS doesn't list it, so open dialogs won't offer it. Confidence: low.
  • CLAUDE.md and AGENTS.md are both added with 44 lines each and look like duplicates. A symlink or a pointer file would stop them drifting apart. Confidence: low.

CLAUDE.md / AGENTS.md compliance

  • The "never crash" rules hold in what I checked. Every unwrap, expect and panic! under crates/ is inside test code, and the geometry_to_geojson indexing is guarded by len() == 1.
  • The CI workflow runs the layering check and tests on three operating systems. It runs cargo test, cargo xtask layers and a release build, plus pre-commit for lint, rather than cargo xtask ci. That is equivalent in coverage as long as pre-commit runs fmt and clippy with -D warnings.

- project.new/sample/open/save/saveAs are no longer undoable edits:
  saving clears the dirty marker, and new/open/sample clear the
  undo/redo and extent history, so Ctrl+Z can't swap the old project
  back in (regression test added)
- CSV reader counts malformed rows in ReadReport; READ_EXTENSIONS
  lists "txt", which read_path already accepted
- read_geojson borrows features instead of cloning the document
- rename s_tool to parse_tool
- remove CLAUDE.md: Claude Code reads AGENTS.md directly
Comment thread crates/data/src/io.rs Resolved
Comment thread crates/engine/src/cmd/edit.rs Resolved
Comment thread crates/engine/src/cmd/edit.rs Resolved
Comment thread crates/data/src/query.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

This PR is very large (about 18k lines). I read these files in full:

  • crates/data/src/io.rs
  • crates/data/src/query.rs (the lexer and parser, up to the evaluator)
  • crates/engine/src/project.rs
  • crates/engine/src/cmd/edit.rs
  • crates/engine/src/cmd/share.rs
  • crates/engine/src/cmd/project.rs
  • .github/workflows/ci.yml

I also checked the render size clamp. I did not read the UI crates, the analysis tools, the symbology code or the remaining commands, so the review does not cover them.

Bugs

  • Shapefile integer detection is dead code (io.rs:388). Numeric dbf fields are always typed Double, so the FieldType::Integer branch never runs and integer columns load as floats. Confidence: medium.
  • Incomplete geometry validation in edit.addFeature (edit.rs:39). Only polygons are checked. Lines with fewer than 2 points and empty multi-geometries are accepted and may break extent, label or render code. Confidence: medium.
  • Deleting a field may leave stale references (edit.rs:131). The renderer field, label field and definition query may still point at the removed field. Confidence: low-medium.

Security

  • No issues found.
    • Input size: the file readers cap input size (1 GiB for data files, 512 MiB for projects).
    • Query parser: length and nesting are bounded.
    • PNG export: the output side is clamped by MAX_SIDE in render.
    • Project save: it writes through a temp file and renames, so a failed write doesn't corrupt the target.

Performance

  • No issues found. Reading CSV and GeoJSON holds the whole file in memory, which the size caps bound.

Quality

  • Quoted identifiers are not distinguished from keywords (query.rs:91). A field named OR, NOT or null can't be referenced, and "true" is parsed as a literal. Confidence: low.

CLAUDE.md (AGENTS.md)

  • Never crash: in the code I read I saw no unwrap, expect or indexing in non-test code, apart from &mut self.maps[i] in Project::map_mut (project.rs:85), which is guarded just above. get() is used consistently, and Project::normalize repairs invariants after load.
  • CI: the workflow runs cargo test, the layering check and release builds. It does not run cargo xtask ci, but the pre-commit lint job covers fmt and clippy. Confirm that job runs clippy with -D warnings.

- Remove docs/images; the README now loads WebP screenshots from
  https://assets.rustgis.app (opengeos/rustgis-assets)
- Note the assets repo in AGENTS.md; drop the screenshot row from
  ATTRIBUTION.md and the docs/images pre-commit excludes
- Bump actions/checkout to v5 and actions/setup-python to v6
  (Node 20 deprecation)
Comment thread crates/data/src/io.rs Resolved
Comment thread crates/data/src/io.rs Resolved
Comment thread crates/data/src/io.rs Resolved
Comment thread apps/rustgis-cli/src/main.rs Resolved
Comment thread crates/data/src/query.rs Resolved
Comment thread crates/engine/src/project.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

This PR is very large (71 files, about 18k lines). I read crates/data/src/io.rs, crates/data/src/query.rs (first 300 lines), crates/engine/src/project.rs, crates/engine/src/cmd/share.rs and apps/rustgis-cli/src/main.rs in full. I also grepped for unwrap/expect/panic across the repo. I did not review the UI crates, the renderer, the symbology code, the geoprocessing tools beyond the unwrap grep, or the rest of crates/engine in depth. I posted six inline comments.

Bugs

  • CSV BOM not stripped (io.rs:232, medium). A BOM-prefixed header breaks lon/lat detection, so the file silently loads without geometry.
  • CLI render extension check is case-sensitive (main.rs:102, medium-high). load lowercases the extension but render doesn't, so X.RGISX gets zoomFull applied and the saved camera is overridden.
  • --width, --height and --dpi accept NaN or inf (main.rs:99-105, medium). clamp in map_png passes NaN through to the renderer.

Security / hostile input

  • Shapefile has no size check (io.rs:28, medium). GeoJSON and CSV go through check_size, but .shp and .dbf don't. Numeric values are also cast with as i64, which saturates silently.
  • CSV export formula injection (io.rs:309, low-medium). Cells starting with =, +, - or @ are written unescaped.

Performance

  • Deep expression trees (query.rs:152, low). Long AND/OR chains build a left-nested tree, and recursive eval and Drop use stack proportional to its depth. MAX_DEPTH only bounds parentheses and NOT.

Quality

  • Writes aren't fully atomic (project.rs:88, low). The temp file isn't synced before the rename, and a failed rename leaves the .tmp file behind. write_path and export_map write straight to the target.
  • Duplicate longitude/latitude columns (io.rs:309, low). CSV export appends them even when the layer already has fields with those names.

CLAUDE.md / AGENTS.md

  • The no-unwrap rule appears to be respected. The unwrap hits I looked at were in test modules, such as tools.rs lines 680-709 and the io.rs tests.
  • The PR description links docs/images/hero.png, but AGENTS.md says images live in rustgis-assets and docs link to them by URL. That file isn't in the changed-files list, so the description link will be broken. Low confidence, since the README may use a URL instead.

- dbf Numeric columns whose values are all whole numbers are read
  as Integer (the header has no decimal count); non-finite numerics
  are no longer cast to i64
- edit.addFeature rejects every empty or degenerate geometry kind
  (short lines, empty multipoints, empty polygons)
- deleting a field resets a renderer, labels or definition query
  that used it
- query: double-quoted names are never keywords or literals; AND/OR
  chains are capped at 256 terms to bound recursion
- CSV: strip a UTF-8 BOM; NaN/inf no longer make a column Double;
  export guards spreadsheet formula injection and avoids duplicate
  longitude/latitude columns
- .shp and .dbf sizes are checked like other formats
- saves and exports write through a synced temp file and rename,
  removing the temp file on failure
- CLI: case-insensitive .rgisx detection; non-finite --width,
  --height and --dpi are ignored; share.exportMap ignores NaN sizes
- Zensical site (zensical.toml, docs/*.md) for https://rustgis.app,
  published to GitHub Pages from main (docs.yml); docs/CNAME
- PR previews on Cloudflare Pages (docs-preview.yml, project
  rustgis-preview) with a sticky PR comment
- Remove assets/data: render's build.rs downloads the Natural Earth
  sample data from https://assets.rustgis.app/data (or copies it from
  RUSTGIS_DATA_DIR for offline builds)
- pre-commit: limit added files to 1 MB
- CI: actions/checkout v7
Comment thread crates/data/src/io.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

This PR is very large (81 files, about 18.7k added lines). I read the workflow, crates/data/src/io.rs, and the PR metadata in detail. I did not review the egui UI, renderer, analysis or engine code line by line.

Bugs

  • GeoJSON schema inference (crates/data/src/io.rs:157, medium confidence). If a property is null in the first feature, its field starts as Text. widen never moves it back to a numeric type, so a column like [null, 1, 2] ends up as Text. That breaks numeric symbology, statistics and SQL comparisons. Tracking Option<FieldType> per key and defaulting to Text after the loop would fix it, as read_csv already does. I posted this as an inline comment.

Security

  • docs-preview.yml (low confidence, informational). The workflow deploys only for same-repo, non-Dependabot PRs and sets persist-credentials: false. The pull_request trigger with pull-requests: write is therefore acceptable. Note that same-repo branches can run arbitrary build steps with the Cloudflare secrets, so keep branch write access restricted.
  • File readers (low confidence). read_path loads files of up to 1 GiB fully into memory through read_to_string and then serde_json. Peak memory can be several times the file size, which is a possible denial of service with hostile input. Consider a lower cap, or a cap that differs by format.

Performance

  • read_csv copies every row into a Vec<Vec<String>> before inferring column types. That is acceptable for typical data but costly near the size cap.
  • The GeoJSON schema inference does a linear fields.iter_mut().find for each property of each feature. That is O(features × fields²) for wide tables. A HashMap index would help.

Quality

  • The code is generally consistent with the "never crash" rules in AGENTS.md. It uses get() and ?, and I saw no unwrap in the files I read.
  • write_atomic derives the temporary file name from the target, so two concurrent writes to the same path would collide. This is unlikely in practice.

CLAUDE.md / AGENTS.md

  • I found no violations in the files I reviewed. Whether the "never crash" rule holds across the rest of the diff is unverified.

- GeoJSON schema inference keeps a field's type unknown until a
  non-null value is seen, so a column like [null, 1, 2] is numeric;
  all-null columns still become Text (regression test)
- index fields by name with a HashMap while inferring the schema
  instead of a linear scan per property
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I did not review all of this PR. It adds about 18.8k lines across 81 files, and I read only crates/data/src/io.rs in full plus the .github/workflows/docs-preview.yml workflow. The rest of the engine, analysis, render, and UI code, and the SQL parser in query.rs, got no review. I posted no inline comments because nothing I read needed a code change.

Bugs

  • None found in the files I read.
    • The GeoJSON and CSV readers are defensive. They use get() rather than indexing, reject non-finite coordinates, strip a BOM, and count skipped features.
    • The parts[0] and polys[0] indexing in geometry_to_geojson is guarded by len() == 1, so it cannot panic.

Security

  • The docs-preview workflow looks sound (high confidence).
    • It uses pull_request, not pull_request_target, with persist-credentials: false.
    • It skips the Cloudflare deploy for forks and Dependabot.
    • The only PR-controlled values interpolated into the deploy command are the PR number and head SHA, which are not attacker-chosen strings.
  • csv_cell escapes spreadsheet formula prefixes on export (=, +, -, @, tab, CR). This is good practice.

Performance

  • Low confidence, design note: MAX_BYTES allows 1 GiB files.
    • GeoJSON is parsed into a full serde_json::Value, and CSV is materialised as Vec<Vec<String>>. Peak memory can be many times the file size, so a 1 GiB input could exhaust RAM, and an OOM abort is not catchable by the panic guard.
    • Consider a lower cap, or streaming for CSV. The CSV reader makes two passes over rows, which could be one.

Quality

  • Low confidence: write_atomic uses a fixed <name>.tmp path. Two concurrent exports to the same target would clobber each other's temp file. This only matters if exports can run in parallel.
  • Low confidence: read_geojson keeps only the first usable member of a GeometryCollection. It does this silently, with no entry in ReadReport.

CLAUDE.md / AGENTS.md

  • Nothing in the files I read breaks the rules: no unwrap/expect/panic/unsafe, and I saw no hostile-input handling gaps.
  • Not checked: the "no third-party assets" rule and whether each asset has an ATTRIBUTION.md row.
  • The PR description embeds docs/images/hero.png. AGENTS.md says images live in opengeos/rustgis-assets and docs should link to them by URL, so confirm that image is not committed in this PR.
  • I did not run cargo xtask ci or the tests.

Strip whitespace, quotes and a Bearer prefix from CLOUDFLARE_API_TOKEN,
verify it with Cloudflare before deploying, and report a malformed or
rejected token clearly without printing it.
Verify the token against /accounts/<id>/tokens/verify as well as
/user/tokens/verify; account-owned tokens only pass the former.
Comment thread crates/data/src/io.rs Resolved
Comment thread .github/workflows/docs-preview.yml Resolved
Comment thread .github/workflows/docs-preview.yml Resolved
Comment thread crates/data/src/io.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

This PR adds about 18.8k lines. I read the CI and docs workflows and crates/data/src/io.rs closely. I did not review the other crates (engine, map, render, analysis, ui-egui) in depth, so this is not a full review of the PR. I could not run the build or tests.

Bugs

  • None confirmed in the files I read.
  • write_atomic and the GeoJSON schema inference in read_geojson look correct.

Security

  • Low confidence, no vulnerability found: docs-preview.yml is well guarded.
    • Deploy runs only for same-repo, non-Dependabot PRs.
    • The workflow uses the pull_request trigger, not pull_request_target.
    • persist-credentials: false is set.
    • The token is masked.
    • Untrusted PR fields are not interpolated into shell commands.
  • Low confidence: The token-verify curl calls have no timeout. A hung request stalls the job, and the error message then blames the token (inline comment posted).

Performance

  • Medium confidence: read_path allows files up to 1 GiB and parses them fully into serde_json::Value, plus read_to_string. Memory use can be several times the file size. A lower cap or streaming would be safer (inline comment posted).

Quality

  • Low confidence: geometry_to_geojson uses parts[0] and polys[0]. Both are guarded by len() == 1, so they are safe. Slice patterns would be clearer.

CLAUDE.md / AGENTS.md

  • Low confidence: The parts[0] and polys[0] indexing goes against the "get() over indexing" guideline, though it cannot panic as written.
  • I did not audit the rest of the code for unwrap() or expect() in non-test code. The PR relies on cargo xtask ci and hostile_params_never_panic for that.
  • The PR description links docs/images/hero.png, but AGENTS.md says images live in opengeos/rustgis-assets. The changed-file list contains no image, so the link may be broken.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://pr-1.rustgis-preview.pages.dev
This commit https://b7da06ae.rustgis-preview.pages.dev
Commit ee7a308

- write_atomic: unique temp name per write (PID + counter) opened with
  create_new, so concurrent writes never share a temp file and an
  existing file or symlink is never followed; reject paths with no
  file name (regression test)
- docs-preview: strip a "Bearer " prefix before removing whitespace,
  add curl --max-time 20 and report network errors separately, and
  clear the token from the environment after the deploy step
- geometry_to_geojson uses slice patterns instead of indexing
- lower the in-memory read cap for text formats to 256 MiB
A rust-coloured cog framing a globe split into blue, teal, green and
gold segments by white gaps, with a tilted orbit. It is drawn in code
(rustgis_render::logo) for the window icon, header, About dialog and
backstage, and published as SVG/PNG/favicon in rustgis-assets for the
README and the website.
Comment thread crates/data/src/io.rs Resolved
Comment thread crates/data/src/io.rs Resolved
Comment thread .github/workflows/docs-preview.yml Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

This PR is large: 82 files and about 19k added lines. I read the data I/O layer (crates/data/src/io.rs), the SQL-where parser (crates/data/src/query.rs), and the CI and docs-preview workflows closely. I did not review the other crates, including engine, render, ui-egui, analysis and map, so this is not a full review of the PR.

Bugs

  • CSV type inference drops leading zeros (crates/data/src/io.rs:302). Identifier-like columns such as ZIP codes, phone numbers and IDs are read as Integer, so 02134 becomes 2134 on load and on export. Confidence: medium-high.
  • CSV formula guard doesn't round-trip (crates/data/src/io.rs:350). Export prefixes ' to text starting with =, +, - or @, but import never strips it. Repeated export and import keeps adding the prefix. Confidence: medium.
  • Shapefile numeric columns change type (crates/data/src/io.rs:479, integral_numeric_to_integer). A decimal Numeric column whose values all happen to be whole numbers is read as Integer. A later edit or calculation that stores a fractional value would then not match the column's type. Confidence: low-medium.

Security

  • Cloudflare token exposure in the docs-preview workflow (.github/workflows/docs-preview.yml:80). The token goes into $GITHUB_ENV, so every later step sees it until the cleanup step runs, including third-party actions. Scoping it with env: on the deploy step would limit this. Anyone with write access can also edit the workflow on a same-repo branch and read the secret, which is probably acceptable here. Confidence: low-medium.
  • The SQL-where parser bounds length, nesting depth and chain length, and I found no panics or injection in the code I read. The file readers cap size at 256 MiB.

Performance

  • read_csv copies every row into a Vec<Vec<String>> before inferring types, so memory is roughly twice the file size or more. This is fine given the 256 MiB cap, but it could stream. Confidence: low.

Quality

  • The lexer in query.rs treats - as the start of a number, so a hyphenated bare identifier fails with a "bad number" error. Quoted names work around it. Confidence: low.
  • ci.yml has no explicit permissions: block. Setting contents: read would follow least privilege. Confidence: low.

CLAUDE.md / AGENTS.md

  • In the code I read, I found no unwrap(), expect(), panic! or unsafe outside tests, and indexing uses get(), as the guidelines require. I did not check the other crates for this.

- CSV type inference reads values with a leading zero (02134, -007)
  as Text, so ZIP codes and IDs keep their zeros
- read_csv strips the export formula guard ('=x -> =x), so an
  export/import round trip is stable (regression test)
Comment thread crates/data/src/io.rs
match g {
Geometry::Point(p) => json!({"type": "Point", "coordinates": c(p)}),
Geometry::MultiPoint(v) => json!({"type": "MultiPoint", "coordinates": l(v)}),
Geometry::Line(parts) if let [only] = parts.as_slice() => json!({"type": "LineString", "coordinates": l(only)}),

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.

if let guards in match arms (here and on the Polygon arm below) were only stabilized in Rust 1.95, but the workspace declares rust-version = "1.90". Anyone on 1.90–1.94 will hit a compile error instead of the MSRV check you intended. Either bump rust-version or rewrite these arms with a plain match parts.as_slice() (confidence: medium, depends on the toolchain stabilization date).

@github-actions

Copy link
Copy Markdown
Contributor

Code review

This PR is very large (82 files, about 19k lines). I read the PR metadata, the CI and docs-preview workflows, and crates/data/src/io.rs (GeoJSON, CSV and atomic-write code) in detail. I did not review the egui UI, render, engine, analysis, map or the rest of the data crate line by line. The coverage gap is mainly those crates and query.rs, not the PR as a whole.

Bugs

  • MSRV mismatch (medium confidence): crates/data/src/io.rs:131 and the Polygon arm below it use if let guards in match arms. I believe these were only stabilized in Rust 1.95, but Cargo.toml declares rust-version = "1.90". Toolchains 1.90–1.94 would fail to compile. Bump rust-version or rewrite those arms without guards. I left an inline comment on this.

Security

  • No issues found in the workflows.
    • The Cloudflare token is masked.
    • It is only used for same-repo, non-Dependabot PRs.
    • It is cleared from GITHUB_ENV before the third-party github-script step.
    • PR-controlled values in the command: input are limited to the PR number and head SHA, which are not attacker-chosen strings.
  • write_atomic uses create_new with a unique temp name, so it never follows an existing file or symlink at that name.
  • File reads are capped at 256 MiB. GeoJSON and CSV parsing use get() and Option chains rather than indexing.

Performance

  • No issues found in the files I read. The GeoJSON reader borrows features instead of cloning the document.

Quality

  • Reader skip counts (low confidence): read_geojson counts a feature with an unparseable geometry as skipped and drops it. A feature with no geometry is kept. Both are reasonable, but the asymmetry is worth documenting.
  • CSV memory (low confidence): read_csv materializes all rows as Vec<Vec<String>> before type inference. That is fine under the 256 MiB cap but heavy for large files.

CLAUDE.md / AGENTS.md

  • In the files I read, I found no unwrap, expect or panic in non-test code, and no unsafe.
  • The hostile-parameter tests and the layering check are in place, as AGENTS.md requires.

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