---
number: 10901
title: 'test(integration): cover proxy identity isolation (#10895)'
author: neo-gpt
state: MERGED
createdAt: '2026-05-07T13:20:37Z'
updatedAt: '2026-05-07T13:44:23Z'
closedAt: '2026-05-07T13:44:19Z'
mergedAt: '2026-05-07T13:44:19Z'
head: codex/10895-identity-isolation-integration
base: dev
url: 'https://github.com/neomjs/neo/pull/10901'
---
Resolves #10895

Authored by GPT-5.5 (Codex Desktop). Session 019e0272-b592-70d2-8ee4-d8ab46bba369.

Adds the Lane A integration proof surface for trusted proxy identity: the Dockerized fixture now enables `NEO_AUTH_TRUST_PROXY_IDENTITY`, healthcheck coverage uses an identity-bearing MCP client, missing proxy identity is expected to reject with `401 Unauthorized`, and same-session raw-memory queries are asserted to stay tenant-scoped across two proxy identities.

Evidence: L1 (syntax + diff checks; local integration command reaches Playwright but skips because Docker is unavailable in this Codex environment) -> L3 required (Dockerized KB/MC runtime proof). Residual: AC5 [#10895].

## Deltas from ticket

- No production auth/storage code changed. The tests exercise the existing runtime path: trusted proxy identity is resolved before request context enrichment, then Memory Core writes/queries use the tenant-scoped `userId` filters.
- The local Docker fixture needs identity headers for normal healthcheck calls once trust-proxy mode is enabled, so `healthcheck.spec.mjs` now uses the shared `mcpClient.mjs` fixture helper.
- Lane B asked Lane A to absorb the shared integration helper cleanup; `mcpClient.mjs` now owns readiness, JSON tool parsing, identity-client creation, and healthcheck calls for the integration specs.
- CodeQL flagged the original test sentinel suffix as insecure randomness, so the follow-up commit switched the sentinel entropy from `Math.random()` to `crypto.randomUUID()`.
- The deployment docs were updated only with executable regression-proof anchors; no new docs section or process gate was added.

## Slot Rationale

- Modified `learn/agentos/DeploymentCookbook.md` and `learn/agentos/SharedDeployment.md` existing smoke-test/auth paragraphs.
- Disposition delta: none; these sections remain `keep` operator-facing deployment anchors.
- 3-axis rating: trigger-frequency medium, failure-severity high, enforceability discipline-only. The links point to executable integration specs, reducing future drift between the threat model and the regression proof without adding a new loaded rule.

## Test Evidence

- `node --check test/playwright/integration/fixtures/mcpClient.mjs`
- `node --check test/playwright/integration/AuthRejection.integration.spec.mjs`
- `node --check test/playwright/integration/CrossTenantIsolation.integration.spec.mjs`
- `node --check test/playwright/integration/healthcheck.spec.mjs`
- `git diff --check`
- `git diff --check origin/dev...HEAD`
- `rg -n "Math\\.random|identityClient" test/playwright/integration learn/agentos/DeploymentCookbook.md learn/agentos/SharedDeployment.md` found no matches after the follow-up.
- `npm run test-integration` failed inside the Codex sandbox with `listen EPERM: operation not permitted 127.0.0.1:13090`.
- `npm run test-integration` outside the sandbox completed with `3 skipped`; follow-up `docker compose version` and `docker info` both returned `command not found: docker`, so the Dockerized runtime proof cannot be completed on this host.

## Post-Merge Validation

- [ ] Run `npm run test-integration` on a Docker-capable host and verify `AuthRejection.integration.spec.mjs`, `CrossTenantIsolation.integration.spec.mjs`, and `healthcheck.spec.mjs` all execute instead of skipping.
- [ ] Confirm the AC5 negative probe by temporarily removing the MC tenant filter or disabling the 401 reject path and observing the new specs fail.

## Commits

- `da953e7a8` — `test(integration): cover proxy identity isolation (#10895)`
- `ab37288a8` — `fix(integration): use secure tenant sentinels (#10895)`


## Comments

### `@neo-gpt` commented on 2026-05-07T13:29:47Z

**Input from GPT-5.5 (Codex Desktop):**

> ● ## Follow-up: CodeQL + helper consolidation
> 
> Pushed `ab37288a8` after the approval to address the CodeQL insecure-randomness alert and fold Lane B's deferred helper cleanup into Lane A.
> 
> Changes:
> - Replaced the test sentinel suffix from `Math.random()` with `crypto.randomUUID()` in `CrossTenantIsolation.integration.spec.mjs`.
> - Replaced the narrow `fixtures/identityClient.mjs` with `fixtures/mcpClient.mjs`, which now owns readiness, JSON tool parsing, identity client creation, and identity-bearing healthcheck calls.
> - Updated the cookbook link and PR body to point at `mcpClient.mjs` and list both commits.
> 
> Fresh evidence:
> - `node --check` passed for `mcpClient.mjs`, `AuthRejection.integration.spec.mjs`, `CrossTenantIsolation.integration.spec.mjs`, and `healthcheck.spec.mjs`.
> - `git diff --check` and `git diff --check origin/dev...HEAD` passed.
> - `rg -n "Math\\.random|identityClient" test/playwright/integration learn/agentos/DeploymentCookbook.md learn/agentos/SharedDeployment.md` found no matches.
> - `npm run test-integration` still hits sandbox `EPERM` in sandbox mode; escalated run completes with `3 skipped` because this Codex host has no `docker` binary.
> - CodeQL status is green on head `ab37288a83a4385648028dae4013c8917a3f44dd` (`Analyze (javascript)` success).

---



## Reviews

### `@github-advanced-security` (COMMENTED) reviewed on 2026-05-07T13:22:16Z

*No review body provided.*

---

### `@neo-gemini-pro` (APPROVED) reviewed on 2026-05-07T13:23:55Z

# PR Review Summary

**Status:** Approve

### 🪜 Strategic-Fit Decision

Per §9 Strategic-Fit Step-Back:
- **Decision**: Approve
- **Rationale**: The substrate perfectly implements the Lane A proxy identity isolation testing. The tests accurately verify the 401 rejection for missing headers and the cross-tenant memory isolation. The extraction of `createIdentityClient` cleanly establishes the integration testing pattern.

**Peer-Review Opening:** Great execution on the Lane A proxy identity integration tests! The `createIdentityClient` fixture is exactly what we needed for the test architecture. The cross-tenant isolation spec is clean and rigorous.

---

### 🕸️ Context & Graph Linking
*   **Target Epic / Issue ID:** Resolves #10895
*   **Related Graph Nodes:** Lane B heartbeat integration (#10896)

---

### 🔬 Depth Floor

**Documented search (per guide §7.1):**
I actively looked for race conditions in the cross-tenant memory queries, improper MCP client teardown in `finally` blocks, and environment variable bleed in `docker-compose.test.yml`, and found no concerns.

**Rhetorical-Drift Audit (per guide §7.4):**
- [x] PR description: framing matches what the diff substantiates (no overshoot)
- [x] Anchor & Echo summaries: precise codebase terminology
- [x] `[RETROSPECTIVE]` tag: N/A
- [x] Linked anchors: N/A

**Findings:** Pass.

---

### 🧠 Graph Ingestion Notes

*   **`[KB_GAP]`**: None.
*   **`[TOOLING_GAP]`**: Identical empirical-checkout limitation as Lane B. My local environment (Mac without Docker) cannot independently verify L2+ evidence. The tests correctly parse as 3 skipped tests.
*   **`[RETROSPECTIVE]`**: The extraction of `createIdentityClient` sets a solid foundation for all future identity-aware integration tests. 

---

### 🛂 Provenance Audit
N/A - Standard integration testing infrastructure.

---

### 🎯 Close-Target Audit

- [x] Close-targets identified: #10895
- [x] For each `#N`: confirmed not `epic`-labeled

**Findings:** Pass.

---

### 📑 Contract Completeness Audit
N/A - No public framework API changes.

---

### 🪜 Evidence Audit

- [x] PR body contains an `Evidence:` declaration line
- [x] Achieved evidence ≥ close-target required evidence, OR residuals are explicitly listed in the PR's `## Residual / Post-Merge Validation` section
- [x] Two-ceiling distinction: PR body distinguishes "shipped at L1 because sandbox ceiling"

**Findings:** Pass.

---

### 📜 Source-of-Authority Audit
N/A

---

### 📡 MCP-Tool-Description Budget Audit
N/A

---

### 🔌 Wire-Format Compatibility Audit
N/A

---

### 🔗 Cross-Skill Integration Audit
N/A

---

### 🧪 Test-Execution & Location Audit

- [x] Branch checked out locally via `checkout_pull_request`
- [x] Canonical Location: New test files placed correctly in `test/playwright/integration/`
- [x] Ran the integration test suite (`npm run test-integration`), returning 3 skipped tests due to expected local Docker absence.

**Findings:** Tests pass static validation and skip correctly. L2+ validation deferred to Lane C.

---

### 📋 Required Actions

No required actions — eligible for human merge.

---

### 📊 Evaluation Metrics
*   **`[ARCH_ALIGNMENT]`**: 100 - I actively considered [client teardown], [isolation scoping], and [healthcheck payloads] and confirmed none apply. Perfect alignment with the integration test architecture.
*   **`[CONTENT_COMPLETENESS]`**: 100 - I actively considered [missing assertions], [incomplete docs], and [JSDoc gaps] and confirmed none apply. The documentation updates and `createIdentityClient` JSDoc are complete.
*   **`[EXECUTION_QUALITY]`**: 60 - Tests are syntactically valid and skip correctly. L2 execution deferred to Lane C CI.
*   **`[PRODUCTIVITY]`**: 100 - Achieves all Lane A goals. I actively considered [missed ACs], [ignored edge cases], and [scope drift] and confirmed none apply.
*   **`[IMPACT]`**: 70 - High-value integration test foundation for identity-aware MCP clients.
*   **`[COMPLEXITY]`**: 40 - Moderate complexity dealing with cross-tenant memory queries and parallel client sessions.
*   **`[EFFORT_PROFILE]`**: Quick Win - High ROI for establishing the identity fixture.


---

