Skip to content

Field Package lists keep layers in their own coordinate system - #3540

Merged
pick2510 merged 2 commits into
opengeos:mainfrom
pick2510:crs-field-write-v2
Dec 1, 2026
Merged

pick2510 merged 2 commits into
opengeos:mainfrom
pick2510:crs-field-write-v2

Conversation

@pick2510

@pick2510 pick2510 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Refs #2032 (C2f-4b-6)

#2868 taught RustGIS to read version 2 of a Field Package's list of changes, in which each layer's shapes are in its own system. It kept writing version 1, because docs/maintaining.md asks that a new saved version be read a release before anything writes it. v0.9.0 (2026-11-30) reads version 2, so this turns writing it on.

What changes

  • writes_own_systems() is on. A package opened on a phone keeps its copy of a layer held in its own system in that system (layers.v2.json). Send Field Package lists that layer's changes in that system (version 2).
  • A feature that has no place in longitude/latitude, for example far past where its system reaches, now comes back exactly as the phone holds it. Before, Send couldn't list it and the package went back as a whole map. This holds while the computer's layer is held in the same system. Otherwise the list is brought back through longitude/latitude, as Field Package return by a list of changes in each layer's own system (#2032 C2f-4b-5) #2868 already does.
  • A package whose layers are all in longitude/latitude still sends version 1, which every release reads.
  • A computer on a release before v0.9.0 refuses a version-2 list with the existing "made by a newer RustGIS" text. The guide says to update it and bring the package back again.
  • A package opened on a phone with v0.9.0 or older kept its copy in longitude/latitude. Sent by this release, such a feature still sends the whole map, naming it, as before.

Tests

  • Tests now run with the switch on, as a release does. Four tests no longer opt in. test_bases::as_an_older_release() simulates a release up to v0.9.0.
  • a_copy_an_older_release_kept_in_longitude_latitude_still_lists, the former switch-off test: it now checks that the release writes version 2, then that an older release's copy is listed as before.
  • New: a_copy_an_older_release_kept_sends_an_unplaced_feature_as_a_whole_map.
  • Two test descriptions said copies are kept in longitude/latitude; they're corrected.

User guide

  • field-work.md: Send lists a layer held in its own system in that system, so such a feature comes back exactly. Bring Back to a layer now held in another system refuses only for such a feature that the list changes. A new bullet covers version 2 and older releases.
  • data-formats.md: the refusal applies to a list brought back to a layer held in another system.

Surfaces: Send Field Package and Bring Back, from the desktop app, the phone, the CLI, Python and the Assistant (offline.*). All of them go through these functions.

Local CI passes apart from the five tests known to fail on this machine (GDAL and fixture-dependent).

Summary by CodeRabbit

  • Bug Fixes

    • Field-package returns now better handle layers kept in their own coordinate system. If an older release cannot represent a changed feature in longitude/latitude, the return is handled as a whole-map return and identifies the unplaced feature.
    • Compatibility behavior is clarified: newer releases can keep copies in a layer’s coordinate system, while older releases retain longitude/latitude copies.
  • Documentation

    • Updated the field-work and data-format guides with details about coordinate systems, return restrictions, and compatibility across releases.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Field Package copies now use native coordinate systems by default. Tests cover older-release compatibility and unrepresentable features. The user guides describe change-list versions and return behavior across coordinate systems.

Changes: Field Package coordinate-system handling

Layer / File(s) Summary
Native-system copies and older-release compatibility
crates/engine/src/cmd/field_changes.rs
writes_own_systems enables native-system copies by default. Tests use an older-release mode to check longitude/latitude copies.
Coordinate-system return regression tests
crates/engine/src/cmd/field_audit_tests.rs
Test comments describe rows retained in their coordinate system. A regression test checks that an older-release package reports a whole-map return and identifies an unplaced feature.
Field Package behavior documentation
docs/user-guide/field-work.md, docs/user-guide/data-formats.md
The guides describe version 1 and version 2 change lists, return behavior across coordinate systems, and refusal cases for unrepresentable features.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related issues

  • opengeos/RustGIS#2032: This PR writes version-2 change lists and covers per-layer native coordinate systems described in the issue.

Possibly related PRs

Suggested reviewers: mavrick-f, giswqs

Merge Risk: Minimal · up to 73e44

This change makes Field Package copies keep layers in their own coordinate system by default. It writes version 2 change lists only when a layer is in a non-longitude/latitude system, and the older-release path is covered by tests. No concrete merge-blocking defect was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Field Package change lists now keep layers in their own coordinate system. The changeset enables writing version-2 lists, where each layer's shapes stay in its own sys…
Description check Passed The description follows the template. It has a Summary that explains what changes and why, and a Testing section that lists the tests added or changed and the local CI result. The UI evidence section …
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: Field Package change lists now keep layers in their own coordinate system. The changeset enables writing version-2 lists, where each layer's shapes stay in its own system, which matches the title. The title is short and specific, and it does not describe anything absent from the changeset.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains what changes and why, and a Testing section that lists the tests added or changed and the local CI result. The UI evidence section states 'No visible UI change.', which the template allows when there is no visible change. The Related issue section cites 'Refs #2032 (C2f-4b-6)', which satisfies the template's request for an issue reference.

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

A rabbit packs a map to roam,
With native coordinates tucked at home.
Older phones keep longitude and latitude,
While tests check each return’s exactitude.
The rabbit thumps, then hops away!

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: 393d5087-cf31-45e5-a344-bd7fc5a20acf
Commits

