Skip to content

Point the remote-connection contract test at the current call sites - #8429

Closed
danielhanchen wants to merge 1 commit into
mainfrom
fix-remote-connection-contract-test
Closed

danielhanchen wants to merge 1 commit into
mainfrom
fix-remote-connection-contract-test

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

tests/studio/test_remote_connection_models_contract.py has two static assertions that grep the frontend for literals #8299 refactored away, so Repo tests (CPU) has been red on main for every PR since:

FAILED test_frontend_sync_backfills_local_models_to_backend
  assert 'Promise.allSettled(backfillTasks)' in ...
FAILED test_chat_page_hydrates_connections_on_startup
  assert 'syncExternalProvidersFromBackend' in ...

Both behaviours are intact, only their call sites moved:

  • sync-external-providers.ts now calls settleTasksIfCurrent(backfillTasks, isCurrent), which is the same Promise.allSettled plus a check that the auth session has not moved on.
  • startup hydration left chat-page.tsx for features/credentials/bootstrap.ts, which app/routes/__root.tsx runs before releasing content.

This retargets the assertions without weakening them: the backfill still has to be settled, the bootstrap still has to sync providers from the backend, and the root still has to invoke it. Deleting the settleTasksIfCurrent(backfillTasks, isCurrent) line still turns the first test red, so it keeps its teeth.

Test only, no product code touched. python -m pytest tests/studio/test_remote_connection_models_contract.py -q gives 7 passed.

#8299 replaced the inline Promise.allSettled(backfillTasks) with
settleTasksIfCurrent and moved startup provider hydration off the chat
page into the credential bootstrap the app root runs, so the two static
assertions grepping for the old literals have been failing on main for
every PR since. Retarget them without weakening the contract: the
backfill still has to be settled, and the bootstrap still has to sync
providers from the backend and be invoked at the root.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c5610b250

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

assert "syncExternalProvidersFromBackend" in source
assert "await hydratePersistedSettings()" in source
assert "runCredentialBootstrap" in source
assert "bootstrapPersistedCredentials" in APP_ROOT.read_text(encoding = "utf-8")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert bootstrap completion before releasing app content

When the root starts the bootstrap but releases content immediately—for example, by setting ready without waiting for the returned promise—this test still passes because it only checks that the identifier occurs somewhere in each file. That misses the startup-ordering behavior this contract is meant to preserve; verify that the root gate waits for bootstrapPersistedCredentials() to settle before rendering its children, or cover the gate with a behavioral test.

Useful? React with 👍 / 👎.

assert "Promise.allSettled(backfillTasks)" in source
# settleTasksIfCurrent is the Promise.allSettled this used to inline (#8299); it
# additionally drops the writes when the auth session has moved on.
assert "settleTasksIfCurrent(backfillTasks" in source

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve all-settled coverage for backfill failures

When one updateProviderConfig task rejects, replacing the helper's Promise.allSettled with Promise.all would make syncExternalProvidersFromBackend reject and cause runCredentialBootstrap to discard the otherwise valid provider hydration, yet this assertion would remain green because it checks only the helper call's name. The helper's existing test covers whether tasks launch for a current session but not rejection handling, so retain a check for Promise.allSettled in the helper or add a behavioral test proving that a rejected backfill does not reject the sync.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member Author

Closing this as superseded: main already carries the same change, in a strictly broader form.

tests/studio/test_remote_connection_models_contract.py was rewritten on main by #8506 ("Clear the four main CI reds blocking every open PR"). Main's version does everything this PR does and two things more:

this PR main
backfill assertion pins settleTasksIfCurrent(backfillTasks at the call site that, plus opens features/credentials/reconciliation.ts and checks the helper still allSettleds
hydration drops the CHAT_PAGE constant entirely keeps hydratePersistedSettings() pinned on the chat page, and reads features/credentials/bootstrap.ts + app/routes/__root.tsx

The only line unique to this branch is assert "runCredentialBootstrap" in source. Main pins the outer bootstrapPersistedCredentials instead, which is what the root route actually calls.

Checked rather than assumed: resolving the conflict by taking main's side (the only correct resolution, since main's is the superset) and diffing the result against origin/main produces zero lines. So resolving this "properly" yields an empty PR, and resolving it any other way means reintroducing the narrower assertions and deleting main's chat-page guarantee.

Nothing pushed to this branch. Reopenable if I have misread which side won.

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