Skip to content

fix: preserve null guards after ESLint migration - #1240

Closed
neubig wants to merge 1 commit into
mainfrom
fix/eslint-null-guard-regressions
Closed

neubig wants to merge 1 commit into
mainfrom
fix/eslint-null-guard-regressions

Conversation

@neubig

@neubig neubig commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

HUMAN:

Awaiting human review and testing.

  • A human has tested these changes.

AGENT:


Why

The ESLint migration in #8 rewrote explicit null guards into optional-chain comparisons. When both sides are undefined, the comparison succeeds even though the guarded object is null.

The reported signup-attribution failure has already been fixed by #1236. This PR preserves that fix and adds direct regression coverage, plus fixes the remaining analogous suspension guard. The suspension test intentionally supplies an undefined selection (outside the store's normal string/null state); this is defensive coverage, not proof of Beta's production root cause.

Summary

- if (suspension?.orgId === selectedOrganizationId)
+ if (suspension != null && suspension.orgId === selectedOrganizationId)
  • Require a suspension object before comparing IDs and dereferencing it. Suppress the optional-chain autofix only for this comparison, with its rationale.
  • Exercise the real MainApp rendering path with no suspension and an undefined selection, using the existing test harness.
  • Exercise rememberCloudEntry directly with no redirect or location origin and verify that handoff attribution survives. Only browser location is stubbed to reproduce the failing environment; neither regression mocks the logic under test.

Issue Number

Follow-up to #8 and #1236.

How to Test

From frontend/:

  • npx vitest run __tests__/utils/signup-attribution.test.ts __tests__/routes/root-layout.test.tsx __tests__/routes/accept-tos.test.tsx --maxWorkers=2 — 47 tests pass on Node 24.
  • Both new regressions were verified failing against the corresponding unsafe code. Root-layout fails on current main before this patch; the signup test fails when restoring the chore(deps-dev): bump the eslint group across 1 directory with 7 updates #8 implementation, and passes with fix: null redirect URL crash in signup attribution #1236.
  • npm run lint:fix, npm run lint (including typecheck), and npm run build pass. Lint reports 15 existing warnings, no errors.
  • Repository pre-commit checks, including mypy, pass.
  • Full frontend suite is not green/complete locally: the Node 26 attempt encountered storage-related failures. A Node 24 rerun encountered failures/timeouts in LLM settings, Git settings, user context menu, and MCP settings, then was stopped on the heavily loaded host. These failures were outside the changed paths; no claim is made that they were independently reproduced on main. CI should provide the broader result.

Video/Screenshots

N/A: null-guard and regression-test changes; no visual design change. Beta was not independently reproduced.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

No branch-protection changes, dependency changes, or Mermaid/OpenHands changes.

This PR was created by an AI agent (OpenHands) on behalf of Graham Neubig.


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-0826d1d

Guard the suspension lookup before comparing organization IDs and add regression coverage for the signup attribution crash fixed in #1236.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions github-actions Bot added the type: fix A bug fix label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Coverage report

This PR does not seem to contain any modification to coverable code.

@neubig

neubig commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Incident reassessment and Enterprise QA — PARTIAL

This PR does not fix the reported Beta blank-screen outage. The updated incident thread identifies OpenHands/OpenHands#19199 (React Router 8 basename /canvas/) as the cause, fixed by OpenHands/OpenHands#19406. Enterprise#8 separately introduced the signup unit-test failure, already fixed by #1236. This PR only addresses the remaining latent suspension guard and adds regression coverage.

Real Enterprise preview evidence

Created isolated OpenHands/saas-deploy#2056 (draft, feature, DO NOT MERGE) at https://pr-2056.staging.all-hands.dev using the established feature-preview method. Baseline: Enterprise sha-c6191be, Canvas 1.36.0. No API mocks or client-state injection were used.

Actual baseline request Observed result
/canvas HTTP 200, blank body, router basename warning
/canvas?qa=before-after#qa HTTP 200, blank body, same warning
/canvas/ Real login page; returnTo=/canvas/
/canvas/automations Real login page; deep link retained in returnTo
Exact runtime warning and blocked after-test
<Router basename="/canvas/"> is not able to match the URL "/canvas" because it does not start with the basename, so the <Router> won't render anything.

