Skip to content

test+docs: eve sandbox credential-brokering coverage + ReactiveSearchIndex provisioning tests#8

Merged
CahidArda merged 2 commits into
mainfrom
final-review
Jun 24, 2026
Merged

test+docs: eve sandbox credential-brokering coverage + ReactiveSearchIndex provisioning tests#8
CahidArda merged 2 commits into
mainfrom
final-review

Conversation

@CahidArda

Copy link
Copy Markdown
Collaborator

Summary

Follow-up test coverage and docs for the eve sandbox and the reactive search
index. The underlying code (the toBoxNetworkPolicy throw, ReactiveSearchIndex
itself, etc.) already landed on main; this branch adds the tests that pin the
behavior down and the user-facing docs for the credential-brokering limitation.

Net diff vs main is three files — no production code changes.

eve sandbox: credential brokering (docs + tests)

Box's network policy is a plain domain/CIDR allow-list, so Eve's per-domain
firewall rules (transform header injection / forwardURL) can't be honored and
the backend throws instead of silently sending the request unauthenticated.

  • Docs (packages/eve/README.md): moved the limitation into its own
    "Brokering credentials (injecting headers)" toggle with a ❌ incorrect example
    (a transform rule passed to onSession's use({ networkPolicy }), which
    throws) and a ✅ correct one (Box's attachHeaders at backend creation + a plain
    allow-list per session). The same toggle was added to the docs site
    (redis/sdks/agentkit/eve).
  • Tests (packages/eve/src/sandbox.test.ts): live Upstash Box tests covering
    what a user actually triggers — a per-session transform rule throws on both the
    use() path (useSessionFn) and the agent path (setNetworkPolicy), a plain
    allow-list works, and upstash({ attachHeaders }) creates a working session. The
    test docstring carries the full defineSandbox correct/incorrect snippets.

Follow-up test coverage and docs for the eve sandbox and the reactive search
index. The underlying code (the toBoxNetworkPolicy throw, ReactiveSearchIndex
itself, etc.) already landed on main; this branch adds the tests that pin the
behavior down and the user-facing docs for the credential-brokering limitation.

Net diff vs main is three files — no production code changes.

eve sandbox: credential brokering (docs + tests)

Box's network policy is a plain domain/CIDR allow-list, so Eve's per-domain
firewall rules (transform header injection / forwardURL) can't be honored and
the backend throws instead of silently sending the request unauthenticated.

  • Docs (packages/eve/README.md): moved the limitation into its own
    "Brokering credentials (injecting headers)" toggle with a ❌ incorrect example
    (a transform rule passed to onSession's use({ networkPolicy }), which
    throws) and a ✅ correct one (Box's attachHeaders at backend creation + a plain
    allow-list per session). The same toggle was added to the docs site
    (redis/sdks/agentkit/eve).
  • Tests (packages/eve/src/sandbox.test.ts): live Upstash Box tests covering
    what a user actually triggers — a per-session transform rule throws on both the
    use() path (useSessionFn) and the agent path (setNetworkPolicy), a plain
    allow-list works, and upstash({ attachHeaders }) creates a working session. The
    test docstring carries the full defineSandbox correct/incorrect snippets.

sdk: ReactiveSearchIndex provisioning tests

packages/sdk/src/reactive-index.test.ts — a suite (against real Upstash Redis,
spying on the real ops, no mocked responses) that pins the reactive index's core
invariant:

  • A missing index is signalled differently per op (querynull,
    count{count:-1}, aggregate→throws), and the wrapper provisions + retries
    exactly once on that signal.
  • An existing-but-empty index returns ordinary empties (not the missing-index
    sentinels), so the wrapper does not re-provision.
  • Provisioning happens only once across repeated reads on the same instance, and no
    create-index request is sent when the index already exists.

Testing

  • pnpm typecheck / lint clean.
  • New eve sandbox tests pass against live Upstash Box; the ReactiveSearchIndex
    suite passes against live Upstash Redis.

- eve sandbox: toBoxNetworkPolicy now THROWS on Eve per-domain rules
  (transform / forwardURL) instead of silently reducing them to a bare
  domain allow-list. Box's network policy can't inject headers, and
  attachHeaders is creation-time only (no dynamic API), so a dropped
  credential-brokering rule would send requests unauthenticated. Points
  users to upstash({ attachHeaders }) for the static path. Exported +
  tested.
- createRateLimit: `redis` is now optional, defaulting to Redis.fromEnv()
  — it was the one feature breaking the "redis defaults everywhere"
  promise. Fixed the ai-sdk/core README + docs (snippet no longer
  references an undefined `redis`). Added a fromEnv-default test.
- sdk README tool-cache snippet: cache.wrap(...) (was tools.wrap, an
  undefined variable).
- eve defineSearchTools JSDoc: replace the broken shared-module example
  (importing ../redis.js / ../lib/book-search.js, which fails at eve's
  turn step) with the self-contained per-file pattern the README uses.
Verify, against live Redis, how each raw op signals a missing index
(query→null, count→{count:-1}, aggregate→throws) vs an existing-but-empty
index, and that the wrapper provisions+retries exactly once on a missing
index but sends no create-index request when data is merely absent.
@CahidArda CahidArda merged commit 013ee7f into main Jun 24, 2026
1 check passed
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