From ef8bf0921077d22d159f049c2fa979154c87e991 Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Tue, 29 Sep 2026 22:23:44 +0300 Subject: [PATCH] ludic.base: bake_maps refuses a first input without {map} (it would test one path for every map: all or none); bake_expand says a {map} row is expanded only with a key from bake_maps Co-Authored-By: Claude Opus 5.5 --- packages/ludic.base/baked_expand.ludic | 7 +++++-- packages/ludic.base/tests/baked_expand_test.ludic | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/ludic.base/baked_expand.ludic b/packages/ludic.base/baked_expand.ludic index 63e9a2aa..a1b853c4 100644 --- a/packages/ludic.base/baked_expand.ludic +++ b/packages/ludic.base/baked_expand.ludic @@ -3,7 +3,8 @@ # dot-names left out. tools/bake/baked.py `expand` is its checked twin, as baked_hash is the hash's: a # runner and the check that expand alike agree on stale. A runner's line: bake_inputs_hash(bake_expand(...)). -# the inputs with `{map}` as `map` (none when "") and every glob expanded, space-separated +# the inputs with `{map}` as `map` and every glob expanded, space-separated. A {map} row is only ever expanded +# with a key from bake_maps: with "" its `{map}` stays, hashes as a missing path and reads as a quiet stale @alloc_ok("a bake's inputs: once a bake or a check") export function bake_expand(inputs: string, map: string) -> string { var ins = inputs @@ -22,12 +23,14 @@ export function bake_expand(inputs: string, map: string) -> string { return out } -# the maps a `{map}` row covers: each directory under assets/maps holding its first input, sorted +# the maps a `{map}` row covers: each directory under assets/maps holding its first input, sorted; none when +# the first input has no `{map}` (it would test one path for every map - all or none), and the check says so export function bake_maps(first_input: string) -> []string { return bake_maps_in("assets/maps", first_input) } # ... under another directory of maps (a test's) @alloc_ok("a bake's inputs: once a bake or a check") export function bake_maps_in(root: string, first_input: string) -> []string { let got = new []string + if not Text.contains(first_input, "{map}") { return got } let names = bk_sorted(Fs.list(root)) for i in 0 .. len(names) { if len(names[i]) == 0 or names[i][0] == 46 { continue } diff --git a/packages/ludic.base/tests/baked_expand_test.ludic b/packages/ludic.base/tests/baked_expand_test.ludic index 13bc90c0..c6bb3f9e 100644 --- a/packages/ludic.base/tests/baked_expand_test.ludic +++ b/packages/ludic.base/tests/baked_expand_test.ludic @@ -28,6 +28,8 @@ program BakedExpandTest { expect_eq(len(maps), 2) expect_eq(maps[0], "a") expect_eq(maps[1], "b") + # a first input without {map} tests one path for every map: refused, not all or none + expect_eq(len(bake_maps_in(root() + "/maps", root() + "/maps/a/ground_layers.lres")), 0) } test "a map's inputs: {map} put, the glob's matches sorted byte by byte, dot-names out" {