PROCITY/tools/qa/r42_budget.py
m3ultra 293a82c5e8 R42 THE LOOK: five lane-runs — the pub is dressed, the decks read, and the town is cast
John looked at R41's proof shots and named three faults. All three are fixed, at zero draw
cost, and every lane corrected somebody's numbers on the way — including its own.

E-LOOK (§42.1+§42.2a) — THE PREMISE WAS WRONG. "The pub props have no texture" (my brief,
quoting E's own R41 note) is false: all 37 carry COLOR_0 and three.js renders it. The colour
was BLEACHED — jukebox at saturation 0.02, 15 assets under 0.05; what the source library
called colour was baked AO. So the fix was a palette imposed on colour already present, in
place: 46 assets, draw delta +0 and tri delta +0 on every one, proved the honest way — the
concatenated POSITION/NORMAL/TEXCOORD/index bytes are sha1-identical to R41, so footprints
and origins provably did not move. (A first-pass bbox check ignored node rotations and
"found" 3 phantom violations; thrown out for the byte comparison.) The banquette was 1990s
office teal and went burgundy; the beer umbrella was white and went brewery green.
THE DECK, diagnosed before being touched: 7 greys, chassis 0.05 luminance on a 0.033 bench =
1.21:1, and the one high-contrast feature was INSIDE-OUT (white ring around a dark disc; a
turntable is a dark record on a light platter). Now Technics silver at 6.74:1, black vinyl,
red start/stop. Node contract re-read from the shipped GLB: 4/4 + 1/1 PASS. Filed to R43,
not fixed: deck_1200_rigged has NO PLINTH (bottom 43mm of 119mm lost to R41 join damage).

E-CAST (§42.3) — 19 of 24 ship. Rejected: comical_luchador_01 (Mixamo Ch43, purple mask
reading EL CHUPACABRA, identified from the file's own material name), a 3-heads-tall cartoon
child, a robed wuxia elder, a WW2 infantryman — and dj_phrtt_01, AN UNCLOTHED BODY whose only
texture is a bare-skin atlas, which was in the DEFAULT crowd and live on the depot. It is the
R41 deny-list's failure class through a different door: an innocent name from another
pipeline. Only rendering all 24 and LOOKING found it.
Ruling 2 (prefer CC0) was REFUSED ON MEASUREMENT: Quaternius is 25 nodes / 23 joints and ZERO
of 64 canonical tracks bind — it would have loaded silently and never animated. Replacements
came from Mixamo's Ch## pool, filtered to the contract-clean 65-bone family (candidates ran
65..99 bones; named characters carry facial/hair bones).
THE LICENCE GAP WAS UNREAD, NOT MISSING: every source FBX carries ApplicationVendor "Mixamo,
Inc." internally. Adobe royalty-free, no attribution owed. B's amber rows are now real.

B (§42.5) — MY ASSIGNED FIX WAS USELESS AND B PROVED IT. document.fonts.ready shipped, then
measured: the atlas canvases are already byte-identical across boots, the game ships NO
webfonts (document.fonts.size === 0), and ready fires 50ms BEFORE the first fillText. The
real cause of unreproducible bookmarks is the wall-clock CROWD — 983 changed px of 921,600,
ALL in the pedestrian band; 0 px with the crowd out. New DBG.freeze() takes stable bookmarks
2/5 -> 5/5. Also found: ?pop=0 boots 140 citizens (0 is falsy against the default).
THE BENCH: D's filing correct on both counts. Front-vs-road 90.0deg -> 0.0deg, min=med=max
over 60/60 instances; the streetlight arm now reaches 1.05m over the road where it reached
0.00. Both used a base yaw that pointed +Z down the street while their own comments claimed
otherwise — the side term was already right, which is why it survived 41 rounds of reading.
Also: on any box with CDN access 9 of 60 benches are the depot GLB, 90deg out from the house
law — normalised at the geometry, once, at load. benchStops(plan) exported as one truth.

C (§42.2b) — 122 vs 123 WAS THE CAMERA ASPECT, and nobody was wrong. Draw counts are
post-frustum-cull and the sweep camera inherits the window aspect: 1.25->116, 1.60->122 (C's
harness), 1.778->123 (F's), 2.37->124. Pinned MEASURE_ASPECT=16/9 with a 1.25 control.
E's "keep the bench dark" advice was measured and declined with reason (deck-vs-bench was
already 4.73:1, over threshold). "Reads as a black box" is a claim about pixels, so C measured
pixels: near-black in the booth crop 57.5% -> 26.7%, distinct colours 228 -> 389. Bench
rebuilt 3->7 boxes with an open record bay; headphones on the mixer; faceDoor aims booths at
the player's entry — alignment within 45deg went 49% -> 92%. Two bugs found by looking: a
fitting could be planted INSIDE A WALL (0.77m of a 0.86m half-depth in plaster), and every
booth part sat 25mm sunk into its own worktop.

D (§42.4) — five swaps IN PLACE at the same index (pickRig indexes these arrays and pedIndex
is in the identity signature and the impostor atlas; removal would renumber the town).
Identity signature pre- vs post-swap: 0 differing lines of 150 — who each citizen is did not
move, only which body they wear. dj_phrtt_01 verified gone AT THE WIRE, not from source: a
fresh default boot fetches 32 ped GLBs, none retired.
THE CONTROL ARM FOUND A 41-ROUND-OLD BUG: the ped being RETIRED, comical_boy_01, binds only
3,132 of 3,460 tracks — six thumb bones lack the mixamorig prefix. It had been silently
dropping six tracks per clip since it shipped. Testing the thing being thrown away found it.
Imported B's benchStops mid-round: sitters now 0.0deg to the road, signatures byte-identical
across the rewire. Corrected F's filing: the browse smoke was flaky-by-construction (a 16-25s
race against a live sim), not deterministically red.

