Skip to content

Commit 094e664

Browse files
wormeymanclaude
andauthored
Wire the input_scale tripwire to the port, not to a formula (#290) (#291)
`basisInputScale.spec.ts` shipped in `00b5fea` with an assertion labelled "the shipped basisNoise scores this, today", frozen at `[196, 196, 3, 4, 3, 20, 79]` and described - in its own docblock, in the commit message and in the PR - as written to go red when #290 lands. It would not have. It scored the `unnarrowed` MODEL formula, not the port. The fix for #290 changes `basisNoiseExpr`, which that assertion never called, so the tripwire would have stayed green through the exact event it existed to catch. Now it reads `basisNoiseExpr`. Verified both ways rather than assumed: green on `main` at the same seven counts, and red under a scratch application of the #290 fix, reporting `[196 x 7]` against the frozen row. A second assertion pins the two together - the port and the formula ARE the same function today, because `basisNoiseExpr` at `output_scale = 1` reduces to `f32(basis_noise(x * input_scale, ...))`. That is why the mistake was invisible, and it is what #290 breaks. Keeping it asserted means this file's other counts demonstrably describe the port and not just an idea of it. The lesson is general enough to be worth stating: a frozen count is only a tripwire if it is wired to the thing that moves. This one graded four candidate models beautifully and forgot to grade the shipped code. Full gate green at VERIFY_RC=0. Claude-Session: https://claude.ai/code/session_01X2wz8eFazisYuENEkmBvvG Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 00b5fea commit 094e664

1 file changed

Lines changed: 40 additions & 5 deletions

File tree

test/basisInputScale.spec.ts

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vite-plus/test";
22

33
import fixture from "./fixtures/oracle-basis-input-scale.seed123456.json";
44
import { basisNoise, basisNoiseTablesFromSeed } from "../src/noise/basisNoise";
5+
import { basisNoiseExpr } from "../src/noise/eval/primitives";
56
import { f32 } from "../src/noise/eval/f32";
67

78
/**
@@ -131,14 +132,48 @@ describe("basis_noise input_scale narrowing (#269, second question)", () => {
131132
* 0.02 is the base of every `vulcanus_plasma` call, and 0.002 is
132133
* `mountain_basis_noise`.
133134
*
134-
* This assertion is expected to go GREEN-to-RED when this is fixed, the same
135-
* way `basisOutputScale.spec.ts` froze `[196, 28, 6, 96, 1]` before #269
136-
* landed. When it does, replace these with a full house rather than loosening
135+
* This reads `basisNoiseExpr` - the function a fix would change - rather than
136+
* the `unnarrowed` formula above, and the distinction is not cosmetic. The
137+
* first version of this assertion scored the formula, which meant it would
138+
* have stayed GREEN through the very fix it claimed to be a tripwire for. A
139+
* frozen count is only a tripwire if it is wired to the thing that moves.
140+
*
141+
* The two agree today, and that is itself the point: `basisNoiseExpr` at
142+
* `output_scale = 1` reduces to `f32(basis_noise(x * input_scale, ...))`, so
143+
* the formula and the port are the same function until the coordinate
144+
* arithmetic changes. #290 is what separates them.
145+
*
146+
* Expected to go GREEN-to-RED when #290 lands, the same way
147+
* `basisOutputScale.spec.ts` froze `[196, 28, 6, 96, 1]` before #269 did.
148+
* When it does, replace these with a full house rather than loosening
137149
* anything.
138150
*/
139-
it("the shipped basisNoise scores this, today", () => {
140-
const got = fixture.cases.map((_c, i) => score(MODELS.unnarrowed, i));
151+
it("the shipped basisNoiseExpr scores this, today", () => {
152+
const got = fixture.cases.map((c) => {
153+
let exact = 0;
154+
for (let i = 0; i < fixture.positions.length; i++) {
155+
const p = fixture.positions[i];
156+
const v = basisNoiseExpr(
157+
p.x,
158+
p.y,
159+
{
160+
seed0: fixture.seed0,
161+
seed1: fixture.seed1,
162+
inputScale: c.inputScale,
163+
outputScale: fixture.outputScale,
164+
},
165+
tables,
166+
);
167+
if (c.values[i] === v) exact++;
168+
}
169+
return exact;
170+
});
141171
expect(got).toEqual([196, 196, 3, 4, 3, 20, 79]);
172+
173+
// The control that keeps the paragraph above honest: the port and the
174+
// formula ARE the same function today, so this file's other counts describe
175+
// the port too. #290 is what breaks the tie.
176+
expect(got).toEqual(fixture.cases.map((_c, i) => score(MODELS.unnarrowed, i)));
142177
});
143178

144179
/**

0 commit comments

Comments
 (0)