live kitbash_faceted: a failed check whose detail is keyed by vertex pairs is written, not a crash; W1 claimed by the edge-for-edge check

json.dumps refused the tuple keys of a failed crease check's detail, so a mutant that broke the crease order ended in a
traceback with no FAIL line. shell's comment says why the weights are looked up by vertex pair: the mesh's edge order
is not core.sheet's.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-12-02 12:10:30 +01:00
commit b5b32efe94
3 changed files with 11 additions and 4 deletions

View file

@ -1335,7 +1335,7 @@ class BROKKR_KITBASH_OT_shell(PolishOperator):
ends = np.zeros(2 * len(mesh.edges), dtype=np.int32)
mesh.edges.foreach_get("vertices", ends)
ends = np.sort(ends.reshape(-1, 2), axis=1).astype(np.int64)
order = np.argsort(ends[:, 0] * len(built.V) + ends[:, 1]) # core.sheet lists its creases low vertex first, sorted: the edges in that order
order = np.argsort(ends[:, 0] * len(built.V) + ends[:, 1]) # the mesh lists its edges in calc_edges' order, not by vertex pair: each of core.sheet's creases is found by its pair
at = np.searchsorted((ends[:, 0] * len(built.V) + ends[:, 1])[order], built.creases[:, 0] * len(built.V) + built.creases[:, 1])
edge_weights, point_weights = np.zeros(len(mesh.edges), dtype=np.float32), np.zeros(len(built.V), dtype=np.float32)
edge_weights[order[at]] = built.weights

View file

@ -70,6 +70,8 @@ CRISP = 18.0
# Degrees: the largest dihedral angle across a subdivided edge that carries no crease. Shipped 5.8; least claimed
# mutant 51 (C1, a Subdivision that only splits, SIMPLE: every cage edge stays an edge); the geometric mean, separation
# 3 each side. S1 reads 6.5 here, 1.13 of shipped: CRISP claims it.
# W1 (the weights written at the creases' own indices, not at the edges found by vertex pair) reads 25 here and is
# claimed by the exact check below, crease_edge edge for edge: it has no bound to sit under.
SOFT = 17.0
# Metres from a corner of a sheet whose rim is 0 to the nearest vertex of its subdivided surface: with corners preserved
# the surface keeps the cage's corner. Shipped 0 (read as 1e-7, what a float32 mesh is good to); least claimed mutant
@ -85,6 +87,10 @@ EVEN = 1.5e-3
def check(name, ok, detail=None):
try:
json.dumps(detail, default=str)
except TypeError: # a detail keyed by vertex pairs: the result file takes it as text, so a failed check is written and not a crash
detail = repr(detail)
R["checks"].append({"name": name, "ok": bool(ok), "detail": None if ok else detail})
@ -211,6 +217,7 @@ try:
stack(pauldron) == ["Kit Subsurf", "Kit Solidify", "Kit Bevel"] and (smooth.levels, smooth.render_levels, smooth.use_creases, smooth.boundary_smooth) == (3, 3, True, "PRESERVE_CORNERS")
and (wall.use_even_offset, wall.use_rim, wall.offset) == (True, True, -1.0) and abs(wall.thickness - WALL) < 1e-7 and abs(pauldron.modifiers["Kit Bevel"].width - 0.004) < 1e-7,
stack(pauldron))
# W1 dies here: the mesh's edges are not in the order core.sheet lists its creases, so the weights must be looked up by pair
expected = {tuple(pair): round(weight, 6) for pair, weight in zip(built.creases.tolist(), built.weights.tolist())}
check("crease_edge on the cage is the sheet's creases, edge for edge, and crease_vert is all zero", crease_weights(pauldron) == expected and len(expected) == 25
and pauldron.data.attributes.get("crease_vert") is not None and max(d.value for d in pauldron.data.attributes["crease_vert"].data) == 0.0, crease_weights(pauldron))

View file

@ -157,9 +157,9 @@
"solid": 0.027
},
"costs": {
"shell": 0.0035,
"evaluation": 0.0017,
"rebuildUnderCuts": 0.92
"shell": 0.0036,
"evaluation": 0.0018,
"rebuildUnderCuts": 0.97
},
"creaseRibs": "Operator brokkr_kitbash.ribs finished.",
"ok": true