Skip to content

fix(engine): Reload and Repair compare the field each name reads, not every field of that name ignoring case (#3560) - #3595

Merged
Mavrick-F merged 1 commit into
opengeos:mainfrom
Beehtrix:fix/repair-case-folded-fields-3560
Dec 2, 2026
Merged

Mavrick-F merged 1 commit into
opengeos:mainfrom
Beehtrix:fix/repair-case-folded-fields-3560

Conversation

@Beehtrix

@Beehtrix Beehtrix commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reload Data and Repair Data Source judged a replacement by field name ignoring case, which goes wrong when two fields differ only by case. compatible now compares the field each name reads before and after, using the engine's own resolution (Dataset::field_index, the first field so named).

  • A layer setting or expression whose name would read a different field after the replacement is refused, and the message names the move (KEEP becomes keep). Before, a filter keep = 1 that read KEEP silently read keep once KEEP was removed.
  • The numeric check looks only at the field the name resolves to. Before, an unchanged file with KEEP (number) and keep (text) was refused with "field KEEP must remain numeric".
  • A file with no case collision, such as KEEP renamed to keep, is accepted as before.

Testing

  • New tests repair_source_refuses_a_filter_that_would_read_the_other_case_folded_field and repair_source_checks_only_the_case_folded_field_a_name_reads. Both fail without the change and pass with it.
  • cargo test -p rustgis-engine repair, cargo fmt --check, cargo clippy -p rustgis-engine -- -D warnings pass.
  • I didn't run cargo xtask ci, since it builds the whole workspace; CI covers the rest.

UI evidence

No visible UI change.

Related issue

Fixes #3560

Summary by CodeRabbit

  • Bug Fixes
    • Source repair validation now distinguishes fields whose names differ only by capitalization. Replacements are rejected when a configured query would resolve to a different field, or when the field used by a numeric mapping no longer has a compatible type.
    • Field and type checks now reflect which fields the replacement dataset’s lookup rules actually select. Existing expressions that are already invalid against the current dataset remain exempt from replacement validation.

… every field of that name ignoring case (opengeos#3560)

A filter on KEEP could start reading keep once KEEP was gone, and an unchanged
file with KEEP (number) and keep (text) was refused as not numeric.
Copilot AI lite review requested due to automatic review settings December 2, 2026 07:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T07:53:31.603917Z fc5007a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Repair-source validation now detects when a replacement schema changes which field a configured name or expression resolves to. Non-WASM tests cover definition queries and numeric-field validation with case-variant field names.

Changes: Field compatibility during source repair

Layer / File(s) Summary
Field resolution checks and regression coverage
crates/engine/src/cmd/repair.rs, crates/engine/src/tests.rs
Repair validation compares field resolution between the current and candidate datasets for required fields, numeric fields, and expressions. Tests cover definition queries and numeric-field checks with KEEP and keep.

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: deniial00

Merge Risk: Minimal · up to fc500

Repair Data Source now checks that a replacement keeps each configured field name resolving to the same field. This removes the risk of silently reading a different case-variant field and of rejecting unchanged data. No merge-blocking risk is identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix in the engine's Reload and Repair compatibility checks: they now compare the field each name reads instead of every same-named field ignoring case. This matches the raw summary…
Description check Passed The description follows the template's main sections: Summary, Testing, UI evidence, and Related issue. The Summary explains the change and the reason for it. Testing lists the new tests and the comma…
Linked Issues check Passed [#3560] Requirement 1: a filter or layer expression must keep reading the same field after a case-colliding field is removed. The change in crates/engine/src/cmd/repair.rs adds a moved_to helper. It r…
Out of Scope Changes check Passed The described changes touch only crates/engine/src/cmd/repair.rs (compatibility checks, moved_to helper, about +51/-13 lines) and crates/engine/src/tests.rs (two non-WASM repair tests, about +70 lines…
Full details: Title check

Explanation

The title names the fix in the engine's Reload and Repair compatibility checks: they now compare the field each name reads instead of every same-named field ignoring case. This matches the raw summary (the moved_to helper and field_index-based resolution in repair.rs) and the objectives for #3560. The title is long at 116 characters, but it is specific and related to the main change.

Full details: Description check

Explanation

The description follows the template's main sections: Summary, Testing, UI evidence, and Related issue. The Summary explains the change and the reason for it. Testing lists the new tests and the commands run. UI evidence states 'No visible UI change.' as the template requires. Related issue links #3560. The description is complete and specific.

Full details: Linked Issues check

Explanation

[#3560] Requirement 1: a filter or layer expression must keep reading the same field after a case-colliding field is removed. The change in crates/engine/src/cmd/repair.rs adds a moved_to helper. It reports a name move when the matched field's name changes and either dataset has multiple case-insensitive matches. Expression checks now reject expressions that still parse but would read a different field. Test repair_source_refuses_a_filter_that_would_read_the_other_case_folded_field covers this case (tests.rs). Requirement 2: an unchanged file with KEEP (number) and keep (text) must not be refused. Required-field and numeric-type checks now use the field lookup of the candidate dataset, so only the field the name resolves to is checked. Test repair_source_checks_only_the_case_folded_field_a_name_reads covers this case. Non-collision renames such as KEEP to keep stay accepted. Reload Data and Repair Data Source share the compatible path through prepare and install, so both are covered. Evidence limits: the repository diff could not be read (changed blobs missing from checkout). The source-level check relies on the AI-generated change summary, the PR description, and the file head read, which was truncated before the compatible function. The assessment accepts the described behavior, but it is not verified line by line.

Full details: Out of Scope Changes check

Explanation

The described changes touch only crates/engine/src/cmd/repair.rs (compatibility checks, moved_to helper, about +51/-13 lines) and crates/engine/src/tests.rs (two non-WASM repair tests, about +70 lines). Both files directly implement the field-resolution objective of #3560. No unrelated feature, refactor, or UI change is reported. The PR description states no UI change. Verification was limited to the summary and PR description because the diff was unavailable, so this result is based on the reported file scope rather than a full line review.

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 checks each field by name
KEEP and keep are not the same
Queries stay on their proper track
Numeric fields get checked right back
The source is tested, case by case
Then hops away with ears in place

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: 4b85c0a1-c4f8-4655-9d64-017b4a37aede
Commits

Reviewing files that changed from the base of the PR and between b942def and fc5007a.

Files selected for processing: 2

  • crates/engine/src/cmd/repair.rs
  • crates/engine/src/tests.rs

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

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3595/
Web app https://preview.rustgis.app/pr-3595/app/
Commit fc5007a

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).

@Mavrick-F

Copy link
Copy Markdown
Member

Thanks for contributing this @Beehtrix!

@Mavrick-F
Mavrick-F added this pull request to the merge queue Dec 2, 2026
Merged via the queue into opengeos:main with commit 9224549 Dec 2, 2026
28 checks passed
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.

[Bug]: Reload and Repair mishandle fields whose names differ only by letter case

3 participants