Skip to content

feat: apply pre-flight chaos to proxy mode (phase 1)#119

Closed
marthakelly wants to merge 7 commits into
mainfrom
feat/chaos-proxy-phase1
Closed

feat: apply pre-flight chaos to proxy mode (phase 1)#119
marthakelly wants to merge 7 commits into
mainfrom
feat/chaos-proxy-phase1

Conversation

@marthakelly

@marthakelly marthakelly commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Applies chaos before routing so it affects proxy mode. This introduces pre-flight chaos (drop, disconnect) that runs before fixture matching and proxying.

Changes

  • Run applyChaos pre-flight with fixture = null
  • Preserve existing post-match chaos to maintain fixture-level behavior
  • Set _endpointType once early (removed duplicate assignment later in flow)
  • Add test ensuring drop prevents proxy call
  • Add disconnect test
  • Add fixture-mode pre-flight chaos test
  • Fix test resource cleanup (no leaked servers or temp dirs)

Scope

  • drop
  • disconnect

Why

Previously, chaos was skipped for proxy paths, making proxied responses unrealistically reliable.

This change ensures chaos applies consistently across fixture and proxy flows.

Behavior Note

Chaos is evaluated both pre-flight and post-match, which can increase effective trigger probability for non-boundary rates (p → p(2 - p)). This is an intentional tradeoff to enable pre-flight chaos without refactoring the existing flow.

Tests

  • New: drop in proxy mode prevents upstream call
  • New: disconnect in proxy mode prevents upstream call
  • New: fixture-mode pre-flight chaos short-circuits matching
  • Fixed: test cleanup (no leaked servers or temp dirs)
  • All existing tests pass

Notes

  • Minimal change: no modifications to proxy or writer layers
  • Future work will split pre/post phases to remove double evaluation (and add latency handling)

@pkg-pr-new

pkg-pr-new Bot commented Apr 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@119

commit: 7994ba8

@marthakelly

Copy link
Copy Markdown
Contributor Author

close b/c i combined two drafts

@jpr5
jpr5 deleted the feat/chaos-proxy-phase1 branch May 4, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant