From eef1f75830f2bea21be5dc2a9e9fcb3a5270c4f0 Mon Sep 17 00:00:00 2001 From: timohueser Date: Sun, 15 Nov 2026 13:23:29 +0100 Subject: [PATCH 1/2] trailview: a building passage is never a tunnel, also on older tiles Tiles of an older bake hold a way through a building (`tunnel=building_passage`) as the kind `tunnel` with its tag. The viewer's `lineType` and the plan's `classify` now take such a way as a way of its class on the ground, as develop's viewer does, so no hill, portal or lifted house shows at a gateway. Co-Authored-By: Claude Opus 5.5 --- builder/web/src/lib/trailview/terrain/bins.test.ts | 8 ++++++++ builder/web/src/lib/trailview/terrain/bins.ts | 6 ++++-- host/obc-ground-plan/src/graph/parts.rs | 3 ++- host/obc-ground-plan/src/graph/tests.rs | 10 ++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/builder/web/src/lib/trailview/terrain/bins.test.ts b/builder/web/src/lib/trailview/terrain/bins.test.ts index 59f22e007a..37f898fe03 100644 --- a/builder/web/src/lib/trailview/terrain/bins.test.ts +++ b/builder/web/src/lib/trailview/terrain/bins.test.ts @@ -559,6 +559,14 @@ describe('the ends of bridges and tunnels', () => { ], { level: 14, x: 8574, y: 5778 }); expect(lines.filter(line => line.kind === BRIDGE || line.kind === TUNNEL).map(line => line.abut)).toEqual([[true, true], [true, false], [false, false]]); }); + + it('take a passage through a building of kind `tunnel` as a way of its class, and a tunnel as a bore', () => { + const way = (tunnel: string) => + ({ kind: 'tunnel', tags: { highway: 'residential', tunnel }, geometry: 'line' as const, parts: [{ outer: false, xy: Int32Array.from([1000, 4000, 2000, 4000]), z: Float32Array.from([500, 500]) }] }); + const kinds = (tunnel: string) => features([way(tunnel)], { level: 14, x: 8574, y: 5778 }).lines.map(line => line.kind); + expect(kinds('building_passage')).toEqual([ROAD]); + expect(kinds('yes')).toEqual([TUNNEL]); + }); }); describe('a waterway', () => { diff --git a/builder/web/src/lib/trailview/terrain/bins.ts b/builder/web/src/lib/trailview/terrain/bins.ts index 8beb92e745..eab49d9c5c 100644 --- a/builder/web/src/lib/trailview/terrain/bins.ts +++ b/builder/web/src/lib/trailview/terrain/bins.ts @@ -381,8 +381,10 @@ type Frame = ReturnType; function lineType(kind: string, tags: Record): number | undefined { const river = kind === 'river' || kind === 'stream'; if (!river && !['main-road', 'road', 'path', 'railway', 'tunnel', 'gallery'].includes(kind)) return undefined; - const bridge = !river && kind !== 'tunnel' && !GROUND.includes(tags.bridge ?? 'no'); - return kind === 'river' ? RIVER : kind === 'stream' ? STREAM : bridge ? BRIDGE : kind === 'tunnel' ? TUNNEL : kind === 'railway' ? RAIL : kind === 'path' || Object.hasOwn(PATH_HALF, tags.highway) ? PATH : ROAD; + // Tiles of an older bake hold a passage through a building as a tunnel: it is a way, the building stands over it. + const bore = kind === 'tunnel' && tags.tunnel !== 'building_passage'; + const bridge = !river && !bore && !GROUND.includes(tags.bridge ?? 'no'); + return kind === 'river' ? RIVER : kind === 'stream' ? STREAM : bridge ? BRIDGE : bore ? TUNNEL : kind === 'railway' ? RAIL : kind === 'path' || Object.hasOwn(PATH_HALF, tags.highway) ? PATH : ROAD; } /** diff --git a/host/obc-ground-plan/src/graph/parts.rs b/host/obc-ground-plan/src/graph/parts.rs index 8344100faa..808ebb0b60 100644 --- a/host/obc-ground-plan/src/graph/parts.rs +++ b/host/obc-ground-plan/src/graph/parts.rs @@ -94,7 +94,8 @@ pub(crate) fn classify<'a>(feature: &Feature, sections: &'a Sections) -> Option< } else { Family::Road }; - let level = if kind == "tunnel" { + // Tiles of an older bake hold a passage through a building as a tunnel: it is a way, the building stands over it. + let level = if kind == "tunnel" && tag("tunnel") != Some("building_passage") { Level::Tunnel } else if tag("deck").is_some() { Level::Deck diff --git a/host/obc-ground-plan/src/graph/tests.rs b/host/obc-ground-plan/src/graph/tests.rs index 035151a9c0..d7ebf5c9f6 100644 --- a/host/obc-ground-plan/src/graph/tests.rs +++ b/host/obc-ground-plan/src/graph/tests.rs @@ -910,3 +910,13 @@ fn the_room_reads_each_way_on_its_own_curve() { } assert!(g.crossings.iter().any(|c| c.ladder.is_some())); } + +#[test] +fn a_passage_through_a_building_of_kind_tunnel_lies_on_the_ground_and_a_tunnel_does_not() { + let level = |tunnel: &'static str| { + let l = line("tunnel", &[("highway", "residential"), ("tunnel", tunnel)], &[[-20.0, 0.0], [20.0, 0.0]], 500.0); + parts::classify(&feature(&l, cell().feature_tiles()[0], 0), Sections::embedded()).map(|c| c.2) + }; + assert_eq!(level("building_passage"), Some(Level::Ground)); + assert_eq!(level("yes"), Some(Level::Tunnel)); +} From 897b4d3be327f8aa1cd85b24185617732517454e Mon Sep 17 00:00:00 2001 From: timohueser Date: Sun, 15 Nov 2026 13:41:57 +0100 Subject: [PATCH 2/2] builder: record the ground-plan bridge's CI size with the passage rule The CI build of the bridge with the building-passage rule: 808,271 B gzipped (WASM and glue), 2,090,936 B raw, on stable 1.100.0. Co-Authored-By: Claude Opus 5.5 --- builder/wasm/wasm_size_guard.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/wasm/wasm_size_guard.py b/builder/wasm/wasm_size_guard.py index 26319d6747..842c899a8c 100644 --- a/builder/wasm/wasm_size_guard.py +++ b/builder/wasm/wasm_size_guard.py @@ -19,10 +19,10 @@ # Measured in CI on the build with the outline's turns, the levels that the tiles carry, the faces' tile-line # vertices, the decks' ceilings and end faces, the shared water level and curve of the feature bake, line water # and its culverts with their mouths, the classifier's ford rule, and the storeys over the ground with their open -# junction ends, their ends on the stubs' points, what each deck is made of and the junctions that lie on the -# ground (the crate's feature `storeys` on, stable 1.100.0). +# junction ends, their ends on the stubs' points, what each deck is made of, the junctions that lie on the +# ground, and a building passage of an older bake on the ground (the crate's feature `storeys` on, stable 1.100.0). # The owner allows about 60 kB of code growth for the crossing block, stated in its pull request and recorded here. -GROUND_PLAN_MEASURED = {"gzipped": 806_847, "raw_wasm": 2_087_262} +GROUND_PLAN_MEASURED = {"gzipped": 808_271, "raw_wasm": 2_090_936} # The owner's margin: compiler and dependency updates move the size by a few kilobytes and must not fail # unrelated pull requests; real growth past the margin still fails. Raw gets the same fraction as gzipped. # A pull request that changes the bridge's code records its own CI size here; the margin is only for toolchain