You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: check strict mode before proxy attempt (#182)
## Summary
Fixes a critical bug where `X-AIMock-Strict: true` had no effect in
`--proxy-only` mode. The strict-mode 503 check was positioned after
`proxyAndRecord()`, which returns early on success — making the strict
path unreachable.
Moves the strict-mode check before the proxy attempt in all 17 handler
files (22 call sites total). When strict mode is active, unmatched
requests immediately return 503 without attempting to proxy.
## Test plan
- [x] New test: strict header prevents proxy in record mode (503 instead
of proxying)
- [x] Updated recorder.test.ts for new semantics
- [x] 2929 tests pass, 0 fail
- [x] `npx tsc --noEmit` clean
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
5
5
### Fixed
6
6
7
+
-**Strict mode checked before proxy attempt** — in `--proxy-only` mode, the `X-AIMock-Strict` header had no effect because `proxyAndRecord()` returned before the strict check. Now all 17 handlers check strict mode first: when strict + no fixture → 503 immediately, no proxy attempt
7
8
-**Helper utilities and error serialization** — hardened helper functions and error serialization paths for correctness and robustness
8
9
-**Journal and fixture-loader correctness** — fixed journal entry handling and fixture-loader edge cases
9
10
-**WebSocket handler consistency and strict-mode journal** — aligned WebSocket handler behavior and ensured strict-mode journal entries are recorded correctly
0 commit comments