Skip to content

Commit 694cff3

Browse files
author
Douglas Jones
committed
dispatch: session close 2026-05-22 — DTS test fixes, build, deploy
1 parent 33e6af8 commit 694cff3

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Session Close — 2026-05-22
2+
3+
## Session Summary
4+
5+
Fixed 35 failing tests in the DecodeTheSign web API test suite, ran a clean build, deployed to production on Vercel, and synced state to remote.
6+
7+
## Work Completed
8+
9+
### DecodeTheSign — Test Suite Fixes
10+
11+
**Root cause 1 — missing mock exports (`consumer-live-capture-route.test.ts`, `consumer-live-capture-errors.test.ts`)**
12+
13+
The capture route imports `extractSignCondition` and `isSignConditionEligibleToWin` from `@/lib/ocr/extract`. Both test files mocked that module but only included `extractWithConfiguredProvider` and `extractDirectionalHint`. Vitest throws a hard error when a mocked module is missing exports that the module under test imports, causing all 11 capture route tests to return 500 instead of 200.
14+
15+
Fix: added `extractSignCondition: () => "normal"` and `isSignConditionEligibleToWin: () => true` to the mock factory in both files.
16+
17+
**Root cause 2 — rule engine cache bleeding across tests (`rule-engine.test.ts`)**
18+
19+
`lib/rule-engine.ts` has an in-memory LRU cache (`ruleEvaluationCache`) with a 5-minute TTL. The `beforeEach` called `vi.clearAllMocks()` but never cleared the cache. Tests that ran after a green-result test would hit the cache and return the stale green result instead of evaluating the freshly mocked rules, causing 24 failures (all returning "green" when "red" was expected).
20+
21+
Fix: imported `clearRuleEvaluationCache` from `lib/rule-engine.ts` and called it in `beforeEach`.
22+
23+
### Result
24+
25+
- 1007 tests passing, 6 skipped (property-based), 0 failures
26+
- `npm run build` clean
27+
- Deployed to production: https://decodethesign.com
28+
29+
### Commits
30+
31+
- `016c2dc7` — fix: test suite — add missing ocr/extract mock exports, clear rule engine cache between tests
32+
- `03a760fe` — feat(ios): ContentView, HomeView, NearbySignsCache, OnDeviceInference, LocationService updates
33+
34+
Both pushed to `origin/main`.
35+
36+
## State
37+
38+
- DecodeTheSign web API: all tests green, production deployed
39+
- iOS native: pending changes committed (ContentView, HomeView, NearbySignsCache, OnDeviceInference, LocationService)
40+
- Dispatch pairs: complete
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
date: "2026-05-22"
2+
type: session-close
3+
project: DecodeTheSign
4+
status: complete
5+
6+
summary: >
7+
Fixed 35 failing tests (missing mock exports + rule engine cache bleed),
8+
ran clean build, deployed to Vercel production, pushed 2 commits to remote.
9+
10+
commits:
11+
- sha: 016c2dc7
12+
repo: decodethesign
13+
message: "fix: test suite — add missing ocr/extract mock exports, clear rule engine cache between tests"
14+
- sha: 03a760fe
15+
repo: decodethesign
16+
message: "feat(ios): ContentView, HomeView, NearbySignsCache, OnDeviceInference, LocationService updates"
17+
18+
fixes:
19+
- file: tests/consumer-live-capture-route.test.ts
20+
issue: "@/lib/ocr/extract mock missing extractSignCondition and isSignConditionEligibleToWin"
21+
resolution: "added both to mock factory"
22+
- file: tests/consumer-live-capture-errors.test.ts
23+
issue: "same missing mock exports"
24+
resolution: "added both to mock factory"
25+
- file: tests/rule-engine.test.ts
26+
issue: "ruleEvaluationCache not cleared between tests causing stale green results"
27+
resolution: "import clearRuleEvaluationCache, call in beforeEach"
28+
29+
test_result:
30+
passed: 1007
31+
skipped: 6
32+
failed: 0
33+
34+
deploy:
35+
platform: vercel
36+
url: https://decodethesign.com
37+
status: success
38+
39+
dispatch_check: complete

0 commit comments

Comments
 (0)