smokes: enable Gate‑C budget canary by default (fallback allowed); add map_values_sum/map_keys_size; Stage‑B bundling routed via BundleResolver box; minor fixes.

This commit is contained in:
nyash-codex
2025-11-02 15:56:45 +09:00
parent c62cdc1b9a
commit 8b006575c1
5 changed files with 130 additions and 16 deletions

View File

@ -0,0 +1,53 @@
// bundle_resolver.hako — StageB bundling resolver (Boxfirst)
static box BundleResolver {
// Resolve and merge bundles. Returns merged prefix string or null on error.
// Policy:
// - Duplicate named modules are FailFast ([bundle/duplicate] Name)
// - --require-mod Name must appear in named bundles ([bundle/missing] Name)
// - Merge order: bundle-src* → bundle-mod* (in given order)
resolve(bundle_srcs, bundle_names, bundle_mod_srcs, require_mods) {
// Fail on duplicate names
if bundle_names != null && bundle_names.length() > 1 {
local i = 0; local n = bundle_names.length()
loop(i < n) {
local name_i = "" + bundle_names.get(i)
local j = i + 1
loop(j < n) {
if ("" + bundle_names.get(j)) == name_i {
print("[bundle/duplicate] " + name_i)
return null
}
j = j + 1
}
i = i + 1
}
}
// Check required modules
if require_mods != null && require_mods.length() > 0 {
local idx = 0; local rn = require_mods.length()
loop(idx < rn) {
local need = "" + require_mods.get(idx)
local found = 0
if bundle_names != null {
local j = 0; local bn = bundle_names.length()
loop(j < bn) { if ("" + bundle_names.get(j)) == need { found = 1 break } j = j + 1 }
}
if found == 0 { print("[bundle/missing] " + need) return null }
idx = idx + 1
}
}
// Merge in order: bundle-src* → bundle-mod*
local merged = ""
if bundle_srcs != null {
local i = 0; local m = bundle_srcs.length()
loop(i < m) { merged = merged + bundle_srcs.get(i) + "\n" i = i + 1 }
}
if bundle_mod_srcs != null {
local i2 = 0; local m2 = bundle_mod_srcs.length()
loop(i2 < m2) { merged = merged + bundle_mod_srcs.get(i2) + "\n" i2 = i2 + 1 }
}
return merged
}
}