Skip to content

test(e2e): reuse data-mode boundary helper#397

Merged
DeliciousBuding merged 1 commit into
dev/delicious233from
task/380-data-mode-boundary-helper
Jun 28, 2026
Merged

test(e2e): reuse data-mode boundary helper#397
DeliciousBuding merged 1 commit into
dev/delicious233from
task/380-data-mode-boundary-helper

Conversation

@DeliciousBuding

@DeliciousBuding DeliciousBuding commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Task Issue

closes #380

S.U.P.E.R Review

  • U: request phase and backend-boundary decisions flow through one shared helper instead of per-spec switch logic.
  • P: Playwright specs keep only surface-specific route fulfillment/stub data.
  • R: Web task contract now guards all requests, so Local Edge direct calls are caught instead of being invisible to a Hub-only route.

Tests

  • corepack pnpm --dir app install --frozen-lockfile
  • corepack pnpm --dir app/shared exec vitest run src/testing/e2eDataModeContract.test.ts (8 passed)
  • corepack pnpm --dir app/web typecheck
  • corepack pnpm --dir app/desktop typecheck
  • corepack pnpm --dir app/desktop test:e2e:chat-flow (4 passed)
  • corepack pnpm --dir app/web test:e2e:stubbed-hub (8 passed)
  • pwsh ./scripts/verify/verify-real-e2e-contract.ps1
  • pwsh ./scripts/verify/verify-doc-ssot.ps1
  • pwsh ./scripts/verify/verify-project-skills.ps1
  • pwsh ./scripts/verify/verify-ci-gates.ps1
  • python -c "import yaml, pathlib; yaml.safe_load(pathlib.Path('api/openapi.yaml').read_text(encoding='utf-8')); print('yaml ok')"
  • git diff --check (passed; Windows LF/CRLF warnings only)

Evidence Boundary

  • Evidence levels: fixture-unit, playwright-ui, stubbed-hub.
  • real_tested=false: no real TokenDance ID login, real Hub backend, real CLI/model/API spend, packaged Desktop, signing, production deploy, release upload, or installer validation was run.
  • Desktop coverage is Vite renderer Playwright, not packaged Tauri sidecar/sqlite/icon proof.

Project Governance

  • Instruction surfaces: unchanged.
  • Progress surface: docs/progress/MASTER.md updated.
  • Memory surface: unchanged.

Summary by CodeRabbit

  • Tests

    • Improved end-to-end request handling in desktop and web flows for more consistent browser behavior.
    • Added better handling for blocked, forbidden, and external requests, including clearer failure filtering and diagnostics.
    • Expanded contract coverage for request routing decisions and recording behavior.
  • Documentation

    • Updated project progress tracking to reflect completed and in-progress milestones, along with the next validation steps.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b333be87-8870-4028-a015-933c9f7458c0

📥 Commits

Reviewing files that changed from the base of the PR and between 0f0baac and 589273e.

📒 Files selected for processing (7)
  • app/desktop/src/__e2e__/chat-flow-ui.spec.ts
  • app/shared/src/testing/e2eDataModeContract.test.ts
  • app/shared/src/testing/e2eDataModeContract.ts
  • app/web/src/__e2e__/chat-flow-contract.spec.ts
  • app/web/src/__e2e__/task-contract.spec.ts
  • app/web/src/__e2e__/web-stubbed-hub-replay-smoke.spec.ts
  • docs/progress/MASTER.md

📝 Walkthrough

Walkthrough

Introduces E2ERequestAction, E2ERequestDecision, and resolveE2ERequestDecision in the shared e2e contract module, then migrates all Playwright page.route handlers across desktop and web e2e specs from classifyE2ERequest to the new decision-driven API. Progress documentation is updated to reflect T1.3 status.

Changes

E2E Request Decision Contract and Route Handler Migration

Layer / File(s) Summary
E2ERequestDecision contract and resolver
app/shared/src/testing/e2eDataModeContract.ts
Adds E2ERequestAction union type, E2ERequestDecision interface (with action, shouldRecord, allowed, boundary, phase), resolveE2ERequestDecision function, and internal isKnownBackendBoundary helper.
Contract unit tests
app/shared/src/testing/e2eDataModeContract.test.ts
Updates existing preflight/runtime and forbidden-boundary assertions to use resolveE2ERequestDecision; adds a new test covering continue, fulfill-scenario-backend, and abort-external-http actions.
Desktop chat-flow-ui route handler
app/desktop/src/__e2e__/chat-flow-ui.spec.ts
Replaces classifyE2ERequest with resolveE2ERequestDecision; branches page.route handler on decision.action for continue, conditional recording, fulfill, block, and abort paths.
Web chat-flow-contract route handler
app/web/src/__e2e__/chat-flow-contract.spec.ts
Replaces classifyE2ERequest with resolveE2ERequestDecision in the hub stub's **/* handler; adds block-forbidden-backend 503 fulfillment, abort fallback, and requestfailed diagnostic filtering.
Web task-contract route handler
app/web/src/__e2e__/task-contract.spec.ts
Broadens interception from fixed hub origin to **/* with decision-driven branching; refactors CORS headers into a shared corsHeaders() helper.
Web hub-replay-smoke route handler
app/web/src/__e2e__/web-stubbed-hub-replay-smoke.spec.ts
Migrates installHubStub to resolveE2ERequestDecision; updates requestfailed diagnostics with isExpectedRequestFailure; adds block and abort fallback branches.
Progress docs
docs/progress/MASTER.md
Reflects T1.2 closure, T1.3 as active task, updated milestone counts, next steps, and session log entry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 A boundary helper now shared far and wide,
No more scattered checks on every side.
"continue", "block", or "abort" — the decision is clear,
Each route knows its fate without doubt or fear.
The rabbit hops through phases, preflight to runtime,
And every forbidden edge gets a 503 in time! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title concisely reflects the main change: reusing a shared E2E boundary helper.
Linked Issues check ✅ Passed The PR adds and reuses a shared phase-aware request decision helper, with tests covering the required acceptance gates and scenarios.
Out of Scope Changes check ✅ Passed The changes stay focused on the shared E2E boundary helper, affected Playwright assertions, and the documented progress update.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/380-data-mode-boundary-helper

Comment @coderabbitai help to get the list of available commands.

@DeliciousBuding DeliciousBuding merged commit c471d68 into dev/delicious233 Jun 28, 2026
17 checks passed
@DeliciousBuding DeliciousBuding deleted the task/380-data-mode-boundary-helper branch June 28, 2026 09:54
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