F (§42.6) — qa.sh --strict 24 passed / 0 failed / 0 warn / 0 skipped. New Gate 11: period law
(0/5 banned; CONTROL: R41's roster trips all five) and roster licence (24/24, 0 unverified;
CONTROL: an amber row turns 20 red). r41_shots.py promoted warn -> strict.
R41'S BYTE-HASH BAN IS REVERSED AND ITS STATED REASON WITHDRAWN AS WRONG. A gate may pin a
hash under five in-run assertions (classic+flags boot, freeze().stillLive all-false, a second
freeze removing 0 draws, settle until DBG.info() stops changing, hash with the dbg panel
hidden): 5/5 bookmarks now pin to one sha256 over 3 fresh boots. Two findings got it there —
the chunk streamer (a fixed settle is a bet on load) and the fps readout, which with
everything else frozen was the last thing moving at 53-62 px.
?pop=0 fixed (Number.isFinite) — a no-op for 35 rounds. Three red flags_check gates fixed.

Street: noon 282 · NIGHT 291/300 — the nine-draw margin INTACT, every R41 row reproducing to
the digit. Interior at pinned 16:9: 123 @ dept/auto, margin 227. selfcheck 157,647/157,647,
0x5f76e76 unmoved. No tag — John's playtest rules the epoch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 23:49:49 +10:00

199 lines
10 KiB
Python

