Repository navigation
heronin: the server hands out cached map tiles - #43
Merged
Merged
Conversation
Signed-off-by: fizzy foxnne-desktop-codex-2 <slot+foxnne-desktop-codex-2@fizzy.invalid>
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.
heronin: the server hands out cached map tiles
Part of fizzyedit/work#1210
In plain words
Heronin can now hand out map tiles from OpenStreetMap and keep a local copy for thirty days. Repeated requests can use that copy without contacting OpenStreetMap again.
What changes
What you will notice
Nothing visible: internal server support that makes cached map tiles available for the later Map tab work.
How we know it works
Four new tests check valid and invalid tile paths, downloading and reusing a cached tile, expiry after thirty days, failures that leave no file, and HTTP responses with the required headers. The existing sign-in test now checks that a tile request without a session is refused. All six required gates pass. A real OpenStreetMap fetch remains UNVERIFIED.
How this serves fizzy
This supports fizzy's platform goal by giving map features a reusable server capability for fetching and caching tiles.
For agents: technical summary
Goal
Serve individual OpenStreetMap tiles through Heronin with a thirty-day disk cache.
What changed and why
Added strict tile-path parsing, a recording-fetch seam, bounded upstream reads with redirects refused and an identifying User-Agent, atomic cache writes, and the authenticated GET route. Main stores tiles under HERONIN_DATA/tiles or ./tiles.
Budget: ADDED non-test lines = 70 (19 in the tracked diff plus 51 lines in the new non-test file), cap 110. Added+deleted code lines across all four allowed files, including tests = 168 (22+7 tracked plus 51+88 new), cap 260. Counts use git diff --numstat HEAD plus line counts of untracked source files; requested PR/report artifacts are separate.
How it was verified
New tests in server/tiles_tests.zig:
tile parse exact decimal paths and boundstile cache miss hit and thirty day expirytile missing and failed fetch are never storedtile route PNG headers invalid method and unconfigured cacheUpdated test in server/server_tests.zig:
agent routes: both, 409 without yours, saved key kept and never sent, sign-in neededchecks the tile 401 response.Gates:
zig fmt --check build.zig tools tests/check_public model app server: pass.zig build: 55/55 steps succeeded.zig build server: 3/3 steps succeeded.zig build test: 54/54 steps succeeded; rerun executed 29/29 tests successfully, including all 26 server tests; other suites cached.zig build web: 55/55 steps succeeded.zig build check-public: 3/3 steps succeeded.git diff --checkalso passes. Tests use in-process fetch fakes and HTTP readers/writers.Not done / follow-ups
UNVERIFIED: a real fetch from tile.openstreetmap.org. After merge, Ops checks one tile on pop-os using curl against the local server with a session. App and Map tab work remains separate.
Part of fizzyedit/work#1210