Skip to content

Try sharedscreen (Trick to run CI?) - #56

Closed
evnchn wants to merge 10 commits into
DONOTMERGEfrom
try-sharedscreen
Closed

evnchn wants to merge 10 commits into
DONOTMERGEfrom
try-sharedscreen

Conversation

@evnchn

@evnchn evnchn commented Feb 6, 2026

Copy link
Copy Markdown
Owner

Motivation

Implementation

Progress

  • I chose a meaningful title that completes the sentence: "If applied, this PR will..."
  • The implementation is complete.
  • If this PR addresses a security issue, it has been coordinated via the security advisory process.
  • Pytests have been added (or are not necessary).
  • Documentation has been added (or is not necessary).

@evnchn

evnchn commented Feb 6, 2026

Copy link
Copy Markdown
Owner Author

I think this memory-leaks and so the CI always gets stuck at a random (passing) test.

@evnchn

evnchn commented Feb 7, 2026 •

Copy link
Copy Markdown
Owner Author

Hmm. Sadly it is not that faster though. (maybe it will faster when all tests pass)

- Fix pylint/ruff global-statement warnings with proper noqa/disable comments
- Preserve middleware during reset (fixes cache-control header test)
- Reset script_mode to prevent pollution of User fixture tests
- Revert test_unocss to Screen fixture (unocss config is set at server start)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@evnchn

evnchn commented Feb 7, 2026

Copy link
Copy Markdown
Owner Author

Appears to shave 2 minutes only.

