Skip to content

feat(cdp): multi-tenant Phase 1 — BrowserContext isolation primitives - #53

Merged
KeyCode17 merged 7 commits into
developfrom
feat/mt-phase1-cdp-context
May 30, 2026
Merged

KeyCode17 merged 7 commits into
developfrom
feat/mt-phase1-cdp-context

Conversation

@KeyCode17

Copy link
Copy Markdown
Owner

Summary

Phase 1 of the multi-tenant tier (design: docs/superpowers/specs/2026-05-30-multi-tenant-tier-design.md). Adds the Layer-1 isolation backbone so each tenant session can get its own CDP BrowserContext (separate cookies/storage) and its own tab.

  • ras_types::ContextId newtype (mirrors TargetId).
  • BrowserPort gains create_context / close_context / new_target_in / list_targets_in (default-error impls keep existing mocks compiling).
  • ras-cdp::context_ops: create/dispose context, open a tab in a context, list targets scoped to a context, per-context download directory, context-scoped cookie clear (chromiumoxide 0.9.1: createBrowserContext / disposeBrowserContext / Target.getTargets filtered by browserContextId / Storage.clearCookies{browserContextId} / setDownloadBehavior{browserContextId}).
  • ChromiumoxideAdapter implements the four methods.
  • Review fix: create_context disposes the context on its error path (no leak).

Out of scope (later phases): AR-4 page-cache/lock fix, AR-5 egress/SSRF, agent target-binding (AR-3), the context-tagged event producer, and the ras-session crate.

Test Plan

  • cargo build --workspace clean; cargo clippy -p ras-cdp clean; pre-commit hooks green.
  • Unit: ras-types ContextId roundtrip.
  • Live e2e (#[ignore] + CDP_URL) against headless Chrome 148 — 2 passed:
    • contexts_isolate_cookies: cookie set in ctx A is not visible in ctx B; closing ctx A frees its tab.
    • list_targets_in_is_context_scoped: each context lists only its own tab.
    • Run: CDP_URL=http://127.0.0.1:9222 cargo test -p ras-cdp --test e2e_context_isolation -- --ignored

Notes

  • chromiumoxide_adapter.rs is now exactly 200 LOC (the cap) — the next phase touching it must split it.

🤖 Generated with Claude Code

KeyCode17 and others added 7 commits May 30, 2026 05:51
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_in/clear)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Delegates create_context, close_context, new_target_in, and list_targets_in
to context_ops free functions; removes now-unnecessary #[allow(dead_code)]
from list_targets_in.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@KeyCode17
KeyCode17 merged commit 425892a into develop May 30, 2026
7 checks 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