Skip to content

Plan: resolve the pre-merge review findings – MapWinGIS6 development - #75

Merged
pmeems merged 7 commits into
developmentfrom
fix/vector-feature-count-wkt-errors
Nov 14, 2026
Merged

pmeems merged 7 commits into
developmentfrom
fix/vector-feature-count-wkt-errors

Conversation

@Victor-MW-cl

Copy link
Copy Markdown

Implements Phase 2 against development.

  • Make the Shapefile feature ID index authoritative for exact feature counts, excluding deleted DBF records and keeping indexed access consistent with sequential geometry iteration.
  • Bound invalid-WKT diagnostics to a UTF-8-safe 200-byte excerpt and include the original byte length.
  • Add regression coverage for deleted records, count stability around geometry iteration, and multibyte truncation.

Local builds and tests were intentionally skipped under the agreed GitHub-only workflow. GitHub Actions must validate the changes before the phase can be marked complete. The GitHub file-edit workflow produced several focused commits rather than a single consolidated commit.

- Verify geometry iteration preserves a previously cached feature count
- Exercise UTF-8 truncation exactly across the excerpt boundary
- Use the feature ID index as the Shapefile count authority
- Bound invalid WKT excerpts without splitting UTF-8 sequences
- Define the count in terms of features returned by OGR iteration
- Document deleted Shapefile record handling and index fallback
- Verify deleted Shapefile records are excluded from indexed access
- Check feature counts before and after geometry iteration
- Cover multibyte UTF-8 truncation at the excerpt boundary
- Document Shapefile count and bounded WKT diagnostic behavior
- Record regression coverage and deferred GitHub CI validation

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.

🟡 Changes recommended

The Core test target cannot compile without the OGRLayer definition, and automatic repacking prevents the new regression test from detecting the original overcounting bug.

2 open issues
What changed in this PR

Implements Phase 2 fixes in the Core vector dataset API to make Shapefile feature counts consistent with iteration and bound invalid-WKT diagnostics.

Changes:

  • Uses the Shapefile feature ID index for exact counts, excluding deleted records.
  • Limits WKT excerpts to 200 bytes without splitting UTF-8 sequences and reports the original length for truncated input.
  • Adds regression tests and records implementation notes.

Builds and tests were not run locally; GitHub Actions validation remains pending.

File Description
tests/​MapWinGIS.Core.Tests/​VectorDatasetTests.cpp Adds deleted-record, count-stability, and UTF-8 truncation tests.
src/​MapWinGIS.Core/​src/​vector/​VectorDataset.cpp Updates feature counting and bounds invalid-WKT diagnostics.
src/​MapWinGIS.Core/​include/​mapwingis/​vector/​VectorDataset.h Clarifies the exact feature-count contract.
.github/​plans/​development-review-fix-plan-20261113.md Records Phase 2 implementation and pending CI validation.

Review effort: Balanced

…on test

Include ogrsf_frmts.h for OGRLayer, open the fixture with AUTO_REPACK=NO and assert the raw driver count still includes the deleted record. Record local validation and memory notes.

Co-authored-by: Junie <junie@jetbrains.com>
@pmeems
pmeems added this pull request to stack #82 November 14, 2026 13:58
@pmeems
pmeems requested a balanced review from Copilot November 14, 2026 14:19

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.

🔵 Needs a closer look

The GDAL reopen calls use path.string(), which can misencode non-ASCII temporary-directory paths on Windows and cause test failures; both should use UTF-8 paths.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Use UTF-8 paths when reopening GDAL datasets on Windows

tests/​MapWinGIS.Core.Tests/​VectorDatasetTests.cpp:256

On Windows with a non-UTF-8 system code page, path.string() can pass incorrectly encoded filenames to GDAL, causing this test to fail when the temporary-directory path contains non-ASCII characters. Convert both GDAL reopen paths to UTF-8 with path.u8string(), matching the fixture's UTF-8 creation path in TestData.cpp:458. The same issue occurs in the read-only reopen at line 256; the suggested fix covers both calls.

2 resolved since last review

Review effort: Balanced

GDAL expects UTF-8 filenames on Windows; path.string() uses the ANSI code page and breaks non-ASCII temporary paths.

Co-authored-by: Junie <junie@jetbrains.com>
@pmeems

pmeems commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Fixed in 3ea69d1: both GDAL reopen calls in ExcludesDeletedShapefileRecordsFromFeatureCount now pass a UTF-8 path (path.u8string(), same helper pattern as TestData.cpp), so non-ASCII temporary-directory paths work on non-UTF-8 code pages. MSBuild Debug x64 builds without warnings; Core tests pass locally (314 passed, 1 network test skipped).

@pmeems
pmeems merged commit 6c5871b into development Nov 14, 2026
6 checks passed
@pmeems
pmeems deleted the fix/vector-feature-count-wkt-errors branch November 14, 2026 15:17
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.

3 participants