stylegen: generate html/style.json from a compact html/style.yaml #168
No reviewers
Labels
No labels
blocked
claude-wip
map-report
map:is
map:se
needs-review
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
art/ismap!168
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "style-generator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Make html/style.json a generated artifact (from a compact html/style.yaml)
html/style.jsonbecomes a generated artifact, gitignored and produced bymake build/make style. The source of truth ishtml/style.yaml, in two parts:minzoom/ colours / zoom-keyed width ramps —which
stylegen/expands into the 36 repetitive road line layers. The invariants that used tolive as 36 near-identical hand-maintained JSON blocks (underpass has no casing; within a level
casings → service → fills → unpaved; short id prefixes; unpaved dasharray) are encoded once in
stylegen/roads.go.plain YAML layer entries, spliced around a
roads_marker.Editing a road class is now a few lines in the table, or a
yqone-liner, instead of pagingthrough a 1300-line JSON file.
The generator refuses what it does not understand
Everything the first version silently dropped is now an error, because a silent drop in a style
generator is a map that renders and is wrong:
opacity:→line-opacity: 0, every road at that level invisible*float64)levels: {bridge: …}→ dropped, no layersunknown level "bridge"class_order→ never drawnmissing from class_order (it would never draw)roads:section → nil-pointer panicduplicate layer idThis is what makes
yqsafe onstyle.yaml: aim a write at a path that does not exist and thebuild stops rather than deleting a layer.
The table is now a table
Width ramps are flow maps keyed by zoom —
fill_widths: {12: 0.7, 13: 1.2, …}— instead of fourlines per stop. The roads block goes from 248 lines to 69, one stop is addressable
(
yq -i '.roads.classes.minor.fill_widths."17" = 7.0'), andstyle.yamlis normalised to yq'sown output format so that edit is a two-line diff rather than a reformat of the whole file.
docs/style.mdcarries the idioms.Safety
pre-generator
html/style.json— 90 layers, same order, zero differing layers — re-verifiedafter the rewrite and after the table compaction.
level, no underpass casing, the base layers preserved in order with the roads spliced at the
marker, no layer left transparent, unique ids, the unescaped
</>=operators, and thatunknown keys are rejected. Each was verified to fail on a mutation introducing the fault it
names, and — unlike the golden fixture this replaces — all of them survive a deliberate colour
or width change. A frozen copy of the output could only fail: it failed on every real edit as
loudly as on a regression, named neither the layer nor the remedy, and the only way past it was
to overwrite it, after which it asserted nothing but determinism.
make testworks on a fresh checkout. It validatedhtml/style.jsonwithout depending onanything that generates it, so on a clean clone the file did not exist and
make testfailed.styleis split intostyle-gen(pure Go) andstyle-validate(npm);make testdepends onstyle-gen, which also keeps the unit tests offline.@latestinsidemake buildmeans someoneelse's release can fail a build that changed nothing.
make build,make test,./scripts/style-validate.shall pass, from a clean tree.Also
docs/superpowers/is removed — plan artifacts from a planning tool, not project documentation.What was durable in them is in the docs AGENTS.md actually indexes.
Merges cleanly with #169; the two were built and tested merged together.
e5161fe5ffto011c7b72a8