mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
fix: the baseline cache keys on geometry, and the smoke tells all three worlds apart (#330 r2-M1)
The reviewer proved my behavioural claim false by running the stale-cache mutant against the smoke: 11 vs 12 total calls — indistinguishable. Two real defects hid behind that finding: 1. The cache keyed on _cfgEpoch, which ticks on every ACCEPTED PREVIEW — the cache missed on every pointermove and the baseline was recomputed ~4 times per gesture (measured). The key is now the document identity plus spacePhysicalGeometryFingerprint of its space: content, not a counter. A preview overlay leaves the fingerprint alone; an in-place structural commit changes it and honestly invalidates. 2. The smoke now counts BASELINE computations only (calls whose document is _serverCfg) across two gestures with a commit in between, expecting exactly 1 then exactly 2. A disabled cache lands near 20, an eternal cache stays at 1 — every mutant class turns the smoke red, and the smoke is now the mutant's guard alongside the source-contract unit. Issue: #330 User-Visible: no
This commit is contained in:
@@ -563,13 +563,18 @@ export const MUTANTS = [
|
||||
},
|
||||
{
|
||||
id: 'junction-limit-baseline-cache-stale',
|
||||
guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '
|
||||
// r2-M1: the behavioural guard — the smoke counts BASELINE computations
|
||||
// (exactly one per gesture with a working cache, one per pointermove
|
||||
// without) — plus the source-contract unit stays as the cheap first line.
|
||||
guard: 'node demo/smoke_junction_limits.mjs '
|
||||
+ '&& npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs '
|
||||
+ '&& node --test --test-name-pattern="#330 AC4" test/junction-limits.test.mjs',
|
||||
because: 'a baseline cache that survives a config epoch change serves verdicts of a '
|
||||
+ 'plan that no longer exists — the epoch check IS the invalidation contract (#330 §4.4)',
|
||||
patches: [{
|
||||
file: 'src/houseplan-card.ts',
|
||||
find: " if (cached && cached.epoch === this._cfgEpoch && cached.spaceId === spaceId) {",
|
||||
find: " if (cached && fingerprint && cached.fingerprint === fingerprint\n"
|
||||
+ ' && cached.spaceId === spaceId) {',
|
||||
replace: ' if (cached && cached.spaceId === spaceId) {',
|
||||
}],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user