Remove stepCount/stepSize; patterns own their geometry
The stepCount and stepSize knobs were two controls for one quantity users actually care about (reach), and the number of steps is an implementation detail nobody meaningfully tunes. Each pattern has a natural size and resolution — a jitter is inherently small, an arc a broad curve — so those now live as constants in each strategy rather than as global config. - strategies.ts: each pattern defines its own step count and size; MoveContext drops `config` down to pure geometry (start/width/height/rng), and the module no longer imports Config at all (dissolving the type-only-import cycle workaround). line stays byte-for-byte: 250 one-pixel steps. - executor.ts: executePath takes `config` for pacing (stepDelay); the path itself needs nothing from it. - config.ts / cli.ts / move.ts / config.default.json: drop stepCount and stepSize from the type, seed, validation, resolver, CLI flags (-n, -s), and help. stepDelay stays as the one pacing lever. - configFile.ts: tolerate the removed keys instead of rejecting them — every pre-1.3.0 install seeded stepCount, so a hard "unknown key" failure on upgrade is avoided. They're ignored with a one-line stderr notice; genuine unknown keys still error. The -n/--step-count CLI flag (shipped since 1.0.0) is now an unknown option; config files degrade gracefully, command lines don't. Stays in the unpushed 1.3.0 release. 64 tests pass.
This commit is contained in:
@@ -73,9 +73,10 @@ describe("runKeeper", () => {
|
||||
// moveInterval 0 => any elapsed time counts as "idle long enough",
|
||||
// so the first idle check triggers a sweep deterministically.
|
||||
const dev = new LoopDevice(50);
|
||||
await runUntilStop(quietConfig({ moveInterval: 0, stepCount: 3, stepSize: 1, pattern: "line" }), dev);
|
||||
// A sweep issued setPosition commands (3 steps + restore); an idle
|
||||
// loop with no sweep would have issued none.
|
||||
await runUntilStop(quietConfig({ moveInterval: 0, pattern: "line" }), dev);
|
||||
// A sweep issued setPosition commands (the sweep is interrupted by the
|
||||
// sleep budget before it finishes, but many steps land); an idle loop
|
||||
// with no sweep would have issued none.
|
||||
expect(dev.commanded.length).toBeGreaterThanOrEqual(3);
|
||||
});
|
||||
|
||||
@@ -84,7 +85,7 @@ describe("runKeeper", () => {
|
||||
// idleness clock keeps resetting and no sweep ever fires.
|
||||
const moving: Point[] = Array.from({ length: 40 }, (_, i) => ({ x: i, y: i }));
|
||||
const dev = new LoopDevice(20, { x: 0, y: 0 }, moving);
|
||||
await runUntilStop(quietConfig({ moveInterval: 0, stepCount: 3, pattern: "line" }), dev);
|
||||
await runUntilStop(quietConfig({ moveInterval: 0, pattern: "line" }), dev);
|
||||
expect(dev.commanded.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user