feat: CI verification pipeline and structural conformance gates

- Add scripts/check-structural.js: counts production as any, empty catch,
  and ?? 0 patterns; fails CI if counts exceed committed baseline
- Add scripts/.structural-baseline.json: committed baseline (101 as any,
  17 empty catch, 62 ?? 0); use --fix-baseline to ratchet down
- Add scripts/ci-verify.sh: ordered pipeline (build → typecheck → lint →
  structural → unit tests → E2E) with pass/fail summary
- Add npm scripts: test:structural, test:structural:fix, ci:verify
- Add cache-staleness conformance test: verifies WORLD_CACHE_SCHEMA_VERSION
  is prefixed to all cache keys for auto-invalidation on schema changes
- Cache test suite grows from 141 → 142 passes
This commit is contained in:
John Dvorak
2026-05-22 16:33:34 -07:00
parent 3b7be0aaf0
commit 8f823d959b
5 changed files with 208 additions and 0 deletions
@@ -13,6 +13,7 @@ import {
clearGeometryCache,
readCachedExtractionResult,
writeCachedExtractionResult,
WORLD_CACHE_SCHEMA_VERSION,
} from './geometry-cache.js'
import { createEmptyWorld } from './world.js'
import type { GeometryWorld } from './world.js'
@@ -319,4 +320,10 @@ describe('geometry cache', () => {
rmSync(cacheDir, { recursive: true, force: true })
}
})
test('cache key includes schema version for auto-invalidation', () => {
const key = computeGeometryCacheKey('https://example.com', ['.a'], { viewportWidth: 1280 })
assert.ok(key.startsWith(`${WORLD_CACHE_SCHEMA_VERSION}-`),
`cache key "${key}" should start with schema version ${WORLD_CACHE_SCHEMA_VERSION}`)
})
})