evnchn and others added 8 commits February 8, 2026 19:02
…d Chrome (zauberzeug#5740)

### Motivation

The `ubuntu-latest` runner image already ships with matched Chrome and
ChromeDriver versions ([runner-images
manifest](https://github.com/actions/runner-images/blob/ubuntu24/20260201.15/images/ubuntu/Ubuntu2404-Readme.md)).
The third-party `nanasess/[email protected]` action is redundant
and introduces a point of fragility: when Chrome auto-updates on the
runner image, the action may install a mismatched or conflicting
ChromeDriver version, causing test failures unrelated to any code
change.

This issue materialized on Feb 8, 2026, when Chrome auto-updated from
`144.0.7559.96` to `144.0.7559.109` on the runner image. The update
caused 4 test failures and 1 error across multiple unrelated PRs:

| Test | Error |
|------|-------|
| `test_page::test_exception` | `AssertionError: Could not find "500"` |
| `test_select::test_add_new_values[add-False-True]` | `IndexError: pop
from empty list` |
| `test_select::test_add_new_values[add-True-True]` | `IndexError: pop
from empty list` |
| `test_storage::test_missing_storage_secret` | `IndexError: pop from
empty list` |
| `test_page::test_exception_after_connected` | JS `RangeError: Maximum
call stack size exceeded` |

These failures appeared identically on two completely unrelated PRs
([#68](#68),
[#71](#71)), confirming they
are environment-caused, not code-caused. Upstream last ran CI on Feb 5
with Chrome `.96` (passing); the next CI run will encounter the same
failures.

### Implementation

Remove the `nanasess/[email protected]` step from
`.github/workflows/_test.yml`. The runner image's preinstalled Chrome
and ChromeDriver are used instead.

This is the most maintainable approach because:
- The runner image always ships a matched Chrome + ChromeDriver pair
- If the preinstalled Chrome breaks, it affects the entire GitHub
Actions ecosystem, guaranteeing rapid upstream fixes from
GitHub/Microsoft
- No third-party action to maintain, audit, or pin versions for
- One fewer network fetch during CI (the action downloads ChromeDriver
on every run)

### Alternatives explored

Five approaches were tested on
[evnchn/nicegui](https://github.com/evnchn/nicegui) to triangulate the
root cause and find the best fix:

| PR | Approach | Result | Trade-off |
|----|----------|--------|-----------|
| [#72](#72) | Pin
Chrome+ChromeDriver to `.96` via `browser-actions/setup-chrome@v2` |
**All 769 tests pass** | Requires manual version bumps; masks Chrome
regressions |
| [#73](#73) | Pin ChromeDriver
only to `.96` via `nanasess` with `chromedriver-version` | **All 769
tests pass** | Same pinning burden; still depends on third-party action
|
| [#74](#74) | ARM64 runner
(`ubuntu-24.04-arm`) + Chromium via apt | **3 failures**, 769 passed |
8% slower pytest (24m06s vs 22m18s), +93s Chromium install overhead, new
platform-specific test failures (`test_upload` file path bug,
`test_xterm` terminal size mismatch) |
| [#75](#75) | Remove `nanasess`,
use preinstalled Chrome | **All 769 tests pass** | **This approach** —
zero maintenance, zero overhead |

### Timing comparison (PR #75 vs PR #74)

| | PR #75 x86_64 (this approach) | PR #74 ARM64 |
|---|---|---|
| Chrome install | 0s (preinstalled) | 93s (apt-get) |
| pytest duration | 22m 18s | 24m 06s |
| Total job wall-clock | 22m 30s | 25m 56s |
| Test result | **769 passed** | 3 failed, 769 passed |

### Root cause analysis

- Chrome auto-updated from `144.0.7559.96` to `144.0.7559.109` between
Feb 6 and Feb 8 on the `ubuntu-latest` runner image
- All Python dependencies are identical across passing and failing runs
(`selenium==4.40.0`, `cpython-3.10.19`)
- Chromium commit log between `.97` and `.110` contains only
Chrome-internal changes (contextual tasks UI, i18n, Android GPU, sandbox
policy, translation, PDF, PKI metadata) — no V8, CSS, WebDriver, or
networking changes
- The behavioral regression in `.109` is likely in a rolled dependency
(via DEPS) rather than a direct Chromium commit
- Removing `nanasess` resolves the issue because the runner image's
preinstalled Chrome `.109` and its matched ChromeDriver work correctly
together — the problem was the version mismatch introduced by the action

### Progress

- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] If this PR addresses a security issue, it has been coordinated via
the [security
advisory](https://github.com/zauberzeug/nicegui/security/advisories/new)
process.
- [x] Pytests have been added (or are not necessary).
- [x] Documentation has been added (or is not necessary).

Co-authored-by: Claude Opus 4.6 <[email protected]>
### Motivation

The `sqlite_database` example breaks with Tortoise ORM 1.0:

```
RuntimeError: No TortoiseContext is currently active.
Use 'async with TortoiseContext() as ctx:' to create one, or call Tortoise.init() for global state.
```

Tortoise ORM 1.0 replaced global state with a `ContextVar`-based
architecture. Since NiceGUI runs async `on_startup` handlers as
background tasks (via `safe_invoke` / `background_tasks.create`), the
`ContextVar` set by `Tortoise.init()` in the startup task never
propagates to request handler tasks.

Additionally, `aiosqlite` was pinned to 0.21.0 to work around
[tortoise/tortoise-orm#2037](tortoise/tortoise-orm#2037),
and the example was skipped in CI for Python 3.11/3.12 due to
[omnilib/aiosqlite#241](omnilib/aiosqlite#241).
Both issues are resolved in Tortoise ORM 1.0.

### Implementation

Replace the manual `Tortoise.init()` / `close_connections()` /
`on_startup` / `on_shutdown` boilerplate with `register_tortoise()` from
`tortoise.contrib.fastapi`. Since NiceGUI's `app` is a FastAPI subclass,
this hooks directly into the app's lifespan and uses
`_enable_global_fallback=True` internally, making the Tortoise context
available across all async tasks.

This also removes the `aiosqlite` pin and the CI skip for Python
3.11/3.12.

### Progress

- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] This is not a security issue.
- [x] Pytests have been added (or are not necessary).
- [x] Documentation has been added (or is not necessary).
)

### Motivation

Sponsor images on the main page were passed as local file `Path` objects
to `ui.interactive_image()`, causing
NiceGUI to serve them via auto-generated paths like
`/_nicegui/auto/static/<hash>/lechler-gmbh.webp`. This had two
  problems:

1. **Broken images across server instances:** The hash in the auto path
is instance-specific. Since nicegui.io
runs multiple server instances, a client could receive HTML from one
instance but have the image request routed to
another instance where that hash doesn't exist, causing the image to
fail to load.

2. **Poor caching / Lighthouse score:** The auto path bypasses the
`DocsSetCacheControlMiddleware` that sets cache
headers for `/static/` paths. Using the static URL ensures sponsor
images are strongly cached.

### Implementation

Use the URL path `/static/sponsors/...` (served by
`app.add_static_files`) instead of local file `Path` objects.
The local path is still used for the `exists()` check to decide between
single vs light/dark image variants.

### Progress

- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] If this PR addresses a security issue, it has been coordinated via
the [security

advisory](https://github.com/zauberzeug/nicegui/security/advisories/new)
process.
- [x] Pytests have been added (or are not necessary).
- [x] Documentation has been added (or is not necessary).

Co-authored-by: Claude Opus 4.6 <[email protected]>
…eug#5729)

### Motivation

Starting a new Chrome browser for each test using the `Screen` fixture
is slow. By reusing the same browser session across all tests, we can
significantly reduce test execution time.

### Implementation

- Made `nicegui_driver` and `nicegui_chrome_options` fixtures
session-scoped so the browser is started once and reused
- Added `_reset_browser_state()` helper to clean up browser state
between tests (closes extra tabs, navigates to about:blank, clears
browser logs)
- Updated `Screen.close()` to navigate to about:blank instead of closing
the last tab, which would invalidate the session-scoped driver
- Consolidated `capabilities` fixture into `nicegui_chrome_options`
(moved logging prefs to `set_capability()`)

### Progress

- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] If this PR addresses a security issue, it has been coordinated via
the [security
advisory](https://github.com/zauberzeug/nicegui/security/advisories/new)
process.
- [x] Pytests are not necessary.
- [x] Documentation is not necessary.

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

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: Falko Schindler <[email protected]>
### Motivation

The bundled Mermaid 11.12.0 includes `dagre-d3-es` 7.0.9, which is
affected by a prototype pollution vulnerability (CVE-2025-57347). This
was reported privately by @henriknoren via GHSA-mp6h-mc3x-8v69. But
since it is in an upstream dependency, not in NiceGUI itself, and is
already public knowledge, we decided to fix it in a public PR rather
than a GHSA.

### Implementation

Bump `mermaid` from 11.12.0 to 11.12.2 and rebuild the bundle.

### Progress

- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] Since this PR addresses a security issue, it has been coordinated
via the [security
advisory](https://github.com/zauberzeug/nicegui/security/advisories/new)
process.
- [x] Pytests have been added (or are not necessary).
- [x] Documentation has been added (or is not necessary).
### Motivation

Claude Code doesn't read `AGENTS.md` natively — it only loads
`CLAUDE.md` on startup. Two earlier PRs explored ways to bridge this
gap:

- **zauberzeug#5720** — symlink (`ln -s AGENTS.md CLAUDE.md`) — closed because
symlinks [break on
Windows](zauberzeug#5720 (comment))
- **zauberzeug#5722** — full copy with pre-commit sync hook — works but duplicates
the entire file and adds a Python hook

Inspired by [this
recommendation](anthropics/claude-code#6235 (comment)).

### Implementation

A minimal `CLAUDE.md` containing just `@AGENTS.md`. Claude Code's native
`@file` directive inlines the referenced file into the system prompt at
session start. This keeps `AGENTS.md` as the single source of truth — no
duplication, no sync hooks, no symlinks. Works cross-platform.

Supersedes zauberzeug#5720 and zauberzeug#5722.

### Progress

- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] If this PR addresses a security issue, it has been coordinated via
the [security
advisory](https://github.com/zauberzeug/nicegui/security/advisories/new)
process.
- [x] Pytests have been added (or are not necessary).
- [x] Documentation has been added (or is not necessary).

Co-authored-by: Claude Opus 4.6 <[email protected]>
# Conflicts:
#	nicegui/testing/screen_plugin.py
#	tests/test_table.py
#	tests/test_tree.py
@evnchn
evnchn deleted the branch DONOTMERGE February 11, 2026 15:39
@evnchn evnchn closed this Feb 11, 2026
@evnchn
evnchn deleted the try-sharedscreen branch March 29, 2026 11:17
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.

3 participants