The identical Playwright probe used fresh browser contexts at 1440×960 and captured body text, final URL, screenshots, page errors, and console warnings after 10 seconds.

A second preview commit changes only Canvas to sha-bf6d37f (#19406), keeping Enterprise unchanged. However, the preview still serves baseline entry.client-CMYq77B1.js; the after rollout has not been verified. Seeded member login via the preview's direct Keycloak endpoint is rejected with Invalid username or password. Local GKE credentials require reauthentication, preventing inspection of seed/sync status. No credentials, cookies, or tokens were captured in evidence.

Current Beta independently redirects the same logged-out paths to a working login page with no page errors. That is a cross-environment observation, not a controlled before/after comparison or validation of #1240.

Local evidence: .agent_tmp/enterprise-qa/baseline-backend-ready/{bare,slash,query,deep}.png and results.json; current-Beta evidence under .agent_tmp/enterprise-qa/beta-current/. Media was not uploaded to an unrelated repository.

Verdict

This comment was created by an AI agent (OpenHands) on behalf of Graham Neubig.

@neubig

neubig commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Enterprise QA follow-up after access refresh

Confirmed: controlled logged-out before/after for the actual incident fix (#19406). Still partial: authenticated base/head runtime sign-off for this PR (#1240).

Same isolated preview (saas-deploy#2056), Enterprise sha-c6191be held constant:

URL Canvas 1.36.0 Canvas sha-bf6d37f (#19406)
/canvas Blank; basename warning Login page; returnTo /canvas/
/canvas?qa=before-after#qa Blank; basename warning Login page; query/hash retained in returnTo
/canvas/ Login page Login page
/canvas/automations Login page; destination retained Same

Confirmed actual fixed Deployment image and served entry changed from entry.client-CMYq77B1.js to entry.client-C7puAURF.js. No API mocks or forced store state. No page errors in the controlled logged-out comparison; expected unauthenticated 401 requests occur.

Authenticated checks and remaining limitations

The seed job completed. Registered preview username/password differed from the deployed seed; using the isolated preview's seeded credentials in memory enabled real Keycloak login. On Enterprise base + fixed Canvas, login landed on /canvas/?login_method=github, rendered the home page, and /api/v1/users/me returned 200. PR-head + fixed Canvas also successfully rendered login landing, /canvas, and /canvas/, with /me 200.

However, later query/settings/deep-link checks and repeat runs stalled or rendered blank, including on baseline controls. The baseline rerun also timed out on /me. This is not a clean authenticated comparison and not evidence that #1240 fixes a naturally occurring crash. Preview API responses included meta-profiles 404, Jira-link 404, and automation 502. The seed log also reports org-bound-key delivery create-failed (not needed for member browser login).

Executed browser probes:

node .agent_tmp/enterprise-qa/capture.mjs https://pr-2056.staging.all-hands.dev canvas-after
python .agent_tmp/enterprise-qa/run-seeded-login.py enterprise-base-canvas-after
python .agent_tmp/enterprise-qa/run-seeded-login.py enterprise-base-canvas-before
python .agent_tmp/enterprise-qa/run-seeded-login.py enterprise-head-canvas-after

Local visual report: .agent_tmp/enterprise-qa/report.html. Controlled screenshots: baseline-backend-ready/bare.png and canvas-after/bare.png. Successful authenticated base landing: enterprise-base-canvas-after/login-landing.png. No evidence media was uploaded to an unrelated repo.

Conclusion: the Slack thread's corrected routing diagnosis is verified on a real Enterprise deployment. #1240 remains a separate defensive guard change, not the outage fix, and should remain draft pending reliable authenticated QA. Current temporary preview runs Enterprise sha-0826d1d + Canvas sha-bf6d37f; deployment PR is unmerged.

This comment was created by an AI agent (OpenHands) on behalf of Graham Neubig.

@neubig

neubig commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

Closing: this PR does not fix the reported Beta incident, and no real user-facing failure was demonstrated for the defensive guard change. The actual routing fix is OpenHands/OpenHands#19406; the Enterprise test regression was fixed by #1236. OpenHands/OpenHands#19426 and #19428 address test reliability and regression coverage. Closing at Graham Neubig’s request rather than pursuing an artificially injected edge case.

This comment was created by an AI agent (OpenHands) on behalf of Graham Neubig.

@neubig neubig closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants