Repository navigation
fix(top): leave saved_state unset in the sozu top e2e config - #1573
Merged
Merged
Conversation
FlorentinDUBOIS
requested review from
Wonshtrum and
llenotre
as code owners
September 26, 2026 14:14
This was referenced Sep 26, 2026
`sozu_top_tick_once_against_real_master` configured `saved_state = ""`.
An empty `saved_state` is a path, not an opt-out: `load_from_path`
replaces it with `saved_state_path()`, whose `metadata("")` reports
NotFound and whose `File::create("")` then fails with ENOENT, so
`sozu start` exits with `SaveStatePath("failed to create state file
'\"\"'")` before the test reaches the command socket. That code is
unchanged since 2023, so the test has failed this way since it was
added. Its config is meant to be minimal and wants no saved state, so
the key is dropped; the configuration contract stays as documented.
The test also needs a controlling terminal: `sozu top --snapshot` still
enters raw mode and fails with ENXIO without one. The test doc and the
CI comment that keeps it out of the process-level e2e step now say so.
Closes #1572
Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS
force-pushed
the
fix/sozu-top-e2e-saved-state
branch
from
September 26, 2026 15:48
947c68b to
0648e57
Compare
FlorentinDUBOIS
added a commit
that referenced
this pull request
Sep 26, 2026
…#1575) Closes #1574 ## Cause `sozu top --snapshot N` is documented in `bin/src/cli.rs` as a "test affordance, no terminal control", but `render::run` installed `RawModeGuard` unconditionally (`bin/src/ctl/top/render.rs`, `let _guard = RawModeGuard::install(cfg.mouse)?;`). Its `enable_raw_mode()` reaches crossterm 0.29's `tty_fd()`, which opens `/dev/tty` when stdin is not a terminal. Without a controlling terminal that open fails with ENXIO, and `ctl/top/mod.rs` wraps it as `ResolvePath("sozu top render loop", … os error 6)`. Removing the guard alone would not be enough: `event::poll` lazily builds crossterm's event source, which calls `tty_fd()` too, and `Terminal::new` (a fullscreen viewport) asks the backend for the terminal size. ## Fix Only when `--snapshot` is set, `render::run` now: - enters neither raw mode nor the alternate screen, and captures no mouse (no `RawModeGuard`); - installs no terminal-restoring panic hook, since there is nothing to restore; - reads no input: the loop sleeps for its pacing interval instead of calling `poll`/`read`; - draws into a fixed 80x24 `Viewport::Fixed`, which ratatui 0.30 neither sizes from nor resizes to the terminal (`Terminal::with_options` and `autoresize` both skip `backend.size()` for a fixed viewport). 80x24 is the smaller of the two sizes the `insta` tests render every pane at. Frames go to stdout as ANSI escape sequences. Interactive mode and `--tick-once` are unchanged. ## CI `sozu_top_e2e` now passes without a pty, so a new step runs it on the `msrv-full` cell only. That cell already resolves the `tui` feature for `cargo doc --all-features`, so the added cost is one build of the `sozu` binary with `tui`, once per pipeline. The step also runs the two non-ignored `sozu top` tests, which no cell ran before. The `.github/workflows/ci.yml` comment that kept the test out, the test's doc comment, and the last sentence of #1573's CHANGELOG entry now say it runs. ## Verification Run outside a pty (`tty` reports "not a tty"): - before the fix: `cargo test -p sozu --features tui --test sozu_top_e2e -- --include-ignored` exits 101, `sozu_top_tick_once_against_real_master` fails with `could not resolve path for sozu top render loop : No such device or address (os error 6)`; - after the fix, the same command: exit 0, 3 passed. The new CI step's command, `cargo test -p sozu --locked --features opentelemetry,splice,simd --features tui --test sozu_top_e2e -- --include-ignored`, run with stdin at `/dev/null`: exit 0, 3 passed; - `cargo build`, `cargo clippy --all-targets -D warnings` (`crypto-ring,opentelemetry,splice,simd`, and `-p sozu --features tui`), `cargo +nightly fmt --check`, `cargo test -p sozu` (ring features, 226 passed), the three other `bin/tests/*_e2e` with `--ignored`, `cargo test -p sozu-command-lib` (184 passed), the four `check_doc_citations.py` invocations and `RUSTDOCFLAGS="-D warnings" cargo doc --all-features`: all exit 0. ## Out of scope - `cargo test -p sozu --features tui` fails on `snapshot_h2_120x40`: the H2 pane now lists `rst_stream_dropped` (since #1434) but the `.snap` file does not. It fails identically with this PR's `render.rs` reverted, `origin/main`'s snapshot lacks the row too, and no CI cell runs that suite. - The e2e takes about 30 s both before and after this change. It already did when the render loop failed on its first call, so the time is spent outside the loop; its cause was not investigated here. Signed-off-by: Florentin Dubois <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1572
Cause
bin/tests/sozu_top_e2e.rssetsaved_state = "".Config::load_from_path(command/src/config.rs:4176) replacessaved_statewithsaved_state_path(). ForSome(""),metadata("")(:4375) reportsNotFound, thenFile::create("")(:4378) fails with ENOENT, which becomesConfigError::SaveStatePath.sozu startexits withStartMain(LoadConfig(SaveStatePath("failed to create state file '\"\"': No such file or directory (os error 2)")))before the test reaches the command socket.saved_state_pathis unchanged since 2023-08-08 (9c2cbcc5) and the test landed on 2026-05-10 (8c430c21), so it has never passed.Fix
The test config drops
saved_state. The key is optional, and the config is meant to be minimal: command socket only, no listeners, no clusters, no state.saved_state_path()is left alone. Neitherdoc/configure.mdnorbin/config.tomldescribes an emptysaved_stateas a way to turn it off, andgit grep 'saved_state = ""'finds only this test. Treating""asNonewould add a new config contract to fix a test typo.CI
The test stays out of CI.
ci.ymlalready says why: no matrix cell enablestui. There is also a second reason:sozu top --snapshotstill enters raw mode (render.rs,RawModeGuard::install→enable_raw_mode), and without a controlling terminal that fails withResolvePath("sozu top render loop", … No such device or address (os error 6)). A CI step has no controlling terminal. This PR records that in the test doc and in the CI comment.Follow-up, out of scope here:
--snapshotis documented as "no terminal control" (bin/src/cli.rs), but it does take control of the terminal. Once snapshot mode stops touching the terminal, the test could run in CI.Verification
Red, then green, both run under a Python
pty.spawnwrapper that provides a controlling terminal:cargo test -p sozu --features tui --test sozu_top_e2e -- --include-ignored→ exit 101,SaveStatePath("failed to create state file '\"\"' …"), 2 passed / 1 failedAlso run, each checked for exit 0: build and clippy (
--no-default-features --features crypto-ring,opentelemetry,splice,simd,--all-targets -D warnings),cargo clippy -p sozu --features tui --all-targets -- -D warnings,cargo +nightly fmt --all -- --check, tests forsozu/sozu-command-lib/sozu-lib, the three process-level e2e files with--ignored, the fourcheck_doc_citations.pymodes, andRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --locked.Signed-off-by: Florentin Dubois [email protected]