Skip to content

test(ui): fix the flaky connection-chooser smoke test - #833

Merged
giswqs merged 1 commit into
mainfrom
test/remembered-db-chooser-flake
Oct 24, 2026
Merged

giswqs merged 1 commit into
mainfrom
test/remembered-db-chooser-flake

Conversation

@giswqs

@giswqs giswqs commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

remembered_database_chooser_cancel_selection_and_project_scope fails now and then (main CI run for #814, and a PR run earlier today): the chooser dialog never opens (left: None, right: Some("chooseConnection")).

Cause: the smoke tests run in one process, and the DuckDB driver remembers passwords per address process-wide (crates/data/src/source/duckdb.rs PASSWORDS). Every test in remembered_database/mod.rs uses the same address, so a password another test leaves there can let the project's database resolve without asking which saved connection to use.

Evidence: under CPU load locally, the full smoke suite failed this test 1 in 72 runs; the test alone under the same load passed 120 of 120. With its own database address, the full suite passed 144 of 144.

The fix gives this test its own address; test only.

Summary by CodeRabbit

  • Tests
    • Improved the reliability of project-opening checks by keeping saved connection settings from separate test scenarios isolated. This helps ensure each scenario is evaluated independently, without changes in one test affecting the results of another.

The smoke tests share one process, and passwords typed for an address
are remembered process-wide. Another test leaving one for the shared
address made the project open without the chooser now and then (main
CI, and 1 in 72 runs here under load; 0 in 144 with this change).
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ee755a06-2da1-4edb-831c-9bb7f9d8c7dd
Commits

Reviewing files that changed from the base of the PR and between bb244b8 and ac968ee.

Files selected for processing: 1
  • crates/ui-egui/tests/remembered_database/mod.rs

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

Walkthrough

The chooser test now uses a distinct PostgreSQL address, ui_remembered_chooser, and documents that the address isolates it from remembered passwords shared with other tests.

Changes: Chooser test isolation

Layer / File(s) Summary
Isolate the chooser test address
crates/ui-egui/tests/remembered_database/mod.rs
The test uses ui_remembered_chooser instead of ui_remembered. A comment explains that remembered passwords are shared process-wide and that the unique address prevents other tests from affecting project-open selection.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Possibly related PRs

  • opengeos/RustGIS#777: This PR introduced the remembered database credential behavior and chooser test that this change isolates.

Suggested reviewers: deniial00

Merge Risk: Minimal · up to ac968

The test isolation change is mergeable with no identified production or workflow risk.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the flaky UI connection-chooser smoke test fix.
Description check Passed The description explains the failure, root cause, fix, and test results. It does not use the template headings or provide a related issue, but it contains the critical summary and testing information.
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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the chooser’s place
A fresh address keeps tests apart
No saved password skips the race
The project opens as tests intend
Then hops away, content and pleased

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

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found nothing that needs changing. The PR is a test-only change: remembered_database_chooser_cancel_selection_and_project_scope gets its own function-local ADDRESS (dbname=ui_remembered_chooser).

I checked the following by reading crates/ui-egui/tests/remembered_database/mod.rs. I did not build the crate or run the tests.

  • Shadowing is legal and scoped. The local const shadows the module-level ADDRESS (line 23) only inside this function. Every use in it (seeding connections, the project's PostGIS source, database_key, the selection assertions) now sees the new address.
  • The other tests keep the shared address. The checkbox test, the failed-store test and the "No leak" test (line 228) still use the shared address. The new address is used only by this test, so passwords it leaves behind can't reach the other tests, and theirs can't reach it.
  • The fix matches the stated cause. The PR says the DuckDB driver remembers passwords per address across the whole process. A distinct address avoids that shared state, which is consistent with the 144/144 full-suite result in the description. I didn't re-check the PASSWORDS code in duckdb.rs.
  • AGENTS.md. The change is test-only, so none of its rules are affected. It adds no unwrap to non-test code, no dependency, no asset and no wasm or layering impact. The new unwrap() calls are in test code, which the rule allows.

Nits (low confidence, optional)

  • Same name as the module const (line 88). The local const has the same name as the module-level one, so a reader could mistake it for the shared address. A distinct name such as CHOOSER_ADDRESS would make the isolation obvious. This is style only.
  • Other tests in the module. The first three tests still share one address, so one of them could hit the same cross-test leak if a later test relies on "no remembered password". That isn't a problem today.

Change size

Compared: the whole PR against main (merge base bb244b8 to PR head ac968ee).

Metric Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 11.7 KB
Size after 12.0 KB
Total size change +307 B
File Before After Change
crates/ui-egui/tests/remembered_database/mod.rs 11.7 KB 12.0 KB +307 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-833/
Web app https://preview.rustgis.app/pr-833/app/
Commit ac968ee

GitHub Pages takes a minute or two to publish a new commit.

@giswqs
giswqs merged commit bc5218c into main Oct 24, 2026
18 checks passed
@giswqs
giswqs deleted the test/remembered-db-chooser-flake branch October 24, 2026 16:36
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