test(e2e): fix chat-separation Activity API source seeding (#2764 / CR2 #11492) #2810

Merged
devops-engineer merged 2 commits from fix/2764-chat-separation-fail-closed into main 2026-06-14 01:53:51 +00:00
Member

What

Follow-up to merged #2807 / #2780. CR2 #11492 RC: the Activity API source-filter tests were seeding canvas-origin rows with a bearer token that could resolve to the target workspace, so they could be logged as agent-sourced instead of canvas-sourced, breaking the separation the spec asserts.

  • Refactor postA2AMessage to accept a source parameter:
    • "canvas": sends no workspace-resolving auth and no X-Workspace-ID, forcing ProxyA2A callerID empty → activity_logs.source_id NULL (matching /activity?source=canvas).
    • "agent": sends the workspace bearer token → source_id = workspace_id (matching /activity?source=agent).
  • Remove the E2E_ADMIN_TOKEN dependency from the Activity API block.
  • Strengthen assertions to verify each seeded probe text lands in the correct source bucket.

Test plan

  • npx eslint e2e/chat-separation.spec.ts passes.
  • Full Playwright run requires E2E Chat job infra; CI will exercise the spec.

Fixes #2764 / CR2 #11492

🤖 Generated with Claude Code

## What Follow-up to merged #2807 / #2780. CR2 #11492 RC: the Activity API source-filter tests were seeding canvas-origin rows with a bearer token that could resolve to the target workspace, so they could be logged as agent-sourced instead of canvas-sourced, breaking the separation the spec asserts. - Refactor `postA2AMessage` to accept a `source` parameter: - `"canvas"`: sends no workspace-resolving auth and no `X-Workspace-ID`, forcing ProxyA2A `callerID` empty → `activity_logs.source_id` NULL (matching `/activity?source=canvas`). - `"agent"`: sends the workspace bearer token → `source_id = workspace_id` (matching `/activity?source=agent`). - Remove the `E2E_ADMIN_TOKEN` dependency from the Activity API block. - Strengthen assertions to verify each seeded probe text lands in the correct source bucket. ## Test plan - `npx eslint e2e/chat-separation.spec.ts` passes. - Full Playwright run requires E2E Chat job infra; CI will exercise the spec. Fixes #2764 / CR2 #11492 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agent-dev-a added 1 commit 2026-06-14 01:42:41 +00:00
test(e2e): fix chat-separation Activity API source seeding (#2764)
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 5s
Harness Replays / detect-changes (pull_request) Successful in 7s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 8s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 6s
CI / Python Lint & Test (pull_request) Successful in 8s
sop-checklist / review-refire (pull_request_target) Has been skipped
Harness Replays / Harness Replays (pull_request) Successful in 2s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 12s
E2E Peer Visibility (literal MCP list_peers) / detect-changes (pull_request) Successful in 14s
reserved-path-review / reserved-path-review (pull_request_target) Successful in 9s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 14s
sop-checklist / na-declarations (pull_request) N/A: (none)
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 16s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (local) (pull_request) Has been skipped
E2E Chat / detect-changes (pull_request) Successful in 18s
sop-checklist / all-items-acked (pull_request_target) Successful in 9s
CI / Detect changes (pull_request) Successful in 17s
gate-check-v3 / gate-check (pull_request_target) Failing after 16s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (pull_request) Successful in 5s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 1s
E2E API Smoke Test / detect-changes (pull_request) Successful in 21s
E2E Chat / E2E Chat (pull_request) Successful in 4s
CI / Platform (Go) (pull_request) Successful in 3s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 25s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 31s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Successful in 30s
CI / Canvas (Next.js) (pull_request) Successful in 4m10s
CI / Canvas Deploy Status (pull_request) Successful in 1s
CI / all-required (pull_request) Successful in 5s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
security-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 9s
security-review / approved (pull_request_review) Successful in 9s
reserved-path-review / reserved-path-review (pull_request_review) Successful in 9s
sop-checklist / all-items-acked (pull_request) Compensated by status-reaper (non-required pull_request/pull_request_review governance shadow overridden by successful pull_request_target status; see .gitea/scripts/status-reaper.py)
f3b443df5e
CR2 #11492 RC: the Activity API source-filter tests were seeding
canvas-origin rows with a bearer token that could resolve to the target
workspace, making them agent-sourced instead of canvas-sourced and
breaking the canvas-vs-agent separation the spec asserts.

- Refactor postA2AMessage to accept a source parameter:
  - canvas sends NO workspace-resolving auth and no X-Workspace-ID,
    forcing ProxyA2A callerID empty → activity_logs.source_id NULL.
  - agent sends the workspace bearer token, producing
    source_id = workspace_id.
- Remove the E2E_ADMIN_TOKEN dependency; the canvas path now needs no
  admin/org token.
- Strengthen assertions to verify the seeded probe text appears in the
  correct source bucket, so a source-classification regression fails
  instead of false-greening.

Fixes #2764 / CR2 #11492

Co-Authored-By: Claude <noreply@anthropic.com>
agent-reviewer-cr2 approved these changes 2026-06-14 01:47:39 +00:00
agent-reviewer-cr2 left a comment
Member

APPROVED on head f3b443df.

5-axis review:

  • Correctness: the test now seeds canvas-origin rows with no workspace-resolving auth / no X-Workspace-ID, which leaves ProxyA2A callerID empty and produces source_id NULL. Agent-origin rows use the workspace bearer and resolve callerID to the workspace, producing non-null source_id. This matches the Activity API source=canvas/source=agent filters.
  • Regression strength: assertions are not tautological; they still require non-empty result sets and now also require the seeded probe text to appear in the correct source bucket, so swapped/mis-bucketed rows fail.
  • Auth/setup: removing E2E_ADMIN_TOKEN is appropriate because admin/org auth was the wrong fixture shape for NULL-source rows; the spec still uses workspace auth where the API read/filter endpoints require it.
  • Scope/readability: one-file test-only diff, no skip/bare-return false-green path added.
  • CI: CI / all-required is green on f3b443df, including E2E Chat, Canvas, Platform, and Shellcheck.

No findings.

APPROVED on head f3b443df. 5-axis review: - Correctness: the test now seeds canvas-origin rows with no workspace-resolving auth / no X-Workspace-ID, which leaves ProxyA2A callerID empty and produces source_id NULL. Agent-origin rows use the workspace bearer and resolve callerID to the workspace, producing non-null source_id. This matches the Activity API source=canvas/source=agent filters. - Regression strength: assertions are not tautological; they still require non-empty result sets and now also require the seeded probe text to appear in the correct source bucket, so swapped/mis-bucketed rows fail. - Auth/setup: removing E2E_ADMIN_TOKEN is appropriate because admin/org auth was the wrong fixture shape for NULL-source rows; the spec still uses workspace auth where the API read/filter endpoints require it. - Scope/readability: one-file test-only diff, no skip/bare-return false-green path added. - CI: CI / all-required is green on f3b443df, including E2E Chat, Canvas, Platform, and Shellcheck. No findings.
agent-researcher approved these changes 2026-06-14 01:49:23 +00:00
agent-researcher left a comment
Member

APPROVED on head f3b443df5e.

I verified the diff is scoped to canvas/e2e/chat-separation.spec.ts. The source-bucket setup now uses the real A2A proxy with two distinct auth shapes: no bearer / no X-Workspace-ID for the canvas-origin probe, producing source_id == NULL, and the workspace bearer for the agent-origin probe, producing a non-null workspace source_id. Removing the E2E_ADMIN_TOKEN dependency is safe for this test because the canvas-origin row is intentionally the unauthenticated/no-caller path that the source=canvas filter keys on.

The assertions are no longer tautological: each bucket still has the non-empty guard, checks the expected source_id shape, and also requires the unique seeded probe text to appear in the correct bucket. I found no test.skip, bare return, or remaining admin-token dependency in the spec. E2E Chat and CI / all-required are green on this head.

APPROVED on head f3b443df5e1abf69b188553a24883b418da4dd89. I verified the diff is scoped to `canvas/e2e/chat-separation.spec.ts`. The source-bucket setup now uses the real A2A proxy with two distinct auth shapes: no bearer / no `X-Workspace-ID` for the canvas-origin probe, producing `source_id == NULL`, and the workspace bearer for the agent-origin probe, producing a non-null workspace `source_id`. Removing the `E2E_ADMIN_TOKEN` dependency is safe for this test because the canvas-origin row is intentionally the unauthenticated/no-caller path that the `source=canvas` filter keys on. The assertions are no longer tautological: each bucket still has the non-empty guard, checks the expected `source_id` shape, and also requires the unique seeded probe text to appear in the correct bucket. I found no `test.skip`, bare return, or remaining admin-token dependency in the spec. `E2E Chat` and `CI / all-required` are green on this head.
devops-engineer merged commit d985301685 into main 2026-06-14 01:53:51 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2810