Skip to content

feat(analysis): optionally keep zones with no class overlap (#1998) - #2362

Merged
Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:fix/tabulate-intersection-zero-zones
Nov 17, 2026
Merged

Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:fix/tabulate-intersection-zero-zones

Conversation

@Mavrick-F

@Mavrick-F Mavrick-F commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Tabulate Intersection omitted 164 of 3,030 traffic zones in the Twin Cities trial because they overlapped no class polygon. Include Empty Zones (includeEmptyZones: true) keeps one row per unmatched polygon zone, in the usual zone order. The row has blank class fields and zero area, percentage and sums. An empty class layer produces a zero row for every polygon zone. The option defaults to off, preserving the omission notice and the behavior of existing calls and saved models.

The shared tool spec supplies the checkbox and help in the Tools pane and the parameter description for the Assistant and MCP. The same tool runs on desktop, web and touch and via gp.run from the CLI, Python, scripts and models. Ribbon and command search open the same Tools pane. The option uses the existing command and plugin interfaces. The operation creates the usual undoable standalone table. Saved projects, models and web tools require tabulate-intersection-empty-zones when the option is enabled. Older readers refuse files that require this capability.

Testing

  • Tabulate Intersection regressions cover the default, explicit off and on, a zone that only touches a class, and an empty class layer.
  • Engine tests cover saved options and cancellation during the desktop tool's prepare/run/finish flow, including retry and Undo/Redo.
  • Local formatting, Clippy, analysis and engine suites, and the fork's Linux CI.

UI evidence

Before

Tabulate Intersection before

After

Tabulate Intersection with Include Empty Zones unchecked

Related issue

Part of #1998

Summary by CodeRabbit

  • New Features
    • Tabulate Intersection can now include zones with no class overlap. These rows have blank class fields and zero area, percentage, and sum values. The option is off by default; unmatched zones continue to be omitted unless enabled.
  • Compatibility
    • Projects using this option are recognized as requiring a compatible reader. Older readers will refuse to open them rather than silently omit the zero-overlap rows.
  • Documentation
    • Updated the analysis guide with the new option and its behavior.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Tabulate Intersection adds includeEmptyZones, which defaults to false. When enabled, unmatched zones receive output rows with null class fields and zero values. Processing now checks cancellation and reports progress. Project capability detection and saved-project metadata recognize the option.

Changes: Tabulate Intersection

Layer / File(s) Summary
Empty-zone output and processing
crates/analysis/src/tools.rs, crates/analysis/tests/tabulate_intersection.rs, crates/engine/src/tests/cancellation.rs, docs/user-guide/analysis.md
The tool adds includeEmptyZones. When enabled, unmatched zones produce rows with null class fields and zero area, percentage, and sum values. Tests cover enabled, disabled, and empty-class-layer cases. Processing checks cancellation and reports progress.
Saved-project capability support
crates/engine/src/project.rs, crates/engine/src/project_capabilities.rs, schema/project.schema.json, schema/fixtures/*, docs/maintaining.md
Capability detection recognizes the option in executable commands. The project schema and fixture include the new capability, and maintaining guidance describes the compatibility requirement.

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

Change: Feature

Possibly related issues

  • opengeos/RustGIS issue 1998: The PR adds the option to include zones without class overlap, addressing the listed Tabulate Intersection gap.
  • opengeos/RustGIS issue 1405: The PR applies the saved-file compatibility rule to the new capability.
  • opengeos/RustGIS issue 1853: The PR adds the new capability to the project requires mechanism.

Possibly related PRs

  • opengeos/RustGIS#2269: This PR changes the same Tabulate Intersection parameter contract and saved-project capability handling.
  • opengeos/RustGIS#1293: This PR introduces the tool behavior that this change extends with unmatched-zone rows.

Suggested reviewers: giswqs, elpidioassinaturas, flight1973

Merge Risk: Minimal · up to 66567

This adds an opt-in Tabulate Intersection option that keeps zones with no class overlap. Default behavior is unchanged, and saved files that use the option declare the required capability so older readers refuse them rather than silently drop rows. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(analysis): optionally keep zones with no class overlap (#1998)" matches the main change. The raw summary and objectives show Tabulate Intersection gains an opt-in includeEmptyZones par…
Description check Passed The description follows the repository template. It has Summary, Testing, UI evidence, and Related issue sections. The Summary explains the change, the default-off behavior, and the saved-project capa…
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 "feat(analysis): optionally keep zones with no class overlap (#1998)" matches the main change. The raw summary and objectives show Tabulate Intersection gains an opt-in includeEmptyZones parameter that keeps unmatched zones as rows with blank class fields and zero area, percentage, and sum values. The title is concise, specific, and follows conventional commit form. The PR number in the title is a minor point and does not affect the assessment.

Full details: Description check

Explanation

The description follows the repository template. It has Summary, Testing, UI evidence, and Related issue sections. The Summary explains the change, the default-off behavior, and the saved-project capability requirement. Testing lists the regression and engine tests. UI evidence includes before and after images for the new checkbox, which fits the template because the change adds visible UI. The Related issue section says Part of #1998. The template asks for a Closes or Part of reference, and the section meets that. The description is mostly complete. One gap: the description does not give a clear reason for the cross-reference to #1998 versus the PR number #2362 in the objectives, but this is minor.

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 zone in view,
And marks the empty ones there too.
Null class fields, zeros in line,
While progress ticks along just fine.
The saved project keeps the clue,
So older readers know what’s new.

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: 11ebb95c-27d4-4fb7-8975-77e8ac014a69
Commits

Reviewing files that changed from the base of the PR and between efd885f and 66567c4.

Files selected for processing: 9

  • crates/analysis/src/tools.rs
  • crates/analysis/tests/tabulate_intersection.rs
  • crates/engine/src/project.rs
  • crates/engine/src/project_capabilities.rs
  • crates/engine/src/tests/cancellation.rs
  • docs/maintaining.md
  • docs/user-guide/analysis.md
  • schema/fixtures/tabulate_intersection_empty_zones.rgis
  • schema/project.schema.json

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

fn command_uses_tabulate_empty_zones(id: &str, params: &Value) -> bool {
tabulate_uses(id, params, |p| match p.get("includeEmptyZones") {
Some(Value::Bool(on)) => *on,
Some(Value::String(on)) => on.trim().eq_ignore_ascii_case("true"),

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.

Maintainability risk (not a bug today): this re-implements the tool's boolean rule. boolean() in crates/analysis/src/lib.rs (~line 521) is the source of truth for which text means true: it currently accepts trimmed, case-insensitive "true"/"false". If that parser ever accepts more text ("yes", "1"), this check quietly stops requiring tabulate-intersection-empty-zones, and an older reader would then drop the zero rows without refusing the file, which the "Never silent" rule forbids. Suggest exporting one helper from analysis (e.g. analysis::parses_true(&Value) -> Option<bool>) and using it in both places, plus a test that the capability and the tool agree on the same text inputs. Confidence: medium; this is a drift risk, not a current defect.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed it duplicates the rule; it matches boolean() today, so sharing the helper is left for the release quality pass.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs or crash paths in this PR. The change is well tested and follows the repository rules I checked. One maintainability point is posted inline on crates/engine/src/project_capabilities.rs:188.

Bugs: none found.

  • Progress accounting is correct on every continue path in the class loop (lines 6186–6320). The zone-output loop calls reached(zi) before each zone, and the cell-to-zone walk stays in sync with zone_list order.
  • Zones with no overlap are counted only when they have geometry and includeEmptyZones is off. This matches the old zones_hit count, so the notice is unchanged.
  • Empty-zone padding matches the header layout: zone keys, then class keys as nulls, then area, percentage and sum fields as zeros.
  • Removing zones_hit leaves HashSet in use elsewhere, so there is no unused-import error.
  • The Cancelled→String conversion exists, and the ExtentIndex::with_checks call matches its signature.

Security: none found. The change adds no input-handling surface beyond a boolean parameter.

Performance: nothing material. Script capability checks now scan the script text twice for script.run, which is negligible.

Quality (grouped nits, optional for the release quality pass):

  • Coverage gap: the empty-zone tests don't cover zoneFields absent together with includeEmptyZones: true, or an explicit refusal case such as "yes". Confidence: high that the gap exists, low impact.
  • The removed doc sentence "unrelated data containing an areaUnit is not executable" is the rationale for the capability walk, and it is no longer stated. Confidence: medium.
  • includeEmptyZones adds rows but the notice doesn't say how many. Nothing is lost, so AGENTS doesn't require a notice. This is a UX question, not a rule violation. Confidence: medium.

AGENTS.md: the PR follows the rules I checked.

  • Cancellation: tabulateIntersection is in long_commands, progress is counted, and the doc comment says which steps are not checked.
  • Capabilities: the new capability is registered in project.rs and in both project.schema.json enum lists. The fixture is added, and docs/maintaining.md is updated.
  • Never silent: the omitted-zone notice stays when the option is off.
  • Reach every surface: the PR body covers desktop, web, CLI, Python, the Tools pane and the Assistant/MCP.

Already raised earlier: 0. prior-reviews.json has no threads.

Change size

Compared with the base branch: the whole PR against main (merge base c7e0575 to PR head 66567c4).

Measure Value
Files changed 9 (1 added, 8 modified, 0 removed, 0 renamed)
Size before 1.28 MB
Size after 1.28 MB
Total size change +8.0 KB
Path Before After Change
crates/analysis/tests/tabulate_intersection.rs 40.4 KB 42.9 KB +2.5 KB
crates/analysis/src/tools.rs 861.9 KB 864.0 KB +2.0 KB
crates/engine/src/project_capabilities.rs 43.4 KB 44.7 KB +1.4 KB
schema/fixtures/tabulate_intersection_empty_zones.rgis 0 B 1.3 KB +1.3 KB
docs/user-guide/analysis.md 161.7 KB 162.0 KB +347 B
docs/maintaining.md 9.9 KB 10.1 KB +164 B
crates/engine/src/tests/cancellation.rs 30.2 KB 30.3 KB +114 B
schema/project.schema.json 28.9 KB 28.9 KB +88 B
crates/engine/src/project.rs 129.7 KB 129.7 KB +41 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2362/
Web app https://preview.rustgis.app/pr-2362/app/
Commit 66567c4

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
Mavrick-F added this pull request to the merge queue Nov 17, 2026
Merged via the queue into opengeos:main with commit 9f594f4 Nov 17, 2026
24 checks passed
@Mavrick-F
Mavrick-F deleted the fix/tabulate-intersection-zero-zones branch November 17, 2026 23:28
@Mavrick-F Mavrick-F mentioned this pull request Nov 18, 2026
56 of 63 tasks
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