#!/usr/bin/env python3
"""PROCITY Lane F — R42 §42.6 · THE INTERIOR BUDGET, WITH THE INSTRUMENT PINNED (Lane C's §42 ask).
tools/.venv/bin/python tools/qa/r42_budget.py
WHY THIS FILE EXISTS. R41 closed with a two-round-old argument settled the wrong way round: C
published the worst interior as **122** draws and F measured **123** on two instruments, and F wrote
it off as "C's measurement environment". C found the actual cause in §42.2b and it is neither lane's
bookkeeping — **it is the CAMERA ASPECT**. `renderer.info.render.calls` counts what survives frustum
culling; the sweep camera holds a fixed VERTICAL fov (70) and inherits its aspect from the window, so
a wider window puts more room in frame and issues more draws:
1280x1024 aspect 1.250 -> 116 1280x800 1.600 -> 122 1280x720 1.778 -> 123
Both numbers were honest readings of one tree through two windows. **123 is the law's number**,
because the law must be the worst a player can produce and a player's window is wide.
C's filing to F was exact: *"set `S.camera.aspect` explicitly inside SWEEP rather than inheriting the
viewport, so the gate cannot drift when someone changes `new_page`."* That is what this does.
`r41_integration.py` arm 2 happens to be right today only because its `new_page` is 1280x720, which
IS 16:9 — a coincidence one line in an unrelated helper can end. Here the aspect is a constant in the
measurement, the viewport is irrelevant, and the sweep ships an ASPECT CONTROL that reproduces C's
1.25 reading on purpose, so "the instrument is pinned" is a measurement rather than a comment.
ARMS
1. GLB off / GLB on / GLB on + ?stock=real, aspect pinned 16:9 — the law is worst ≤ 350.
2. CONTROL (aspect): the identical sweep at aspect 1.25 must read LOWER, and by C's own margin.
3. CONTROL (viewport): the 16:9 sweep run in a 1280x1024 window must return the SAME number as the
one run in a 1280x720 window — which is the actual claim "the instrument no longer drifts".
"""
import sys, os, json, time, socket, subprocess, pathlib
ROOT = pathlib.Path(__file__).resolve().parent.parent.parent
PORT = int(os.environ.get('PROCITY_R42_BUDGET_PORT', '8986'))
HOST = f'http://127.0.0.1:{PORT}'
SEED = 20261990
DRAW_LAW = 350
fails = []
def FAIL(m): fails.append(m); print(f" \033[31m✗ FAIL\033[0m {m}")
def OK(m): print(f" \033[32m✓\033[0m {m}")
def head(m): print(f"\n\033[1m{m}\033[0m")
def note(m): print(f" \033[33m·\033[0m {m}")
def check(c, m): (OK if c else FAIL)(m)
NOSTORE = r'''
import sys, http.server, functools
class H(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate')
super().end_headers()
def log_message(self, *a): pass
http.server.HTTPServer(('127.0.0.1', int(sys.argv[1])),
functools.partial(H, directory=sys.argv[2])).serve_forever()
'''
# F's own sweep — the same scene bookkeeping as R41 arm 2 (strip EVERY interior first, including the
# page's own `current`; that omission is what carried a phantom second room through R39/R40) — with
# ONE change: the camera's aspect is set from an argument and restored afterwards, so the number is
# a property of the tree and not of the window the harness happened to open.
SWEEP = r"""
async ({ glb, stock, aspect }) => {
const S = window.PROCITY_C, THREE = S.THREE;
const strip = () => { for (const o of S.scene.children.filter(o => o.userData && o.userData.kind === 'interior')) S.scene.remove(o); };
strip();
let manifest = null;
if (glb) manifest = await fetch('assets/manifest.json?x=' + Date.now()).then(r => r.ok ? r.json() : null).catch(() => null);
const inherited = S.camera.aspect;
const measure = async (type, arch) => {
const r = S.buildInterior({ id: type, type, seed: 1990, storeys: 1 }, THREE,
{ archetype: arch, useGLB: glb, manifest,
stock: stock ? 'real' : undefined,
stockBase: (stock && type === 'opshop') ? S.WARDROBE_BASE : undefined });
S.scene.add(r.group); if (glb) await r.glbReady;
S.camera.position.set(r.dims.W * 0.3, r.dims.H * 0.6, r.dims.D / 2 - 0.8);
S.camera.lookAt(0, 0.9, -r.dims.D * 0.15);
// THE PIN. A fixed vertical fov + an inherited aspect means the frustum is a function of the
// window; set it here and the sweep measures the tree instead of the browser.
S.camera.aspect = aspect; S.camera.updateProjectionMatrix();
S.renderer.info.reset(); S.renderer.render(S.scene, S.camera);
const d = S.renderer.info.render.calls;
S.scene.remove(r.group); r.dispose();
return d;
};
let worst = 0, worstAt = '', rooms = 0; const perType = {};
for (const t of S.SHOP_TYPES) {
let tw = 0;
for (const a of [undefined, ...S.ARCHETYPE_KEYS]) {
const d = await measure(t, a); rooms++;
if (d > tw) tw = d;
if (d > worst) { worst = d; worstAt = `${t}/${a || 'auto'}`; }
}
perType[t] = tw;
}
S.camera.aspect = inherited; S.camera.updateProjectionMatrix();
S.rebuild();
return { worst, worstAt, rooms, perType, inheritedAspect: +inherited.toFixed(3), pinnedAspect: aspect };
}
"""
def port_up(port):
with socket.socket() as s:
s.settimeout(0.4); return s.connect_ex(('127.0.0.1', port)) == 0
def serve():
p = subprocess.Popen([sys.executable, '-c', NOSTORE, str(PORT), str(ROOT / 'web')],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
for _ in range(80):
if port_up(PORT): return p
time.sleep(0.1)
p.terminate(); raise SystemExit(f'could not serve on :{PORT}')
def open_test(p, w, h):
b = p.chromium.launch()
pg = b.new_page(viewport={'width': w, 'height': h})
errs = []
pg.on('console', lambda m: errs.append(m.text) if m.type == 'error' else None)
pg.on('pageerror', lambda e: errs.append(str(e)))
pg.goto(f'{HOST}/interior_test.html?seed={SEED}&stock=real')
pg.wait_for_function('window.PROCITY_C && window.PROCITY_C.SHOP_TYPES', timeout=45000)
pg.wait_for_timeout(1500) # the page's own stock preloads
return b, pg, errs
def main():
srv = serve()
try:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
head(f'1. THE INTERIOR LAW — F\'s own sweep, 12 types x 6 archetypes, aspect PINNED 16:9, law ≤{DRAW_LAW}')
b, pg, errs = open_test(p, 1280, 720)
res = {}
try:
for label, opts in (('GLB off', dict(glb=False, stock=False, aspect=16 / 9)),
('GLB on', dict(glb=True, stock=False, aspect=16 / 9)),
('GLB on + stock=real', dict(glb=True, stock=True, aspect=16 / 9))):
r = pg.evaluate(SWEEP, opts)
res[label] = r
note(f"{label}: worst {r['worst']} @ {r['worstAt']} over {r['rooms']} rooms "
f"(margin {DRAW_LAW - r['worst']}) · per type {json.dumps(r['perType'])}")
check(r['worst'] <= DRAW_LAW,
f'{label}: worst room {r["worst"]}{DRAW_LAW} — MARGIN {DRAW_LAW - r["worst"]}')
on = res['GLB on']
check(on['worstAt'].startswith('dept'),
f"the worst room is a dept room ({on['worstAt']}) — C's headline, on F's instrument")
head('2. CONTROL (aspect) — the identical sweep at 1.25, which must read LOWER')
narrow = pg.evaluate(SWEEP, dict(glb=True, stock=False, aspect=1.25))
note(f"aspect 1.250: worst {narrow['worst']} @ {narrow['worstAt']} · "
f"aspect 1.778: worst {on['worst']} @ {on['worstAt']}")
check(narrow['worst'] < on['worst'],
f"a narrower frustum draws less ({narrow['worst']} < {on['worst']}) — the sweep is "
f"aspect-sensitive, which is exactly why it has to be pinned. This IS the 122-vs-123 "
f"argument, reproduced on demand instead of relitigated.")
check(narrow['worst'] == 116,
f"…and it reproduces Lane C's published control value exactly: {narrow['worst']} = 116 "
f"@ aspect 1.25 (LANE_C_NOTES §42)")
check(not errs, f'0 console errors over {sum(r["rooms"] for r in res.values()) + narrow["rooms"]} room builds')
finally:
b.close()
head('3. CONTROL (viewport) — the SAME pinned sweep in a 1280x1024 window must agree')
b2, pg2, errs2 = open_test(p, 1280, 1024)
try:
other = pg2.evaluate(SWEEP, dict(glb=True, stock=False, aspect=16 / 9))
note(f"window 1280x1024 (inherited aspect {other['inheritedAspect']}): "
f"worst {other['worst']} @ {other['worstAt']}")
check(other['worst'] == res['GLB on']['worst'] and other['worstAt'] == res['GLB on']['worstAt'],
f"a window that would have read {other['inheritedAspect']} reads "
f"{other['worst']} @ {other['worstAt']} — identical to the 1280x720 run. The number is "
f"now a property of the TREE. Unpinned, this same window read 116 in C's table.")
check(not errs2, '0 console errors on the viewport-control run')
print('\n' + json.dumps({'law': DRAW_LAW, 'aspect': '16:9',
'glb_off': res['GLB off']['worst'],
'glb_on': res['GLB on']['worst'],
'glb_on_at': res['GLB on']['worstAt'],
'glb_on_stock_real': res['GLB on + stock=real']['worst'],
'margin': DRAW_LAW - res['GLB on']['worst'],
'control_aspect_125': narrow['worst'],
'control_viewport_1280x1024': other['worst']}, indent=1))
finally:
b2.close()
finally:
srv.terminate()
print('')
if fails:
print(f'\033[31m● FAIL\033[0m — {len(fails)} problem(s):')
for f in fails: print(f' · {f}')
return 1
print('\033[32m● PASS\033[0m — the interior law holds with the instrument pinned, and both controls fired')
return 0
if __name__ == '__main__':
sys.exit(main())