Skip to content

fix(e2e): stop the login page requesting linked servers and update the background-activity test - #453

Merged
chriswritescode-dev merged 1 commit into
mainfrom
fix/e2e-login-unauthorized-request
Oct 21, 2026
Merged

chriswritescode-dev merged 1 commit into
mainfrom
fix/e2e-login-unauthorized-request

Conversation

@chriswritescode-dev

@chriswritescode-dev chriswritescode-dev commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

The e2e suite never ran in CI: the workflow only starts when a PR carries the ready-for-ci label or is approved, and the label did not exist. With the label in place the suite failed in two places, both already broken on main.

Login page requested the linked server list (App.tsx, useSidebarServerSelection.ts)

  • useSidebarServerRouteSync ran in AppShell above AuthProvider and called useOpenCodeServers() unconditionally, so /login requested /api/opencode-servers, logged a 401, and the auth setup test failed.
  • It now runs from a SidebarServerRouteSync component inside the providers (same pattern as GlobalShortcuts) and loads the server list only once authenticated. The selected server still falls back to local when it is missing or disabled.

Outdated background-activity test (e2e/background-activity.spec.ts)

  • Since fix(activity): surface worktree sessions in active work, the sidebar and repo badges #438 a directory that hosts a running shell or a non-idle session stays subscribed, but the test waited for that directory to be unsubscribed after navigating away, so it timed out on every run.
  • Rewritten to assert the current behavior: the directory stays subscribed while its shell runs, and the indicator still clears after the shell exits while the user is elsewhere.

Validation

  • pnpm test:e2e:run --retries=0: 24 passed; the rewritten test passed 3 of 3 with --repeat-each=3
  • pnpm lint: 0 errors
  • pnpm typecheck: clean
  • pnpm test: 197 backend and 270 frontend test files passed
  • pnpm build: passes

Summary by CodeRabbit

  • Bug Fixes

    • Server synchronization now runs only for authenticated users, preventing unnecessary server loading for signed-out visitors.
    • Navigation and session transitions now correctly clear activity indicators without triggering unnecessary unsubscribe requests.
  • Tests

    • Expanded coverage for authenticated and unauthenticated server synchronization behavior.
    • Updated background activity tests to verify expected indicator and subscription behavior.

@chriswritescode-dev chriswritescode-dev added the ready-for-ci Trigger CI on a pull request label Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: ccbad9c1-898d-45ba-a3a7-ed1ad6a7d030
📥 Commits

Reviewing files that changed from the base of the PR and between 052f2bb and 884233d.

📒 Files selected for processing: 5
  • e2e/background-activity.spec.ts
  • frontend/src/App.tsx
  • frontend/src/components/navigation/LinkedServersNav.test.tsx
  • frontend/src/hooks/useSidebarServerSelection.test.tsx
  • frontend/src/hooks/useSidebarServerSelection.ts

Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The sidebar route-sync hook now gates server-list loading on authentication and runs from a dedicated component. The end-to-end test now checks directory unsubscribe requests during navigation and verifies that the activity indicator clears.

Changes: Sidebar Server Authentication

Layer / File(s) Summary
Authentication-gated route synchronization
frontend/src/hooks/useSidebarServerSelection.ts, frontend/src/App.tsx, frontend/src/hooks/useSidebarServerSelection.test.tsx, frontend/src/components/navigation/LinkedServersNav.test.tsx
The hook enables server-list loading only when the user is authenticated. AppShell mounts SidebarServerRouteSync as a separate component. Tests set authenticated defaults and verify that unauthenticated rendering disables server loading.

Directory Subscription Test

Layer / File(s) Summary
Directory subscription test flow
e2e/background-activity.spec.ts
The subscription helper matches /api/sse/subscribe. The test monitors unsubscribe requests during navigation and verifies that the activity indicator clears.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 88423

No verified merge-blocking risks remain in the supplied change scope.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description provides a clear summary, implementation details, affected behavior, and validation results. It omits the required Type of Change and Checklist sections from the repository template. Add the Type of Change section and select Bug fix. Add the Checklist section and mark each applicable item, including code style, TypeScript types, tests, lint, and typecheck.
Docstring Coverage Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies both main changes: preventing linked-server requests on the login page and updating the background-activity test.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chriswritescode-dev
chriswritescode-dev merged commit 959ed8c into main Oct 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ci Trigger CI on a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant