Skip to content

Upgrade dependencies and adapt the borders loader to flatgeobuf 4 - #9

Merged
rijnb merged 2 commits into
mainfrom
fix/flatgeobuf-4
Oct 23, 2026
Merged

rijnb merged 2 commits into
mainfrom
fix/flatgeobuf-4

Conversation

@rijnb

@rijnb rijnb commented Oct 23, 2026

Copy link
Copy Markdown
Member

Upgrades the dependencies and fixes the 1 upgrade that broke the service: flatgeobuf 3 → 4.

In flatgeobuf 4, geojson.deserialize() always returns an async generator of features. BoundaryService.load still expected a FeatureCollection, so the service could not load its borders file and failed on startup. In the test suite that took down every API suite, since they all load the fixture in beforeAll.

The loader now iterates the generator with for await. That loop sits inside the existing try, because the reader is lazy and a corrupt file only fails while iterating. The cast moved from the whole return value to the single feature. flatgeobuf types its features against @types/geojson, which we don't install, so some cast stays. But the old as unknown as GeoJsonFeatureCollection is what hid this break from the type checker, and the iteration shape is now typed by the library.

The other upgrades needed no code changes: fastify 5.12, @fastify/compress, flatbush, pg, TypeScript 7, vitest 5 and @types/node 26. I checked that by running the suite with everything upgraded except flatgeobuf: same result as on the old lockfile.

The rollback test in boundary-service.test.ts mocks the deserializer, so its mock now yields features the way v4 does. Version bumped to 2.11.2 in its own commit.

Tests: 756 passed, typecheck and typecheck:test clean. pool.test.ts couldn't run locally because the sandbox blocks binding a port. It fails the same way on the old lockfile.

🤖 Generated with Claude Code

rijnb and others added 2 commits October 23, 2026 18:35
flatgeobuf 4 makes geojson.deserialize an async generator of features,
so BoundaryService.load failed on startup with "features is not
iterable". Iterate it with for await inside the existing parse-error
try. The cast moves to the single feature: its type leans on
@types/geojson, which we do not install.

Also upgrades fastify, @fastify/compress, flatbush, pg, typescript 7,
vitest 5 and @types/node 26; none of those needed code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rijnb
rijnb merged commit d503588 into main Oct 23, 2026
1 check passed
@rijnb
rijnb deleted the fix/flatgeobuf-4 branch October 23, 2026 16:37
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