fix(bottom-panel): satisfy the strict clippy gate in both configurations
Three float comparisons became explicit epsilon checks, one const-valued assertion moved into a const block, and the crdt-only half of the new acceptance suite is now gated import-by-import. That last one is the interesting part: the negotiation-rule tests are pure and run in BOTH configurations, while everything needing a real daemon needs the crdt feature — a semantic session is necessarily a text replica, so a non-CRDT build cannot host one at all. Splitting the imports along that line is what keeps the default clippy configuration clean while leaving the version-ladder assertions where CI can actually reach them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lv428Fth9LRtffwJSsqH7T
This commit is contained in:
parent
8ee08d93e5
commit
e00cdd7ca6
|
|
@ -16363,9 +16363,8 @@ mod tests {
|
||||||
"the inset is the panel's rows plus its divider"
|
"the inset is the panel's rows plus its divider"
|
||||||
);
|
);
|
||||||
assert!(band.px() > 0.0);
|
assert!(band.px() > 0.0);
|
||||||
assert_eq!(
|
assert!(
|
||||||
status_band_top(state.config.height, fm),
|
(status_band_top(state.config.height, fm) - status_before).abs() < f32::EPSILON,
|
||||||
status_before,
|
|
||||||
"the status band must stay pixel-identical at the physical window bottom"
|
"the status band must stay pixel-identical at the physical window bottom"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
|
|
@ -16442,9 +16441,11 @@ mod tests {
|
||||||
< f32::EPSILON,
|
< f32::EPSILON,
|
||||||
"capacity always reserves the divider"
|
"capacity always reserves the divider"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert!(
|
||||||
document_text_bottom(height, fm, PanelBandInset::ABSENT),
|
(document_text_bottom(height, fm, PanelBandInset::ABSENT)
|
||||||
status_band_top(height, fm),
|
- status_band_top(height, fm))
|
||||||
|
.abs()
|
||||||
|
< f32::EPSILON,
|
||||||
"while an absent panel costs the document nothing"
|
"while an absent panel costs the document nothing"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -16481,9 +16482,8 @@ mod tests {
|
||||||
// depend on what happens to be open. Here they are separated
|
// depend on what happens to be open. Here they are separated
|
||||||
// directly, so the assertion does not rest on font internals.
|
// directly, so the assertion does not rest on font internals.
|
||||||
state.measured_mono_advance = Some(probe * 2.0);
|
state.measured_mono_advance = Some(probe * 2.0);
|
||||||
assert_ne!(
|
assert!(
|
||||||
state.mono_advance(),
|
(state.mono_advance() - probe).abs() > f32::EPSILON,
|
||||||
probe,
|
|
||||||
"fixture must separate the two derivations"
|
"fixture must separate the two derivations"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,22 +20,35 @@
|
||||||
|
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
|
// Most of this suite needs a real daemon and therefore the `crdt` feature:
|
||||||
|
// a semantic session is necessarily a text replica, so a non-CRDT build
|
||||||
|
// cannot host one at all. The negotiation-rule tests are the exception and
|
||||||
|
// run in both configurations, which is why the imports split here.
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
use std::os::unix::net::UnixStream;
|
use std::os::unix::net::UnixStream;
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
use pmacs_protocol::cell::CellSize;
|
use pmacs_protocol::cell::CellSize;
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
use pmacs_protocol::message::{
|
use pmacs_protocol::message::{
|
||||||
AttachRequest, FrontendCapabilities, FrontendEvent, GoodbyeReason, Hello, InstanceMessage, Key,
|
AttachRequest, FrontendCapabilities, FrontendEvent, GoodbyeReason, Hello, InstanceMessage, Key,
|
||||||
KeyEvent, Modifiers, SessionBootstrapRequest,
|
KeyEvent, Modifiers, SessionBootstrapRequest,
|
||||||
};
|
};
|
||||||
use pmacs_protocol::panel::{PANEL_MIN_VERSION, PanelFramePayload};
|
use pmacs_protocol::panel::PANEL_MIN_VERSION;
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
|
use pmacs_protocol::panel::PanelFramePayload;
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
use pmacs_protocol::transport::{read_message, write_message};
|
use pmacs_protocol::transport::{read_message, write_message};
|
||||||
use pmacs_protocol::{
|
use pmacs_protocol::{
|
||||||
ADVERTISED_PROTOCOL_VERSION, PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS,
|
ADVERTISED_PROTOCOL_VERSION, PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS,
|
||||||
is_supported_protocol_version, negotiated_session_version, requested_protocol_version,
|
is_supported_protocol_version, negotiated_session_version, requested_protocol_version,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
use common::daemon::{TestDaemon, build_default_caps};
|
use common::daemon::{TestDaemon, build_default_caps};
|
||||||
|
|
||||||
/// Opens a bottom panel in whichever frontend pressed the key.
|
/// Opens a bottom panel in whichever frontend pressed the key.
|
||||||
|
|
@ -44,6 +57,7 @@ use common::daemon::{TestDaemon, build_default_caps};
|
||||||
/// with an explicit `side` is exactly what a Stage 1 adopter does, and the
|
/// with an explicit `side` is exactly what a Stage 1 adopter does, and the
|
||||||
/// acting frontend is the one that sent the key — so whether this produces
|
/// acting frontend is the one that sent the key — so whether this produces
|
||||||
/// a side window is precisely the `panel_capable` question.
|
/// a side window is precisely the `panel_capable` question.
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
const PANEL_ON_KEY: &str = r#"
|
const PANEL_ON_KEY: &str = r#"
|
||||||
pmacs.command.define {
|
pmacs.command.define {
|
||||||
name = "bp-probe.panel",
|
name = "bp-probe.panel",
|
||||||
|
|
@ -55,6 +69,7 @@ pmacs.command.define {
|
||||||
pmacs.keymap.bind { scope = "global", sequence = "C-M-p", command = "bp-probe.panel" }
|
pmacs.keymap.bind { scope = "global", sequence = "C-M-p", command = "bp-probe.panel" }
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
fn semantic_caps() -> FrontendCapabilities {
|
fn semantic_caps() -> FrontendCapabilities {
|
||||||
FrontendCapabilities {
|
FrontendCapabilities {
|
||||||
multi_frontend: true,
|
multi_frontend: true,
|
||||||
|
|
@ -65,6 +80,7 @@ fn semantic_caps() -> FrontendCapabilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// One attached session, with the version it actually offered.
|
/// One attached session, with the version it actually offered.
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
struct Session {
|
struct Session {
|
||||||
stream: UnixStream,
|
stream: UnixStream,
|
||||||
offered: u32,
|
offered: u32,
|
||||||
|
|
@ -77,6 +93,7 @@ struct Session {
|
||||||
/// ever advertised something above the baseline, a shipped frontend would
|
/// ever advertised something above the baseline, a shipped frontend would
|
||||||
/// reject before reaching any of these code paths, and the tests below
|
/// reject before reaching any of these code paths, and the tests below
|
||||||
/// would still pass while the product was broken.
|
/// would still pass while the product was broken.
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
fn attach_semantic(daemon: &TestDaemon, offer: u32) -> Session {
|
fn attach_semantic(daemon: &TestDaemon, offer: u32) -> Session {
|
||||||
let mut stream = daemon.connect();
|
let mut stream = daemon.connect();
|
||||||
stream
|
stream
|
||||||
|
|
@ -115,6 +132,7 @@ fn attach_semantic(daemon: &TestDaemon, offer: u32) -> Session {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read messages until `want` returns `Some`, or the deadline passes.
|
/// Read messages until `want` returns `Some`, or the deadline passes.
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
fn drain_until<T>(
|
fn drain_until<T>(
|
||||||
stream: &mut UnixStream,
|
stream: &mut UnixStream,
|
||||||
label: &str,
|
label: &str,
|
||||||
|
|
@ -138,6 +156,7 @@ fn drain_until<T>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Press `C-M-p`, then report whether a `Present` panel frame arrived.
|
/// Press `C-M-p`, then report whether a `Present` panel frame arrived.
|
||||||
|
#[cfg(feature = "crdt")]
|
||||||
fn press_and_await_panel(session: &mut Session) -> bool {
|
fn press_and_await_panel(session: &mut Session) -> bool {
|
||||||
// The declaration first: the daemon needs columns before it can paint
|
// The declaration first: the daemon needs columns before it can paint
|
||||||
// a first panel frame, and it is valid without a side window for
|
// a first panel frame, and it is valid without a side window for
|
||||||
|
|
@ -322,7 +341,7 @@ fn the_baseline_stays_and_the_counter_offer_activates() {
|
||||||
ADVERTISED_PROTOCOL_VERSION, 20,
|
ADVERTISED_PROTOCOL_VERSION, 20,
|
||||||
"moving this is the incompatible act the mechanism exists to avoid"
|
"moving this is the incompatible act the mechanism exists to avoid"
|
||||||
);
|
);
|
||||||
assert!(PROTOCOL_VERSION > ADVERTISED_PROTOCOL_VERSION);
|
const { assert!(PROTOCOL_VERSION > ADVERTISED_PROTOCOL_VERSION) };
|
||||||
assert_eq!(PANEL_MIN_VERSION, PROTOCOL_VERSION);
|
assert_eq!(PANEL_MIN_VERSION, PROTOCOL_VERSION);
|
||||||
|
|
||||||
// The current baseline is answered with this binary's own version.
|
// The current baseline is answered with this binary's own version.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue