Skip to content

Commit f74178c

Browse files
francoisgnclaude
andcommitted
Merge upstream/main (storytold#2710 one test binary per crate, storytold#2713) into round3a-integration
Conflicts: - xtask/src/main.rs: upstream's runners (cargo test or nextest, no examples, doctests apart, one wasm `cargo check --keep-going`) with storytold#2302's `ci --quick` on top: test_selected builds the same targets (--lib --bins --tests), the wasm check takes the changed crates in one call, the full test step is upstream's. - apps/lightcraft/src/control_server.rs: upstream's `before` closure, with the batch's no-delay sockets kept. - docs/parity-checklist.md: LR-BEHAV-ACCESS from main (tests/it path), LR-BEHAV-LOCALE / LR-BEHAV-LOCALIZE from the batch (Polish). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 parents b840f3f + 91fcaaa commit f74178c

103 files changed

Lines changed: 1132 additions & 897 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Cargo.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ excessive_precision = "allow"
125125

126126
[profile.dev.package."*"]
127127
opt-level = 2
128+
debug = false
128129

129130
[profile.dev]
130131
opt-level = 1
132+
debug = "line-tables-only"
131133

132134
[profile.release]
133135
debug = "line-tables-only"

‎README.md‎

Lines changed: 6 additions & 4 deletions

‎README.zh-hans.md‎

Lines changed: 1 addition & 1 deletion

‎README.zh-hant.md‎

Lines changed: 1 addition & 1 deletion

‎ROADMAP.md‎

Lines changed: 2 additions & 2 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//! The integration tests, one module per file, linked into one test binary.
2+
3+
mod cli;
4+
mod mcp_shutdown;
File renamed without changes.

‎apps/lightcraft/src/control_server.rs‎

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,17 @@ mod tests {
240240
}
241241

242242
impl Connection {
243-
fn new(open: &Arc<AtomicUsize>, idle: Duration, input: &str) -> Self {
243+
/// `before` acts on the client before the worker starts reading, so what it sends is
244+
/// already there however late this thread gets scheduled.
245+
fn new(open: &Arc<AtomicUsize>, idle: Duration, before: impl FnOnce(&mut TcpStream)) -> Self {
244246
let listener = TcpListener::bind(("127.0.0.1", 0)).unwrap();
245247
let mut client = TcpStream::connect(listener.local_addr().unwrap()).unwrap();
246248
client.set_read_timeout(Some(Duration::from_secs(3))).unwrap();
247249
let (stream, _) = listener.accept().unwrap();
248250
// Small test messages must not wait for Nagle's algorithm or a delayed ACK.
249251
client.set_nodelay(true).unwrap();
250252
stream.set_nodelay(true).unwrap();
251-
// Queue initial input before starting the worker's short idle timeout.
252-
client.write_all(input.as_bytes()).unwrap();
253+
before(&mut client);
253254
let (tx, requests) = channel();
254255
let worker = spawn_connection(stream, tx, egui::Context::default(), Arc::clone(open), idle).unwrap();
255256
Self { client: BufReader::new(client), requests, worker: Some(worker) }
@@ -276,7 +277,7 @@ mod tests {
276277
fn idle_connections_release_their_slots_without_dispatching() {
277278
for input in ["", "{\"method\":\"engine.execute\""] {
278279
let open = Arc::new(AtomicUsize::new(0));
279-
let mut connection = Connection::new(&open, Duration::from_millis(100), input);
280+
let mut connection = Connection::new(&open, Duration::from_millis(100), |c| c.write_all(input.as_bytes()).unwrap());
280281
assert_eq!(open.load(Ordering::SeqCst), 1);
281282
let mut reply = String::new();
282283
let closed = connection.client.read_to_string(&mut reply);
@@ -289,8 +290,7 @@ mod tests {
289290
assert!(reply["error"].as_str().unwrap().contains("idle read timed out"));
290291

291292
// A subsequent connection is admitted through the same accounting path.
292-
let mut next = Connection::new(&open, Duration::from_secs(1), "");
293-
next.client.get_mut().shutdown(std::net::Shutdown::Write).unwrap();
293+
let mut next = Connection::new(&open, Duration::from_secs(1), |c| c.shutdown(std::net::Shutdown::Write).unwrap());
294294
let mut eof = String::new();
295295
next.client.read_to_string(&mut eof).unwrap();
296296
next.join();
@@ -302,11 +302,20 @@ mod tests {
302302
#[test]
303303
fn persistent_requests_and_slow_replies_outlive_the_idle_read_timeout() {
304304
let open = Arc::new(AtomicUsize::new(0));
305-
let mut connection = Connection::new(&open, Duration::from_millis(100), "{\"id\":1,\"method\":\"engine.commands\"}\n");
305+
let request = |id: u64| format!("{}\n", json!({"id": id, "method": "engine.commands"}));
306+
// Each request reaches the socket before the worker reads it (the next one while the worker
307+
// waits for the reply), so only the reply waits outlast the idle timeout, however slowly
308+
// this thread runs.
309+
let mut connection = Connection::new(&open, Duration::from_millis(100), |c| c.write_all(request(1).as_bytes()).unwrap());
306310
for id in [1, 2] {
307-
let req = connection.requests.recv_timeout(Duration::from_secs(3)).unwrap();
311+
let req = connection.requests.recv_timeout(Duration::from_secs(10)).unwrap();
308312
assert_eq!(req.method, "engine.commands");
309313
assert!(req.take());
314+
if id == 1 {
315+
connection.client.get_mut().write_all(request(2).as_bytes()).unwrap();
316+
} else {
317+
connection.client.get_mut().shutdown(std::net::Shutdown::Write).unwrap();
318+
}
310319
// A dispatched command waits for its reply, not for socket input.
311320
std::thread::sleep(Duration::from_millis(250));
312321
// Prepare the next read before releasing this reply. The client need not be
@@ -340,7 +349,8 @@ mod tests {
340349
let (req, rrx) = ControlRequest::new("ui.inspect", json!({}));
341350
let t0 = std::time::Instant::now();
342351
let r = await_reply(&rrx, &req.state, || 7, || {}, Duration::from_millis(50), Duration::from_secs(10));
343-
assert!(t0.elapsed() < Duration::from_secs(2));
352+
// the frame window (50 ms), not the 10 s timeout; the margin is for a slow machine
353+
assert!(t0.elapsed() < Duration::from_secs(5), "{:?}", t0.elapsed());
344354
assert_eq!(r["ok"], false);
345355
assert!(r["error"].as_str().unwrap().contains("not visible"), "{r}");
346356
assert!(!req.take(), "the app does not run it once it shows up");

‎crates/codecs/README.md‎

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)