Repository navigation
Issue #252 solved: build and test the Rust crates in CI - #253
PRINCEKK122 wants to merge 3 commits into
Conversation
|
Rebased onto the branch for #251, so this is stacked on that PR. Without it the relay job is red for reasons that have nothing to do with the workflow, which makes this PR impossible to evaluate. The diff here therefore temporarily includes #251's commit touching relay/src/state.rs and relay/Cargo.toml — review that one over there, not here. Once #251 merges I will rebase onto main and that commit drops out on its own, leaving only .github/workflows/rust.yml. |
|
The workflow is green now that it is stacked on #251: relay, src/server and baton all pass, relay reporting 23 passed / 0 failed. https://github.com/oss-slu/PilotDataSynchronization/actions/runs/41191646149 Worth comparing against the first run of this branch before the rebase, https://github.com/oss-slu/PilotDataSynchronization/actions/runs/40808333057, which is the same workflow against unmodified main and reports 21 passed / 2 failed. That pair is the argument for this PR: main had two broken tests for days and nothing in CI could see it, because no workflow ran any Rust. Also amended AGENTS.md, whose CI line listed only meson-build.yml and super-linter.yml. |
Sanjana-Siddani
left a comment
There was a problem hiding this comment.
Nice work! The workflow looks good, and I ran the same --locked build and test locally for all three crates: relay 23, server 5 and baton 5, all passing. The mirror test also passed 30/30 for me.
One thing about merge order: this PR includes #265’s commit, but the fix for #265’s test is only here. So if #265 merges alone, the flaky test comes back. Could you move the “Feed the stalled-mirror test” commit into #265? Then we merge #265 first and this one after. Approving once that’s sorted
Nothing in CI touched the Rust side. meson-build.yml builds the C++ plugin on Windows with its test step commented out, and super-linter lints YAML and clang-format. So relay, src/server and baton had no automated coverage at all, which is how main came to be failing two relay tests without anyone noticing (oss-slu#251). Add a workflow that builds and tests all three crates on pull requests and on pushes to main, as a matrix so each crate reports separately, with fail-fast off so one failure does not hide the others. The relay needs wayland, x11, drm and fontconfig headers because of its iced dependency tree, installed only for that crate. No toolchain is named: rust-toolchain.toml at the repository root decides, once oss-slu#243 lands. Cargo registry and target output are cached per crate, keyed on each Cargo.lock.
SonarCloud's quality gate flagged githubactions:S8549, a MAJOR vulnerability on the build step: dependencies resolved without locking (CWE-494, CWE-829). One MAJOR on new code drops the security rating to C, and the gate requires A. relay/Cargo.toml pins iced and anyhow at "*", so an unlocked CI build can resolve a different dependency set than anyone tested locally. --locked builds the committed Cargo.lock instead, and fails loudly if a Cargo.toml change ever lands without its matching lockfile update. All three crates have Cargo.lock committed and pass with it: relay 23 tests, src/server 5, baton 0.
The test went red on CI again after oss-slu#251. The buffer bound in state.rs was right; reducing SAMPLES from 3000 to 500 alongside it was not. mirror_send try_sends into a 256-deep queue and drops when full, so a fixed burst does not determine how much reaches the writer thread - the race between the two threads does. A burst that loses it leaves the writer with well under a bufferful, no write blocks, MIRROR_WRITE_TIMEOUT never fires and the mirror is never dropped. Feeding in batches until the mirror is actually dropped removes the guess. The stalled reader never drains, so whatever the writer does get through accumulates across batches and the timeout is reached regardless of how any single batch races. Verified against the mechanism that failed: 40/40 runs pinned to one core, and 25/25 on one core against six competing CPU hogs.
|



Closes #252.
Problem
Nothing in CI builds or tests the Rust crates.
.github/workflows/holdsmeson-build.yml, which builds the C++ plugin on Windows with its test step commented out, andsuper-linter.yml, which lints YAML, GitHub Actions and clang-format. Neither runscargoat all.So
relay,src/serverandbaton— where most current development happens — have had no automated coverage. That is howmaincame to be failing two relay tests with nobody aware of it (#251).Change
A
Rustworkflow running on pull requests and pushes tomain:relay,src/serverandxplane_plugin/subprojects/baton, so each crate reports as its own check.fail-fast: false, so one broken crate does not hide the state of the other two.cargo buildthencargo testper crate.target/cached per crate, keyed on that crate'sCargo.lock.rust-toolchain.tomlat the repository root decides, once Issue #188 solved: rename rust-toolchain.toml so the pin takes effect #243 lands. Until then runners use their default stable, which is the behaviour today.The relay step installs wayland, x11, drm, udev and fontconfig headers first. Its
iceddependency tree needs them to build; the other two crates are plainstdand skip that step.About the check on this PR
This may well come back red, and that is the point.
Two tests fail on
mainon Linux (#251):a_slow_python_reader_does_not_pace_imotionsanda_python_process_that_stops_reading_is_dropped_not_waited_on. Both assert on socket backpressure that never materialises when the kernel buffers are large enough to absorb the test's volume.Whether they also fail on a GitHub runner is unknown — nothing has ever run them there. This PR is the first time anyone finds out:
mainis genuinely broken on the project's own CI platform, and Two mirror tests from #247 fail on main on Linux #251 should be fixed before this merges.Either way the result is information the project does not currently have. I would rather surface it than special-case those two tests to get a green check.
Scope
Deliberately limited to the Rust crates. Re-enabling the commented-out Meson test step and the commented-out Ubuntu job is a separate question for whoever owns the plugin build.