Skip to content

Formats out follow-ups: streamed CSV system notice, digests and loss counts without converting the layer (#2032 C2f-1) - #2708

Merged
pick2510 merged 1 commit into
opengeos:mainfrom
pick2510:crs-formats-out-followup
Nov 22, 2026
Merged

pick2510 merged 1 commit into
opengeos:mainfrom
pick2510:crs-formats-out-followup

Conversation

@pick2510

@pick2510 pick2510 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups to #2682 (#2032 C2f-1), from the review comments left on it after the merge.

What changes

  • Streamed CSV names its system. share.exportLayer to a CSV in a "crs" other than WGS 84 says which system the coordinates are in. A streamed layer that declares no geometry type takes its first geometry's, so it gets coordinate columns too. The notice now follows what the export wrote (Exported.csv.points) instead of the declared type, so such a layer is no longer silent.
  • Publishing hashes only what the record needs. Before the file is placed, a layer held in its own system is hashed as held, without converting it, and in longitude/latitude too only when its record is of that kind (one an older release saved). A lon/lat layer, or a record without a native digest, is hashed as before. Everything is still hashed before anything is written, so Cancel can't leave a written file without its record.
  • CSV loss counts convert points, not the layer. For a CSV in a geographic system other than the layer's, only the points checked are converted; a projected system's coordinates aren't degrees, so they aren't checked as such. Before, the whole layer was projected once to count and again to write. The lon/lat path is unchanged.
  • The moved-columns notice names what moved them. With fields named x and easting only, the notice names those two, not all four.
  • The guide states the column-name rule per axis: x, then easting, then x_1 and so on; y, then northing, then y_1 and so on.

Reach

Desktop, browser, command line and Python reach share.exportLayer and the publish command as before; nothing new to show in the ribbon, the Assistant or MCP (no parameter changed). Nothing a project saves changes.

Memory

1×: the CSV loss count no longer makes a second, projected copy of the layer, and a natively held layer's publish no longer converts it to longitude/latitude.

Tests

  • data: a_csv_export_takes_x_and_y_in_a_system_asked_for gains the one-axis case (fails without the fix) and the four-name wording; its ETRS89 part fails if the points aren't converted. a_layer_without_a_declared_type_takes_its_first_geometrys checks the export reports point columns.
  • The share.rs line that reads that report has no command-level test: streaming an untyped layer through share.exportLayer needs a streamed source the test fixtures don't give. The digest change only skips work; the existing publish tests (formats_out, the sync tests) cover each record kind.
  • data and engine tests, clippy, fmt, the browser build and cargo xtask rows pass.

Summary by CodeRabbit

  • Bug Fixes

    • CSV exports now report point data correctly, including for streamed layers with undeclared geometry.
    • Export-loss checks now account for coordinate conversion, and collision notices identify only the column names affected.
    • Publishing avoids calculating unnecessary row digests.
  • Documentation

    • Clarified CSV coordinate-column naming when exporting with a specified coordinate system.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change updates CSV loss checks and coordinate-column collision notices, records point geometry in streamed CSV diagnostics, and selects row digests for publish sync records. It also adds CSV export assertions and updates the coordinate-column naming documentation.

Changes: CSV Export

Layer / File(s) Summary
CSV coordinate checks and naming
crates/data/src/io.rs, crates/data/src/source/tests.rs, docs/user-guide/data-formats.md
CSV loss checks use the coordinates written. Collision notices identify only displaced coordinate aliases. The guide documents the first-available coordinate-column names.
Point geometry in CSV exports
crates/data/src/export/tests.rs, crates/engine/src/cmd/share.rs
Streamed export diagnostics combine declared geometry with geometry reported by written chunks. A test checks point metadata for a typeless layer.

Publish Digests

Layer / File(s) Summary
Publish digest selection
crates/engine/src/cmd/publish.rs
Publishing computes both digest kinds when the sync record lacks a native digest or the dataset uses longitude/latitude coordinates. Otherwise, it computes only the native digest and selects the digest based on the record.

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

Change: Refactor

Possibly related issues

  • opengeos/RustGIS#2643: This change updates coordinate-column naming guidance and CSV loss checks, but does not change coordinate-column inference.
  • opengeos/RustGIS#2032: Publish digest selection now includes the native digest in applicable cases, which is part of the tracker’s native-coordinate work.

Possibly related PRs

  • opengeos/RustGIS#2682: This is described as a direct follow-up and changes the same streamed CSV, publish digest, and CSV loss areas.
  • opengeos/RustGIS#2413: Both changes address CSV loss counts, including counts across streamed chunks.
  • opengeos/RustGIS#2507: Both changes use the dataset or source coordinate system in export-related behavior.

Suggested reviewers: mavrick-f, giswqs

Merge Risk: Minimal · up to d68b8

The changes refine CSV export notices, loss counts and publish digest selection. No material merge risk was found. The written CSV coordinates are unchanged, and the only known discrepancy is a rare diagnostic-count difference.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: streamed CSV system notice, digests, and loss counts changed to avoid converting the whole layer. It is long and uses internal references, but it describes real change…
Description check Passed The description follows the template sections: Summary (What changes, Reach, Memory), Testing (Tests section with commands run), and Related issue (refers to #2682 and #2032 C2f-1). The UI evidence se…
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.
Full details: Title check

Explanation

The title names the main change: streamed CSV system notice, digests, and loss counts changed to avoid converting the whole layer. It is long and uses internal references, but it describes real changes in the diff, so it passes.

Full details: Description check

Explanation

The description follows the template sections: Summary (What changes, Reach, Memory), Testing (Tests section with commands run), and Related issue (refers to #2682 and #2032 C2f-1). The UI evidence section is handled by stating no visible UI change, which matches the template's instruction. The related issue is given as a follow-up reference, so the section is filled in. The Related issue section uses a 'Follow-ups to #2682' reference rather than the template's Closes/Part of wording, which is a minor gap.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

I’m a rabbit with a data trail,
I nibble columns, neat and pale.
Point-shaped rows now show their type,
And digests follow the record’s stripe.
I thump my paws: the checks are done,
Then hop away beneath the sun.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ff9c4026-37d8-4192-a59c-27d1a403cea0
Commits

Reviewing files that changed from the base of the PR and between 5955e44 and d68b8a0.

Files selected for processing: 6

  • crates/data/src/export/tests.rs
  • crates/data/src/io.rs
  • crates/data/src/source/tests.rs
  • crates/engine/src/cmd/publish.rs
  • crates/engine/src/cmd/share.rs
  • docs/user-guide/data-formats.md

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

Comment thread crates/data/src/io.rs
} else if crs == ds.coord_crs() {
std::borrow::Cow::Borrowed(ds)
// Of the coordinates the file is written in: longitude/latitude, or another
// geographic system's, whose points alone are converted to be checked (no copy of the

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.

The comment says a projected system's coordinates "aren't checked as such", but the projected branch (else at line 5007) still calls CsvLosses::of on the native coordinates, so they are checked as degrees. The result is never read for a projected target: coordinates_note_in returns before using unusable_points when !crs.is_geographic(), and notes() doesn't read it either. So the pass is wasted work and the comment misstates what happens. Suggest rewording the comment to say the count is not used for projected targets, or skipping the degree check on that path.

Category: quality

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Left for the release quality pass.

// (no conversion), and in longitude/latitude too only when its record is of that kind
// (an older release's kept no native one), in the same pass. A record of a kind not
// hashed here (a held layer read back in longitude/latitude) differs, so the layer
// takes what was read back: refreshed, never out of step.

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.

The later comment (lines 128-129, which is outside this diff hunk) says the new record's digest is "hashed above", but in this else branch (a layer held in its own system, with a native record) only the native digest is computed. If published.native is None (the file reads back in longitude/latitude), of_kind(false) is None, so held is always Some and the layer is refreshed to the read-back, changing its held_in, where before the digests could match and it kept its system. I think this is unreachable in practice (GeoJSON sources aren't projected at read, and shapefile publishes read back in the file's system), so this is mainly a comment fix. Suggest saying that the comparison is skipped in this branch and why the refresh is safe.

Category: quality

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Left for the release quality pass.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

No bugs, security issues, or AGENTS.md breaks found. The new CSV loss counting, the untyped-layer notice, the per-axis column-name notice, and the publish digest selection all check out against the surrounding code. Two comment-accuracy issues are posted inline. Nothing here is a bug the author must fix before merge.

I checked: CsvLosses::of_placed against coordinates_note_in and notes(); csv_projected_names against the updated guide wording (x, easting, x_1, x_2…); the publish digest branches against sync::native_digest, confirming it matches digests().1 for non-lon/lat layers; the CSV writer's coordinate-column rule; rustfmt max_width = 140 against the longest new lines; and the no-unwrap/expect rule in the new non-test code. No prior review threads existed, so nothing was deduplicated.

Quality

  • crates/data/src/io.rs:4999 (confidence high): the comment says projected-system points "aren't checked as such", but the projected branch still runs the degree check on native coordinates. The count is never read for projected targets, so the pass is wasted work and the comment is misleading. Category: quality.
  • crates/engine/src/cmd/publish.rs:70 (confidence medium-low): the later comment at lines 128–129 says the new record is "hashed above". In the native-only branch, of_kind(false) is None when the published file reads back in lon/lat, so held is always refreshed and held_in changes. I believe this is unreachable in practice, so this is mainly a comment fix. Category: quality.
  • crates/data/src/io.rs:4668 (nit): the names.join(" and ").replacen(...) construction is hard to follow. Building the two-or-four-name list with explicit separators would read more clearly. Left for the release quality pass.
  • Test gap (acknowledged in the PR body): the command-level csv_points line in crates/engine/src/cmd/share.rs (around lines 718 and 781) has no test for an untyped streamed layer. The PR says a streamed fixture is needed for this, so I'm not requesting it here.

Performance

  • None. The new CSV path converts only points, and the publish path skips the lon/lat conversion for native-held layers, which is a real improvement.

Security

  • None found.

Bugs

  • None found. I considered label_point being taken on native geometry and then converted, while the writer converts first and then takes label_point. This can only differ for non-point geometry in a point layer, and only near the degree-range bounds, so the notice count is effectively unaffected. Confidence low, not posted.

AGENTS.md

  • None found. The PR body states reach and tests, and it gives the memory multiple (1×). Docs and the code agree on the column-name rule.

Change size

Compared with the base branch (merge base 5955e44 to PR head d68b8a0). Files only, not line counts.

Measure Value
Files changed 6 (0 added, 6 modified, 0 removed, 0 renamed)
Size before 955.6 KB
Size after 958.7 KB
Total size change +3.2 KB
Path Before After Change
crates/data/src/io.rs 483.1 KB 484.3 KB +1.2 KB
crates/data/src/source/tests.rs 264.2 KB 265.0 KB +846 B
crates/engine/src/cmd/publish.rs 15.7 KB 16.3 KB +633 B
crates/engine/src/cmd/share.rs 46.0 KB 46.4 KB +359 B
crates/data/src/export/tests.rs 34.4 KB 34.5 KB +133 B
docs/user-guide/data-formats.md 112.1 KB 112.1 KB +33 B

@pick2510
pick2510 enabled auto-merge November 22, 2026 17:06
@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2708/
Web app https://preview.rustgis.app/pr-2708/app/
Commit d68b8a0

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@pick2510
pick2510 added this pull request to the merge queue Nov 22, 2026
Merged via the queue into opengeos:main with commit 17773dd Nov 22, 2026
26 checks passed
@pick2510
pick2510 deleted the crs-formats-out-followup branch November 22, 2026 17:35
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