Repository navigation
Fix documentation, test hygiene and CI - #116
Merged
Merged
Conversation
Documentation - README: the package layout now matches the actual files (FeatureQuery, MapnikError, RenderOptions, WorkQueue, MapnikPool were missing). - README: the datasource examples pass epsg:4326 for GeoJSON data instead of epsg:3857, which made unprojExtent wrong. - README: the bulk-rendering examples use `let` for the final class generators, and the tilelist example no longer double-wraps "all". - README: "8/24/32-bit PNG" and "lossless-ish WebP" were inaccurate; both now describe what the API actually produces. - README: the documentation section explains that swift-docc-plugin must be added first, and the tests section lists the DejaVu font and GDAL plugin requirements. - MetatileOptions' DocC example called two APIs that do not exist. - renderMetatile's doc claimed a default bufferSize of 16; the default is nil (stylesheet buffer). - Added the missing doc comments on public symbols in TileSequence, TilelistBuilder, RenderOptions and MapnikDatasource. - Fixed DocC symbol links that did not resolve (inspect, queryBox, queryPoint) and deprecated QueriedFeature, which no API produces. AGENTS.md - Adopted gis-tools' fuller style section: spacing, colon style, ternary formatting, attributes, number literals, code organization, argument wrapping and test naming. - Corrected the file map (FeatureQuery.swift, Extensions) and the @unchecked Sendable list (MetatileGenerator, MapnikDatasource). - Documented the DejaVu/GDAL test requirements and the camelCase test naming convention. Tests - All 121 backticked test names are camelCase identifiers with a /// line, per the updated .swiftformat (--test-case-name-format preserve) and the repo convention. - New TilelistBuilderTests: ranges, gaps, grouping, duplicates, the exact JSON shape, Codable round trip and concurrent adds. TilelistBuilder had no tests at all. - "rendering same map twice is stable" now asserts byte equality instead of equal length, which could not fail. - The label test asserts that pixels were painted instead of accepting an empty tile. - The unknown-datasource test requires an error instead of passing when none is thrown. - The label and raster tests are skipped when the DejaVu face or the GDAL plugin is missing, instead of failing on such a machine. CI - New format job running swiftformat --lint. - New sanitizer job running the suite under --sanitize=thread for the @unchecked Sendable pool/queue/datasource types. - New docs job building DocC with --warnings-as-errors. - Release builds on macOS and Linux. - The build cache is keyed on the installed mapnik version, so a runner image bump no longer reuses objects built against the old library. Fixes #31 Fixes #33 Fixes #34 Fixes #36 Fixes #37 Fixes #53 Fixes #68 Fixes #69 Fixes #70 Fixes #71 Fixes #72 Fixes #75 Fixes #76 Fixes #77 Fixes #81 Fixes #89 Fixes #101 Fixes #106 Fixes #107
Rebased onto main after #111-#115 landed. The conflicts were all in code the earlier PRs already fixed, so main's version was kept and only this PR's own changes were re-applied. Documentation - README: package layout matches the actual files, datasource examples use epsg:4326 for GeoJSON data, the bulk-rendering examples use `let` for the final class generators, and the tilelist example no longer double-wraps "all". - README: "8/24/32-bit PNG" and "lossless-ish WebP" now describe what the API actually produces, the documentation section explains that swift-docc-plugin must be added first, and the tests section lists the DejaVu font and GDAL plugin requirements. - MetatileOptions' DocC example called two APIs that do not exist. - renderMetatile's doc claimed a default bufferSize of 16; the default is nil (stylesheet buffer). - Added the missing doc comments on public symbols and fixed DocC symbol links that did not resolve; QueriedFeature is deprecated. AGENTS.md - Adopted gis-tools' fuller style section and corrected the file map, the @unchecked Sendable list and the test requirements. Tests - All 176 backticked test names are camelCase identifiers with a /// line, per the updated .swiftformat (--test-case-name-format preserve). - New TilelistBuilderTests: ranges, gaps, grouping, duplicates, the exact JSON shape, Codable round trip and concurrent adds. TilelistBuilder had no tests at all. - "rendering same map twice is stable" asserts byte equality instead of equal length, which could not fail. - The label test asserts that pixels were painted instead of accepting an empty tile. - The unknown-datasource test requires an error instead of passing when none is thrown. - The label and raster tests are skipped when the DejaVu face or the GDAL plugin is missing. CI - New format job (swiftformat --lint), sanitizer job (--sanitize=thread), and docs job (DocC --warnings-as-errors); release builds on macOS and Linux. - The build cache is keyed on the installed mapnik version.
Format: SwiftFormat 0.55.5 has no swiftformat_linux.zip asset (and the archive contains a bare executable, not a directory), so the install step failed. Use 0.64.5 and install the extracted binary explicitly; the tree lints clean with it. Sanitizer: TSan needs to disable ASLR, which requires the personality syscall that Docker's default seccomp profile blocks, so the job died with 'encountered an incompatible memory layout'. Run the container with seccomp=unconfined and invoke the tests under setarch -R.
trasch
added a commit
that referenced
this pull request
Nov 2, 2026
Rebased onto main after #111-#116 landed. Conflicts were resolved by keeping main's newer logic and re-applying this PR's hardening on top: - MapnikPool keeps the unlocked-factory acquire from #112. - TileSequence/MetatileSequence keep main's bounds.isGeographic check, now thrown as MapnikError.invalidInput instead of a precondition. Trapping accessors - layerVisible(_:), layerSRS(_:), layerQueryable(_:) and layerVisible(_:atScaleDenominator:) used a plain Int32(index), which traps for indices outside Int32 range. They now return nil as documented. - Metatile.init, TileSequence.init and MetatileSequence.init used precondition for user-facing validation. They now throw MapnikError.invalidInput, so callers that build blocks or sequences from external data get an error instead of a crash. - MetatileOptions.metatileSize/validate no longer trap on a huge width x scale. Silent truncation - srs and layerSRS grow the buffer instead of returning a silently truncated projection string; long PROJ.4 strings exceed 255 characters. Validation - ImageFormat validates its options (png colors 1...256, jpeg/webp quality 0...100), so a bad value surfaces as MapnikError.invalidInput instead of a renderingFailed from deep inside mapnik. - setBufferSize clamps negative values, matching RenderOptions.validate. Errors - MapnikError is Equatable and LocalizedError, and gained a serializationFailed case. - MapnikPoolError.exhausted carries the pool limit and is Equatable. BoundingBox parsing - BoundingBox(parsing:) parses positionally and rejects non-finite values. It previously used compactMap, so "1,2,foo,3,4" was accepted as (1,2,3,4) with the bad field silently dropped. Tests - APIHardeningTests: huge layer indices, long SRS round trip, negative bufferSize, ImageFormat validation, error equality, Metatile/sequence validation instead of trapping, and malformed bounding-box strings.
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.
Summary
Documentation that contradicted the code, tests that could not fail, and CI that could not catch regressions. This PR fixes all three, and adopts the fuller gis-tools style section in
AGENTS.md.Documentation
FeatureQuery,MapnikError,RenderOptions,WorkQueue,MapnikPoolwere missing)epsg:3857for GeoJSONunprojExtentcame out wrongvar generator = TileGenerator(...)final class,letis correct["all": builder.tilelist]Tilelistalready carriesall; this double-wrapped itpng256andpng:c=NexistMetatileOptionsexamplerenderMetatile(x:y:z:options:)andtile(x:y:), neither of which existsbufferSizeof 16"nil(stylesheet buffer)Also: added the missing doc comments, fixed DocC symbol links that did not resolve, and deprecated
QueriedFeature(no API produces it).swift package generate-documentation --warnings-as-errorsnow succeeds; it found the broken links.AGENTS.md
Adopted gis-tools' fuller style section — spacing, colon style, ternary formatting, attributes, number literals, code organization, argument wrapping and test naming — and corrected the file map, the
@unchecked Sendablelist and the test requirements.Tests
///line, per the updated.swiftformat(--test-case-name-format preserve) and the repo convention.TilelistBuilderTests—TilelistBuilderhad zero tests despite being a public type with a documented JSON schema. Now covers ranges, gaps, grouping, duplicates, the exact JSON shape, Codable round trip and concurrent adds.rendering same map twice is stableassertedfirst?.count == second?.count, which is true for any two PNGs of the same tile. It now asserts byte equality.CI
formatswiftformat --lint(the repo did not pass its own config)sanitizerswift test --sanitize=threadfor the@unchecked Sendabletypesdocs--warnings-as-errorsmacos/linux-c releaseThe build cache is now keyed on the installed mapnik version, so a runner image bump no longer reuses objects compiled against the old library.
Testing
89 tests pass across the affected suites; the full run has only the two pre-existing
saveXML(explicitDefaults:)failures, fixed in #111.Closes #31
Closes #33
Closes #34
Closes #36
Closes #53
Closes #68
Closes #69
Closes #70
Closes #71
Closes #72
Closes #75
Closes #76
Closes #77
Closes #81
Closes #89
Closes #100
Closes #101
Closes #102
Closes #106
Closes #107