Fix teeth vertex slider driving the lip vertex count

opts() declared `verts` twice - once from the lip slider and again from the
teeth slider. Duplicate keys in an object literal are silent in JS and the last
one wins, so the teeth vertex control was quietly setting the lip vertex budget
while the lip control did nothing at all.

Renamed to teethVerts, with interior.js reading it under that name.

selftest now parses the opts() literal and fails on duplicate keys, verified to
catch this exact case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-09-24 15:36:04 -04:00
parent d18791e6ad
commit f9b8ec8617
3 changed files with 16 additions and 3 deletions

View file

@ -63,6 +63,19 @@ export async function runWiring() {
if (list) {
for (const m of list[1].matchAll(/'([\w]+)'/g)) { ids.add(m[1]); ids.add(m[1] + 'v'); }
}
// Duplicate keys in an object literal are silent in JS - the last one wins.
// In opts() that meant the teeth vertex slider was quietly driving the lip
// vertex count while the lip slider did nothing at all.
const lit = app.match(/const opts = \(\) => \(\{([\s\S]*?)\n\}\);/);
if (lit) {
const keys = [...lit[1].matchAll(/^\s*([A-Za-z_$][\w$]*)\s*:/gm)].map((m) => m[1]);
const dupes = keys.filter((k, i) => keys.indexOf(k) !== i);
out.push({ name: `opts() has no duplicate keys (${keys.length} checked)`,
pass: dupes.length === 0, detail: [...new Set(dupes)].join(', ') });
} else {
out.push({ name: 'opts() literal found for duplicate-key check', pass: false, detail: '' });
}
const have = new Set([...html.matchAll(/id="([\w-]+)"/g)].map((m) => m[1]));
const missing = [...ids].filter((i) => !have.has(i));
out.push({ name: `every el() id exists in index.html (${ids.size} checked)`,