Reviewing files that changed from the base of the PR and between 5799813 and 73e440f.

Files selected for processing: 4

  • crates/engine/src/cmd/field_audit_tests.rs
  • crates/engine/src/cmd/field_changes.rs
  • docs/user-guide/data-formats.md
  • docs/user-guide/field-work.md

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

#[cfg(test)]
{
test_bases::OWN_SYSTEMS.with(std::cell::Cell::get)
!test_bases::OLDER_RELEASE.with(std::cell::Cell::get)

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 test switch is thread-local, so it only covers the thread that calls keep_base. keep_ahead (the read-ahead path behind offline.keepRows) can run the copy on a worker thread, where the switch is off and the copy silently comes out in its own system. The new a_copy_an_older_release_kept_sends_an_unplaced_feature_as_a_whole_map test is safe today only because phone() calls keepRows directly on the test thread. A future test that wants an older release's copy through the read-ahead path would pass for the wrong reason. Suggest a comment on as_an_older_release saying that, or having the read-ahead path look at the switch too. Also, once the release after v0.9.0 ships, this seam and the "on from the release after v0.9.0" wording become dead or stale. Remember to remove them then.

Category: quality

Comment on lines +810 to 811
A system that converts a place to beyond ±180.5°
longitude or ±90.5° latitude (Web Mercator a billion metres east is 8983°) doesn't fit either: such

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.

Line 810 ends after a short orphan fragment, so the paragraph wraps awkwardly. Rejoining it keeps the sentence intact.

Suggested change
A system that converts a place to beyond ±180.5°
longitude or ±90.5° latitude (Web Mercator a billion metres east is 8983°) doesn't fit either: such
A system that converts a place to beyond ±180.5° longitude or ±90.5° latitude (Web Mercator a billion metres east is 8983°) doesn't fit either: such

Category: quality

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

I reviewed the four changed files (about 70 changed lines, mostly tests and docs). I found no bugs or security issues. The main logic change is that writes_own_systems() now returns true in release builds, so copies and lists for layers held in their own system are written as version 2. I checked that the list file name (LAYERS_V2 vs LAYERS) and the list version (2 vs 1) both depend on the same crs.is_some() condition, so they cannot disagree. The keep_base path and the layers_file lookup both prefer v2, which is consistent. The version gate matches Cargo.toml (0.9.0) and the release-ordering rule in docs/maintaining.md.

Bugs

  • None found. Confidence that the production path is correct: medium-high. I could not build or run the tests in this environment, so this rests on reading the code.

Security

  • None found.

Performance

  • None found. Copies are now held in their own system, not converted to longitude/latitude, so they do not add a second full copy of a layer.

Quality

  • crates/engine/src/cmd/field_changes.rs:63: the test switch is thread-local, so it does not cover a copy made on a read-ahead worker thread. The new whole-map test is safe only because phone() calls keepRows on the test thread. The "on from the release after v0.9.0" seam will also be dead once that release ships. Confidence: medium.
  • docs/user-guide/data-formats.md:810: an orphan line break in the paragraph. Suggestion posted inline.
  • Reflow nit: field_audit_tests.rs (the a_layer_held_in_its_own_system… doc comment) now ends with a short orphan it. Unedited rows… line. Not posted inline.

AGENTS.md

  • The rule "When a change stores, copies or compares layer data, give in the pull request what it holds as a multiple of the layer" applies. This change alters what a kept copy holds (its own system instead of longitude/latitude). The PR body gives no cargo xtask memory or row-multiple figure. Confidence: medium. Suggest adding that to the description.
  • I checked the schema rule. The change does not alter a project's saved format, so cargo xtask schema should not be needed. The field-package list reader already has fixtures from Field Package return by a list of changes in each layer's own system (#2032 C2f-4b-5) #2868. I did not find a new fixture that this change needs.
  • I checked the "Reach every surface" rule. The PR body names the desktop, phone, CLI, Python and Assistant surfaces, and they all call the same functions.

Twins checked

  • Other readers and writers of layers.json/layers.v2.json: only field_changes.rs and two tests use these names. Both tests (field_audit_tests.rs:1099 and :1741) assert layers.json exists. They now run with the switch on, so they would fail if their layer were held in its own system. The diff does not show that they are, so I did not flag them.
  • No #[cfg(target_arch = "wasm32")] branch changed.

Already raised by earlier reviews: 0. The prior-review file has no threads.

Change size

Compared with main (merge base 809e96f to PR head 73e440f).

Measure Value
Files changed 4 (0 added, 4 modified, 0 removed, 0 renamed)
Size before 344.2 KB
Size after 345.9 KB
Total size change +1.8 KB
Path Before After Change
crates/engine/src/cmd/field_audit_tests.rs 120.5 KB 121.5 KB +1.1 KB
docs/user-guide/field-work.md 22.6 KB 23.2 KB +624 B
crates/engine/src/cmd/field_changes.rs 75.2 KB 75.3 KB +109 B
docs/user-guide/data-formats.md 126.0 KB 126.0 KB +47 B

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3540/
Web app https://preview.rustgis.app/pr-3540/app/
Commit 73e440f

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 Dec 1, 2026
Merged via the queue into opengeos:main with commit e11b061 Dec 1, 2026
28 checks passed
@pick2510
pick2510 deleted the crs-field-write-v2 branch December 1, 2026 16:42
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