Repository navigation
Plan: resolve the pre-merge review findings – Phase 3 (GDAL execution lock and algorithm runner state) - #80
Merged
Conversation
- 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
Base automatically changed from
fix/vector-feature-count-wkt-errors
to
development
November 14, 2026 15:17
Co-authored-by: Junie <junie@jetbrains.com>
There was a problem hiding this comment.
🟡 Changes recommended
Cleanup protection begins too late to cover execution and initial diagnostic copying, while the logger-exception test passes on a callback error without exercising the intended cleanup path.
2 open issues
What changed in this PR
Implements Phase 3 of the pre-merge fixes, stacked on Phase 2, to improve GDAL resource release, runner state, and diagnostics in MapWinGIS.Core.
Changes:
- Removes the shared execution lock from dataset release and runner destruction.
- Separates run success from historical diagnostics, adds exceptional-exit cleanup, and improves diagnostic capture.
- Adds regression tests and documents threading limits, partial outputs, and overview behavior.
Builds and tests were not run during this review.
| File | Description |
|---|---|
tests/MapWinGIS.Core.Tests/GdalUtilsTests.cpp |
Checks specific missing-input diagnostics. |
tests/MapWinGIS.Core.Tests/GdalAlgorithmRunnerTests.cpp |
Adds state, cleanup, diagnostic, and release regressions. |
src/MapWinGIS.Core/src/gdal/GdalUtils.cpp |
Enables verbose dataset-open errors. |
src/MapWinGIS.Core/src/gdal/GdalOperationResult.cpp |
Removes execution locking from dataset release. |
src/MapWinGIS.Core/src/gdal/GdalAlgorithmRunner.cpp |
Updates outcome tracking, cleanup, and diagnostic capture. |
src/MapWinGIS.Core/include/mapwingis/gdal/GdalUtils.h |
Documents diagnostics and partial-output behavior. |
src/MapWinGIS.Core/include/mapwingis/gdal/GdalOperationResult.h |
Documents dataset-release synchronization requirements. |
src/MapWinGIS.Core/include/mapwingis/gdal/GdalDiagnostics.h |
Documents worker-thread capture limitations. |
src/MapWinGIS.Core/include/mapwingis/gdal/GdalAlgorithmRunner.h |
Documents destruction and failure contracts. |
docs/gdal-migration.md |
Records intentional overview-sidecar behavior. |
docs/gdal-integration.md |
Clarifies cancellation and worker-thread diagnostics. |
docs/ARCHITECTURE.md |
Updates resource-release threading guidance. |
.github/plans/development-review-fix-plan-20261113.md |
Records Phase 3 results and validation notes. |
.ai/memory/lessons/lessons.md |
Records the release-lock lesson. |
Review effort: Balanced
…al logger failures Co-authored-by: Junie <junie@jetbrains.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Stacked on #75 (Phase 2). Implements Phase 3 of
.github/plans/development-review-fix-plan-20261113.md: fix the GDAL execution lock and the algorithm runner state (#2, #5, #12, #17, #18, #19, #32, #33).What changed
Lock-free release (#2)
GdalDatasetDeleterno longer takes the global GDAL execution lock;GDALReleaseDatasetonly decrements GDAL's atomic reference count.GdalAlgorithmRunnerdestruction only resets its own PImpl (algorithm + dataset references) and documents why it cannot block on the execution lock.GdalAlgorithmRunner.h,GdalOperationResult.h,GdalUtils.h, anddocs/ARCHITECTURE.md.Runner state correctness (#5)
Run()recordsrunStart = errors.size()after adapter/scope setup; all success decisions useHasFailureSince(errors, runStart)so earlier misuse diagnostics no longer corrupt the run.operationSucceededis frozen at the end ofRun();Result().Succeeded()uses the frozen value, while later misuse diagnostics stay visible inErrors().Finalize()beforeRun()records a diagnostic without poisoning the later run.Cleanup on exceptional exit (#18)
releaseFailedOutputlambda; logger/capture exceptions propagate only after the output dataset reference is released and the algorithm's output argument is closed. A failure-path close adds a "GDAL algorithm output could not be closed." diagnostic when close itself fails.Post-run diagnostics (#19)
GdalErrorScopeis tail-appended (via theappendedScopeErrorsindex) so diagnostics raised afteralgorithm->Runreturns — e.g. while describing the output — reachErrors().Verbose open errors (#12)
GdalUtils::OpenDatasetopens withGDAL_OF_VERBOSE_ERROR; the missing-input test now assertsCPLE_OpenFailedand a message naming the path.Documented, not changed: #17, #32, #33
GdalRuntime.h(GdalErrorScope),GdalAlgorithmRunner.h,GdalUtils.h, anddocs/gdal-integration.md.development#32: partial outputs after failure/cancellation are documented in the headers; per the plan's Decision, outputs are kept and documented, not deleted (user had no preference; recommended default applied).GDALBuildOverviewsexactly like v6, so external.ovrproduction matches v5; recorded as intentional indocs/gdal-migration.md(new "Overview building" section).Tests
New regression tests in
GdalAlgorithmRunnerTests.cpp/GdalUtilsTests.cpp:FinalizeBeforeRunDoesNotPreventSuccessfulRun,MisuseDiagnosticsAfterSuccessfulRunDoNotChangeResultLoggerExceptionsPropagateAndReleaseTheOutputFile(output file deletable after the throw)CapturesDiagnosticsRaisedAfterAlgorithmRunReturnsReleasesDatasetWithoutWaitingForActiveOperations,DestroysRunnerWithoutWaitingForActiveOperations,DestroysDatasetInsideProgressCallbackWithoutDeadlock(blocked-operation latch helpers)MapsFailureDiagnosticsToLegacyErrorPropertiesnow assertsCPLE_OpenFailed+ path in the messageAlso:
.ai/memory/lessons/lessons.mdgains the lesson "Dataset and runner release must stay lock-free"; the plan file checks off Phase 3 with results and limitations.Verification limitation
The implementation was authored and statically reviewed on a Linux environment without MSVC/Windows SDK/vcpkg Windows triplets: the CMake/MSBuild builds, both native test executables, and the compile-command parity check could not be run and must be validated by CI or a Windows build before merge.