Files
Evan LohnandClaude Opus 5.5 0fe1f34bed fix: stop two Playwright test races (#16333)
## Description

This PR fixes two Playwright test races.

**Project files visual regression**
(`chat/project_files_visual_regression.spec.ts`)
- The test needed a retry in almost every CI run.
- `beforeAll` uploads the file through the API. The page loads about 2 s
later and fetches the project details once, while the file is still
`PROCESSING`.
- The projects provider polls `/file/statuses` only for files that the
page itself uploaded. So "Processing..." never changes.
- Fix: `beforeAll` now polls `POST /api/user/projects/file/statuses`
until the file is `COMPLETED`, before any page loads. The new helper is
`OnyxApiClient.waitForUserFilesCompleted`. It fails if a file ends in a
different status or does not finish in time.

**Group-manager fixture cleanup** (`admin/group-manager/fixtures.ts`)
- Teardown logged `cleanup: TypeError: groups.find is not a function`.
- Teardown started the deletion of four cc_pairs, then called
`setGroupCcPairs`. That call lists the groups. The list endpoint returns
500 while a linked connector is being deleted.
- `getGroupUserIds` did not check the response, so it called `.find` on
the error body.
- Fix: teardown now detaches the foreign group and the managed group
from their cc_pairs before it deletes the cc_pairs. `getGroupUserIds`
now goes through `handleResponse`, so a failure gives a clear error.

**Not fixed here:** the list endpoint itself is a separate product bug.
`ConnectorSnapshot.from_connector_db_model`
(`backend/ee/onyx/server/user_group/models.py`) raises `AttributeError`
when a group still links a cc_pair whose connector is deleted. One such
group makes `GET /manage/admin/user-group` fail for all groups.

## How Has This Been Tested?

- Pre-commit passed on the changed files (TypeScript type check and
coverage, oxlint, oxfmt).
- I did not run the specs locally. The local backend returned 500 on
login during the Playwright global setup, so the specs could not start.
CI runs both specs.

## Additional Options

- [ ] [Optional] Please cherry-pick this PR to the latest release
version.
- [x] [Optional] Override Linear Check

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes two Playwright test races that caused flaky CI runs.

Project files visual regression: the file uploaded through the API in
`beforeAll` was still `PROCESSING` when the page loaded, and the page
only polls files it uploaded itself, so it showed "Processing..."
forever. `beforeAll` now waits on the file status endpoint until the
file is `COMPLETED` via the new
`OnyxApiClient.waitForUserFilesCompleted`.

Group-manager fixture teardown: `getGroupUserIds` called `.find` on a
500 error body, logging `groups.find is not a function`. Teardown now
detaches groups from their cc_pairs before deleting the cc_pairs, and
`getGroupUserIds` goes through `handleResponse` so failures surface
clearly.

The 500 from `GET /manage/admin/user-group` while a linked connector is
being deleted is a separate backend bug not fixed here.

<sup>Written for commit 388bad8179.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/onyx-dot-app/onyx/pull/16333?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/onyx-dot-app/onyx/16333?returnTo=https%3A%2F%2Fgithub.com%2Fonyx-dot-app%2Fonyx%2Fpull%2F16333&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **Tests**
- Improved visual regression test reliability by validating uploads and
waiting for files to finish processing before execution.
- Added clearer handling and reporting for file-processing failures and
timeouts.
- Improved test cleanup to fully remove group and connector
associations.
  - Strengthened API response validation used by automated tests.
  - Updated testing documentation for file-processing utilities.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:25:57 +00:00
..