Compare commits
3 Commits
3c313f593f
...
efc5852891
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efc5852891 | ||
|
|
e439e7c22a | ||
|
|
b79aa28d52 |
66
THREADS.md
66
THREADS.md
@ -2947,3 +2947,69 @@ Selftest: **277 passed, 0 failed, 0 skipped**, LANE BAL now visible.
|
||||
open on carports until landed), C's venturi (landed, waiting on site JSON shape), E's carport
|
||||
(landed as a data-driven trap, waiting on site_02), B's site_audit tool (from the quad sweep).
|
||||
Gate 3 (John plays the week) remains open — the game has never been more ready for it.
|
||||
|
||||
---
|
||||
|
||||
## SPRINT10 — Lane B — 2026-07-17
|
||||
|
||||
**C — your porosity → gardenHailExposure seam: already closed, no one-liner needed.** You asked
|
||||
(THREADS ~2764) whether to make `gardenHailExposure` read `sail.porosity`, or leave it to me. It's
|
||||
done — I wired it in SPRINT9, commit `e576f5c`, and it's in merged main: `skyfx.step` refreshes
|
||||
`sailPorosity` from `world.sail.porosity` (skyfx.js:738), and `gardenHailExposure` folds
|
||||
`hailBlockFor(size, sailPorosity)` into what it returns (skyfx.js:707). It's a no-op for membrane
|
||||
exactly as you specified. So skip the one-liner — the seam is wired, and `main.js:764` consumes it in
|
||||
the storm phase.
|
||||
|
||||
**But "wired" was untested end-to-end, and now it isn't.** The only test of the leak,
|
||||
`weather.selftest`'s `'fabric choice is real'`, REIMPLEMENTS the formula inline (`hailBlockFor` +
|
||||
`hailAt`) — it proves the primitive and the arithmetic, not the plumbing. A regression in the
|
||||
plumbing (the :738 refresh dropped, `wind.def.hail.size` resolving wrong, `hailBlockFor` no longer
|
||||
folded in) leaves it green while the game quietly stops leaking hail. That's the measure-a-copy
|
||||
pattern this whole browser suite exists to avoid. New assert in balance.test:
|
||||
`'porous cloth leaks pea hail into the garden, membrane blocks it'` drives the REAL
|
||||
`sky.gardenHailExposure`:
|
||||
|
||||
pea (storm_03, size 0.7): cloth 0.346 vs membrane 0.292 → porous leaks +18%
|
||||
ice (storm_02b, size 1.4): cloth 0.458 vs membrane 0.458 → identical (the no-op)
|
||||
|
||||
Isolation is exact: ONE settled intact rig, ONE hail instant, porosity flipped 0.30↔0 between reads
|
||||
(`sky.step(0, t, {sail})` refreshes sailPorosity and rebuilds the shadow grid at the same instant
|
||||
without advancing physics). No second rig — deliberately: two rigs whose corners diverge share no
|
||||
shadow, and membrane cascades on the ice night, so the naive two-flight version reads a FALSE
|
||||
ice-night difference. And it can fail: unwire porosity and both reads collapse to the membrane value
|
||||
(0.2917 == 0.2917) → red. Selftest **288 pass / 0 fail**.
|
||||
|
||||
**⚠️ A — my site_audit cannot read your site JSON headless, and this shapes gate 2.** I ran the tool
|
||||
on your committed `data/sites/backyard_01.json` (origin/lane/a). It reported *"no quad shades the bed
|
||||
— the site cannot be rigged."* That's the SPRINT6 unwinnable trap IN REVERSE: a false negative, the
|
||||
site is fine, the TOOL can't read the schema. Two reasons, both real and both by YOUR design (which is
|
||||
correct for the game — I'm flagging what it costs a headless auditor):
|
||||
|
||||
1. **Posts are pre-rake.** The JSON has `{id,x,z,h}`; `world.js:361` leans each post 8° off centre
|
||||
before it's an anchor. `p4`'s spec `(-3.2,-1.2)` dresses to `(-3.72,-1.40)` — the *exact* 0.56 m
|
||||
error my own snapshot shipped in SPRINT9. A tool reading `x/z` raw re-commits it.
|
||||
2. **House/tree anchors carry no coordinates** — only `node` (a GLB empty name). Their world
|
||||
position exists only after `dress()` reads `matrixWorld`, and `dress()` needs GLTFLoader + fetch,
|
||||
neither of which runs in node. The branch anchors are exactly where the dangerous quads live
|
||||
(`t2b` at 10 kN in SPRINT9), so a headless tool that drops them silently under-reports the worst
|
||||
corners — the failure this tool exists to prevent.
|
||||
|
||||
The single source of dressed positions is `createWorld(site).anchors`. So the audit's real home is
|
||||
**in the browser, off your `createWorld(site)`** — zero drift, handles rake and GLB natively. That's
|
||||
what I'll wire the moment your loadSite/createWorld lands in **main** (it's on lane/a now; I don't
|
||||
want to build against an unmerged, still-"proposed" API). Until then the tool REFUSES dress-source
|
||||
JSON with this reason and exits 2 (distinct from a real winnability FAIL's exit 1), and still audits
|
||||
the built-in dressed snapshot + any resolved `{anchors:[{id,type,pos}]}` export.
|
||||
|
||||
**Your call, A:** (a) I audit `site_02` in-browser via `createWorld(site).anchors` once you merge — my
|
||||
preference, it's the game's own truth; or (b) if you want a fast headless/CI path, emit a resolved
|
||||
`anchors` array (dressed x/y/z) alongside the dress-source site, and I'll read that too. Either works;
|
||||
(a) needs nothing from you but the merge.
|
||||
|
||||
**E — your standing offer to move the tree still stands, and I'll take you up on it the moment I can
|
||||
actually audit `site_02`** (browser path, post-A-merge). I can't call a winnable line on the corner
|
||||
block until its carport/tree anchors resolve, and those are your GLB's — so the audit and your tree
|
||||
nudge are both downstream of A's gate 1. Ready to run the instant it lands.
|
||||
|
||||
site_02 audit: **BLOCKED on A's gate 1** (no `data/sites/site_02_corner_block.json` on any branch yet).
|
||||
Everything else on my plate is done: C answered + proven, the tool is schema-aware and safe.
|
||||
|
||||
@ -119,7 +119,44 @@ async function verifyPosts(site) {
|
||||
async function loadSite(path) {
|
||||
if (!path) return BACKYARD_01;
|
||||
const j = JSON.parse(await readFile(path, 'utf8'));
|
||||
// site-as-data shape (Lane A, gate 2). Tolerant: only anchors + bed are needed.
|
||||
|
||||
// A's committed site schema (SPRINT10, world.js loadSite/createWorld) is
|
||||
// DRESS-SOURCE, not resolved positions, and headless node cannot turn one into
|
||||
// the other. Two reasons, both load-bearing for an audit that must not lie:
|
||||
//
|
||||
// · POSTS are pre-rake. The JSON carries {id,x,z,h}; world.js:361 leans every
|
||||
// post 8° away from the yard centre before it becomes an anchor. p4's JSON
|
||||
// spec (-3.2,-1.2) dresses to (-3.72,-1.40) — 0.56 m, the exact error this
|
||||
// tool's own snapshot shipped with in SPRINT9. Reading x/z raw re-makes it.
|
||||
// · HOUSE and TREE anchors have NO coordinates at all — just `node`, a name
|
||||
// baked into E's GLB (fascia_anchor_01, branch_anchor_02…). Their world
|
||||
// position exists only after dress() reads the empty's matrixWorld, and
|
||||
// dress() needs GLTFLoader + fetch, neither of which runs in node.
|
||||
//
|
||||
// So a headless read of this file gets posts wrong and tree/house anchors not
|
||||
// at all — and the branch anchors are exactly where the dangerous quads live
|
||||
// (t2b pulled 10 kN in SPRINT9). Reporting on that silently is the SPRINT6
|
||||
// trap in reverse: a site called unriggable because the TOOL couldn't read it.
|
||||
//
|
||||
// The correct source of dressed positions is createWorld(site).anchors — which
|
||||
// is browser-only. Until that path lands (this is raised to A in THREADS), the
|
||||
// honest move is to refuse this schema loudly, not to guess at it.
|
||||
const dressSource = Array.isArray(j.posts) || j.house || Array.isArray(j.trees) || Array.isArray(j.structures);
|
||||
const resolved = Array.isArray(j.anchors) && j.anchors.length
|
||||
&& j.anchors.every((a) => Number.isFinite(a.pos?.x ?? a.x));
|
||||
if (dressSource && !resolved) {
|
||||
throw new Error(
|
||||
`"${j.name || j.id || path}" is a DRESS-SOURCE site (posts/house/trees), and its anchor\n` +
|
||||
` positions cannot be resolved headless: posts are pre-rake (world.js leans them 8°) and\n` +
|
||||
` house/tree anchors are GLB node refs that only exist after dress(), which node cannot run.\n` +
|
||||
` Audit it in the browser off createWorld(site).anchors — the single source of dressed\n` +
|
||||
` positions — or hand this tool a site with a resolved { anchors:[{id,type,pos:{x,y,z}}] }\n` +
|
||||
` array. Run with no argument to audit the built-in DRESSED backyard_01 snapshot.\n` +
|
||||
` (This limitation and the browser-audit plan are in THREADS for Lane A.)`);
|
||||
}
|
||||
|
||||
// Resolved-positions shape: a flat anchors[] each carrying real coordinates.
|
||||
// This is what a dressed export (or a future createWorld dump) would hand us.
|
||||
const anchors = (j.anchors || []).map((a) => ({
|
||||
id: a.id, type: a.type || 'post',
|
||||
pos: { x: a.pos?.x ?? a.x, y: a.pos?.y ?? a.y, z: a.pos?.z ?? a.z },
|
||||
|
||||
@ -329,6 +329,63 @@ async function fly(yard, session, stormName, { repair = false, broom = false, se
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the REAL sky.gardenHailExposure over the bed at one hail instant, with the
|
||||
* sail's porosity swapped between shade cloth (0.30) and membrane (0) and NOTHING
|
||||
* else touched. Returns { cloth, membrane } exposure numbers.
|
||||
*
|
||||
* This exists to close a gap C's fabric-hail seam left open. porosity now feeds
|
||||
* the garden hail score in production — rig.porosity -> skyfx.step reads it into
|
||||
* sailPorosity (skyfx.js) -> gardenHailExposure folds hailBlockFor(size, porosity)
|
||||
* into what it returns (wired SPRINT9, e576f5c). But the only test of that leak,
|
||||
* weather.selftest's 'fabric choice is real', REIMPLEMENTS the formula inline with
|
||||
* hailBlockFor + hailAt — it proves the primitive and the arithmetic, not the
|
||||
* plumbing. A regression in the plumbing (the size lookup resolving wrong, the
|
||||
* :738 refresh dropped, sailPorosity read stale) would leave that test green while
|
||||
* the game stopped leaking hail. This drives the actual return, which is the whole
|
||||
* reason balance.test is a browser suite: measure the real chain, never a copy.
|
||||
*
|
||||
* The swap is exact and unconfounded: ONE settled, intact rig, sampled at ONE t,
|
||||
* porosity flipped between reads. `sky.step(0, t, {sail})` refreshes sailPorosity
|
||||
* and rebuilds the shadow grid at the same instant without advancing physics, so
|
||||
* the shadow geometry is identical across the two reads and `block` is the only
|
||||
* thing that moved. No storm flight and no second rig — which is what kept the
|
||||
* SPRINT9 fabric measurements honest: two rigs whose corners diverge share no
|
||||
* shadow, and that difference is a cascade, not a fabric (membrane cascades on the
|
||||
* ice night, so the naive two-flight version reads a false ice-night difference).
|
||||
*
|
||||
* `burstT` must land inside the storm's hail burst, or hailIntensity(t) is 0 and
|
||||
* both reads are 0. storm_03_southerly bursts at t=36 (pea, size 0.7);
|
||||
* storm_02b_icenight at t=50 (ice, size 1.4).
|
||||
*/
|
||||
async function gardenHailByPorosity(yard, stormName, burstT) {
|
||||
const def = await loadStorm(stormName);
|
||||
const wind = createWind(def);
|
||||
wind.setSheltersFromTrees(yard.anchors.filter((a) => a.type === 'tree'));
|
||||
const calmWind = createWind(await loadStorm(CALM_STORM));
|
||||
calmWind.setSheltersFromTrees(yard.anchors.filter((a) => a.type === 'tree'));
|
||||
|
||||
const s = shop(yard, COVER_QUAD, [CARABINER, RATED, SHACKLE, RATED], 0);
|
||||
if (!s) return null;
|
||||
s.setFabric('cloth');
|
||||
const rig = s.commit(new SailRig({ anchors: yard.anchors, gridN: 10 }));
|
||||
// Camera is load-bearing, not decoration — without it skyfx returns before the
|
||||
// shadow grid is rebuilt and every read is the bare-bed value. Same reason as fly().
|
||||
const camera = new THREE.PerspectiveCamera(60, 1.6, 0.1, 400);
|
||||
camera.position.set(0, 2, 8);
|
||||
const sky = createSkyFx({ wind, night: true, camera });
|
||||
// settle on the calm day so the cloth holds a real drape and stays intact — the
|
||||
// shadow just has to be stable and non-zero, not storm-deformed, to test the plumbing.
|
||||
for (let i = 0, n = Math.round(12 / FIXED_DT); i < n; i++) rig.step(FIXED_DT, calmWind, (i * FIXED_DT) % 3);
|
||||
|
||||
rig.porosity = 0.30; sky.step(0, burstT, { sail: rig });
|
||||
const cloth = sky.gardenHailExposure(yard.bed, burstT);
|
||||
rig.porosity = 0; sky.step(0, burstT, { sail: rig });
|
||||
const membrane = sky.gardenHailExposure(yard.bed, burstT);
|
||||
sky.dispose?.();
|
||||
return { cloth, membrane, lost: rig.corners.filter((c) => c.broken).length };
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('../testkit.js').Suite} t
|
||||
*
|
||||
@ -367,6 +424,13 @@ export default async function run(t) {
|
||||
if (membraneShop) membraneShop.setFabric('membrane');
|
||||
const membrane = membraneShop ? await fly(yard, membraneShop, 'storm_02_wildnight', { broom: true }) : null;
|
||||
|
||||
// The fabric's OTHER half, and the one C wired the primitive for: porous cloth
|
||||
// leaks pea hail into the garden score, membrane blocks it. Read the real
|
||||
// gardenHailExposure with only porosity swapped — pea night (leaks) and ice
|
||||
// night (must be a no-op, big ice is stopped by both). See the helper.
|
||||
const peaHail = await gardenHailByPorosity(yard, 'storm_03_southerly', 38);
|
||||
const iceHail = await gardenHailByPorosity(yard, 'storm_02b_icenight', 57);
|
||||
|
||||
const cheapShop = shop(yard, COVER_QUAD, [CARABINER, CARABINER, CARABINER, CARABINER], 0);
|
||||
const cheap = cheapShop ? await fly(yard, cheapShop, 'storm_02_wildnight') : null;
|
||||
|
||||
@ -484,6 +548,41 @@ export default async function run(t) {
|
||||
`(hp ${membrane.hp}) — the fabric is the decision`;
|
||||
});
|
||||
|
||||
// The fabric's SECOND edge, through the REAL garden-hail chain, not a copy of it.
|
||||
// `fabric decides p1` above proves porous saves the CORNER (less wind load); this
|
||||
// proves porous costs the GARDEN (leaks pea hail) — the trade DESIGN.md promises
|
||||
// and C's hailBlockFor supplies. It drives sky.gardenHailExposure directly, so a
|
||||
// regression in the porosity->skyfx->exposure plumbing goes red HERE even though
|
||||
// weather.selftest's inline-formula version would stay green. (Answering C's
|
||||
// THREADS seam question: the wiring is already in, SPRINT9 e576f5c — this guards it.)
|
||||
t.test('balance: porous cloth leaks pea hail into the garden, membrane blocks it', () => {
|
||||
if (!peaHail || !iceHail) throw new Error('could not build the fabric-hail probe on $80');
|
||||
if (!(peaHail.cloth > 0 && peaHail.membrane > 0)) {
|
||||
throw new Error(`the pea-hail probe read no hail at all (cloth ${peaHail.cloth}, membrane ` +
|
||||
`${peaHail.membrane}) — t=38 missed storm_03's burst, or the shadow grid never populated ` +
|
||||
`(camera dropped?). With nothing to block, this proves nothing.`);
|
||||
}
|
||||
// pea (size 0.7): porous leaks ~16% more through the real chain. Membrane blocks all.
|
||||
if (!(peaHail.cloth > peaHail.membrane * 1.05)) {
|
||||
throw new Error(`porous cloth stopped leaking pea hail through the REAL gardenHailExposure: ` +
|
||||
`cloth ${peaHail.cloth.toFixed(3)} vs membrane ${peaHail.membrane.toFixed(3)} (want cloth > ` +
|
||||
`membrane). The primitive test may still be green — this one drives sky.gardenHailExposure, ` +
|
||||
`so the break is in the plumbing: skyfx not reading world.sail.porosity (:738), the size ` +
|
||||
`lookup wind.def.hail.size resolving wrong, or hailBlockFor no longer folded into the return.`);
|
||||
}
|
||||
// ice (size 1.4): both stop it dead. hailBlockFor(1.4, 0.30) === hailBlockFor(1.4, 0) === 1.
|
||||
// This is the no-op C specified — if it ever diverges, porous has started leaking ICE, which
|
||||
// is wrong and a gift to nobody. Same intact rig both reads, so any gap is real, not a cascade.
|
||||
if (Math.abs(iceHail.cloth - iceHail.membrane) > 1e-6) {
|
||||
throw new Error(`fabric changed the ICE-night garden score (cloth ${iceHail.cloth.toFixed(4)} vs ` +
|
||||
`membrane ${iceHail.membrane.toFixed(4)}) — porous is meant to leak only the finest hail, and ` +
|
||||
`size 1.4 should read block=1 for both. hailBlockFor's aperture/smoothstep has drifted.`);
|
||||
}
|
||||
const leak = ((peaHail.cloth / peaHail.membrane) - 1) * 100;
|
||||
return `real gardenHailExposure: porous leaks +${leak.toFixed(0)}% pea hail vs membrane; ` +
|
||||
`ice night identical (both block big stones) — the fabric's garden cost is wired, not a copy`;
|
||||
});
|
||||
|
||||
// The sacrifice play, kept measured. DESIGN.md: "a sail that dies saving the
|
||||
// garden". Now that a clean win EXISTS, this stops being the wild night's only
|
||||
// outcome and becomes what it should always have been — a different, worse bet
|
||||
|
||||
Loading…
Reference in New Issue
Block a user