Repository navigation
feat: support CircularString in WKT and EWKT decoding - #44
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #44 +/- ##
============================================
+ Coverage 99.14% 99.39% +0.24%
- Complexity 222 234 +12
============================================
Files 27 29 +2
Lines 469 492 +23
============================================
+ Hits 465 489 +24
+ Misses 4 3 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Independent review — CHANGES REQUIREDReviewed revision: BLOCKING — WKT accepts unmarked non-XY CircularString through a preceding siblingAffected path: Independently reproduced with All are accepted as XYZ, XYZM and XYM respectively, despite neither the CircularString nor an ancestor collection declaring a dimension. The dimension originates from a sibling, not an explicitly marked parent. Conversely, an unmarked CircularString as the first member is correctly rejected for three/four ordinates. Acceptance therefore depends on member order. The same path can assign a sibling's dimension to unmarked EMPTY curves. This fails the user's explicit review requirement that WKT must reject implicit dimensions and issue #42's criterion that dimension markers follow the applicable dialect grammar. Root rejection is implemented and tested, but does not establish collection correctness. ISO/IEC CD 13249-3:201x(E), clause 5.1.57 Description 1(aa), 1(ac), distinguishes marked dimensions from the unmarked 2D case; a preceding sibling is not a dimensional declaration on the curve or its ancestors. Explicit ancestor inheritance is an existing project behavior and is distinct from this sibling propagation. The underlying collection implementation predates this PR (both collection parser and coordinate reader are unchanged against parent Expected correction: distinguish explicit/inherited ancestor dimension from the dimension resolved for collection consistency, and prevent the latter from authorizing unmarked non-XY WKT members. Preserve the approved behavior of explicitly marked ancestor collections and EWKT inference. Add regressions for Z/M/ZM siblings, nested collections and EMPTY; retain positive tests for marked-parent inheritance and EWKT inference. If changing pre-existing acceptance beyond the user's requested WKT restriction requires a compatibility decision, record that decision before broadening the correction. Verified behavior and pre-merge Definition of Done
Outcome: CHANGES REQUIRED. |
Developer correction of the blocking review findingAddresses #44 (comment) in commit The collection parser now keeps its explicit/inherited ancestor dimension separate from the effective dimension used to enforce collection consistency. WKT only passes the former to members. EWKT continues to pass the effective dimension, preserving existing inference, measured dimensions and EMPTY propagation. All three reproductions in the review now fail with the decoder InvalidArgumentException in WKT. The fix applies recursively and also prevents the same pre-existing sibling propagation for POINT and EMPTY members, as required by the requested WKT restriction. Explicit Z/M/ZM ancestor inheritance and individually marked siblings remain accepted. No public decoder API, dependency or domain-model change was needed. Added 54 tests covering Z/M/ZM, both member orders, nested collections, non-empty/EMPTY curves and points, positive explicit inheritance/member markers, EWKT propagation, inferred XYZ/XYZM and SRID preservation. Before the fix, this regression suite produced 24 failures; after the fix, the complete suite passes: 422 tests, 2,319 assertions (PHP 8.5.11).
Normative evidence checked locally: ISO/IEC CD 13249-3:201x(E), clause 5.1.57 Description 1(aa), 1(ac). Explicit ancestor inheritance remains the existing project contract. No unresolved Gate identified. Ready for a new independent review of this commit; no self-approval or merge. |
Independent re-review — READY FOR MERGEReviewed revision: The blocking sibling-dimension finding is resolved. Verified against the correction and tests:
Pre-merge Definition of Done: issue #42 acceptance criteria, circular-string semantics and exception handling, dialect separation, dimensional correctness, regression coverage, documentation, required quality checks and CI are satisfied. The README now documents the WKT sibling rejection and retained EWKT behavior. The correction stays inside the explicitly requested WKT restriction; no additional API/architecture/normative decision is required. Prior review of the dependency, API approval, architectural boundaries and local ISO Committee Draft sources remains applicable. No blocking findings or unresolved gates remain. No production/test source was modified during review. No merge or project-status change was performed. READY FOR MERGE is a review outcome, not Done: owner merge decision and post-merge Definition of Done verification remain required. Published as a comment because GitHub does not permit a formal review from the account that authored this PR; this review was conducted by the independent Reviewer agent. |
Pull Request
Closes #42
Summary
Decode WKT and EWKT
CIRCULARSTRINGas dimension-specificCircularStringInterfaceobjects, preserving the ordered control points without approximation. Add a shared parser and factory, reuse dialect-specific coordinate handling, and translate spatial model validation failures into the decoder'sInvalidArgumentExceptionwith the original cause.Require
spatial-types1.0.0-beta, which supplies concrete circular strings. KeepCOMPOUNDCURVEdecoding out of scope and preserve its existingNotYetImplementedExceptiondespite its implementation in the newer model.Acceptance criteria
Validation
Commands run
Composer validation succeeds with the advisory about an exact version constraint, retaining the repository's pinning policy. Quality tools emit dependency deprecations under PHP 8.5 but exit successfully.
Standards
Normative references
ISO/IEC CD 13249-3:201x(E), available Committee Draft dated 2009-01-16: clause 5.1.57, circular-string grammar and Description 1(e); clause 7.3.1, Description rules 4–12. Source inspected locally. Domain invariants remain delegated to spatial-types. WKT collection inheritance now distinguishes explicit ancestor markers from sibling dimensions, following clause 5.1.57 Description 1(aa), 1(ac). EWKT inference and propagation remain unchanged.
Architecture
The shared textual decoder handles syntax and object construction; spatial-types owns geometric invariants.
Compatibility
The requested WKT restriction also corrects the pre-existing sibling propagation path for other geometry types (including POINT and EMPTY members); previously accepted implicit non-XY WKT is now rejected. No valid explicit ancestor inheritance or EWKT inference is removed.
API Gate approved in #42 (comment). The dependency pin moves from 0.0.1-alpha.4 to 1.0.0-beta to obtain CircularString; existing decoder tests pass with that dependency.
Documentation
README documents supported curves, dimensions, errors, source provenance and remaining unsupported types.
Developer handoff
Independent review and the owner's merge decision remain pending. The issue must remain In review until review, CI and merge requirements are satisfied.