Skip to content

Commit eea9081

Browse files
committed
2.0.0-alpha.4
1 parent e25b66a commit eea9081

383 files changed

Lines changed: 30410 additions & 10214 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.

‎src/windhawk-core/Cargo.lock‎

Lines changed: 22 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/windhawk-core/Cargo.toml‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ members = [
88
"domain",
99
"ports",
1010
"windows",
11+
"testkit",
1112
"core",
1213
"ffi",
1314
"core-client",
@@ -19,17 +20,26 @@ members = [
1920
]
2021

2122
[workspace.package]
22-
version = "2.0.0-alpha.3"
23+
version = "2.0.0-alpha.4"
2324
edition = "2024"
2425
rust-version = "1.96"
2526
publish = false
2627

28+
# The `// SAFETY:` note the `windows/`, `ffi/`, `broker/`, and `ui/` crate
29+
# headers require on every unsafe block. A Cargo lint rather than a crate-root
30+
# attribute because it has to reach the integration-test targets too, which are
31+
# crates of their own; the cost is that every member has to opt in with
32+
# `[lints] workspace = true`, which testkit/tests/state_rules.rs gates.
33+
[workspace.lints.clippy]
34+
undocumented_unsafe_blocks = "deny"
35+
2736
[workspace.dependencies]
2837
# Internal crates.
2938
windhawk-core-protocol = { path = "protocol" }
3039
windhawk-core-domain = { path = "domain" }
3140
windhawk-core-ports = { path = "ports" }
3241
windhawk-core-windows = { path = "windows" }
42+
windhawk-core-testkit = { path = "testkit" }
3343
windhawk-core = { path = "core" }
3444
# The raw C ABI transport shared by the bridge and the CLI. Outside the core
3545
# layering, like the bridge; depends on libloading alone.
@@ -75,9 +85,11 @@ thiserror = "2.0"
7585
# keeps the last value. default-features off drops the `encoding` feature
7686
# (encoding_rs); the core feeds the parser &str it decoded itself.
7787
yaml-rust2 = { version = "0.11", default-features = false }
78-
# Raw Win32 bindings for the adapter and ffi crates. Pinned to the version other
79-
# dependencies already resolve to so cargo-deny sees no duplicate. Features are
80-
# enabled per consuming crate.
88+
# Raw Win32 bindings for the adapter and ffi crates. Pinned to the version the
89+
# rest of the tree already resolves to, so the workspace edge adds no version of
90+
# its own; the Tauri UI and the embed-resource build chain still pull 0.59/0.60,
91+
# which cargo-deny reports as a duplicate warning. Features are enabled per
92+
# consuming crate.
8193
windows-sys = "0.61"
8294
libloading = "0.9"
8395
tempfile = "3"
@@ -95,9 +107,9 @@ clap = { version = "4", default-features = false, features = [
95107
] }
96108
# The CLI's Windows console control handler: a safe wrapper over
97109
# SetConsoleCtrlHandler so the `cli` crate keeps `forbid(unsafe_code)`. On
98-
# Windows it depends on `windows-sys` ALONE, pinned to the workspace's 0.61 (no
99-
# duplicate version); the Unix/Apple deps it declares are not pulled for the
100-
# *-pc-windows-msvc targets the CLI builds for.
110+
# Windows it depends on `windows-sys` ALONE, resolved to the workspace's 0.61
111+
# (no version of its own); the Unix/Apple deps it declares are not pulled for
112+
# the *-pc-windows-msvc targets the CLI builds for.
101113
ctrlc = "3"
102114
# The Windows version-resource compiler, a BUILD dependency of the cli and ffi
103115
# crates. Their build scripts generate a VERSIONINFO .rc from Cargo's version

‎src/windhawk-core/bridge/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ windhawk-core-client = { workspace = true }
2020

2121
[build-dependencies]
2222
napi-build = "2"
23+
24+
[lints]
25+
workspace = true

‎src/windhawk-core/bridge/src/lib.rs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
//! This crate deliberately sits outside the core layering: it depends on no
1717
//! core crate and reaches the DLL only through the C ABI (via core-client).
1818
19+
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used))]
20+
1921
#[macro_use]
2022
extern crate napi_derive;
2123

@@ -32,8 +34,9 @@ fn napi_err(message: impl Into<String>) -> napi::Error {
3234
napi::Error::from_reason(message.into())
3335
}
3436

35-
/// Load windhawk-core.dll and resolve its exports. The ABI version is checked
36-
/// in core-client: the bridge refuses to run on a mismatch.
37+
/// Load windhawk-core.dll and resolve its exports. core-client checks the ABI
38+
/// version - the bridge refuses to run on a mismatch - and refuses a path that
39+
/// is not fully qualified, so the caller passes an absolute one.
3740
#[napi]
3841
pub fn load_core(dll_path: String) -> napi::Result<CoreLibrary> {
3942
let inner = ClientLibrary::load(&dll_path).map_err(|e| napi_err(e.to_string()))?;
@@ -156,9 +159,9 @@ impl Task for InvokeTask {
156159
#[napi]
157160
impl CoreSession {
158161
/// Synchronous core command, executed off the JS thread; resolves with the
159-
/// raw response envelope JSON. Fails fast (synchronously) if the session
160-
/// was already destroyed, so a use-after-destroy throws rather than
161-
/// rejecting later.
162+
/// raw response envelope JSON. A session already destroyed throws here,
163+
/// synchronously; one destroyed between this check and the worker picking
164+
/// the task up rejects the promise instead.
162165
#[napi(ts_return_type = "Promise<string>")]
163166
pub fn invoke(&self, request_json: String) -> napi::Result<AsyncTask<InvokeTask>> {
164167
if self.inner.is_destroyed() {

‎src/windhawk-core/broker/Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ windows-sys = { workspace = true, features = [
4343
"Win32_Security_Cryptography",
4444
"Win32_Foundation",
4545
] }
46+
47+
[lints]
48+
workspace = true

‎src/windhawk-core/broker/src/handler.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ pub trait BrokerHandler: Send + Sync + 'static {
8686
/// dead channel.
8787
fn oversized(&self, id: u64, bytes: usize, cap: usize) -> Self::Response;
8888

89+
/// Build the response that reports a [`handle`](Self::handle) that panicked.
90+
/// A panic is a bug rather than a way to fail a request, but it is a bug in
91+
/// one request's serving, and the requester is parked on an id only this end
92+
/// can answer.
93+
fn panicked(&self, id: u64) -> Self::Response;
94+
8995
/// A push too large to put on the wire was dropped. A push answers no
9096
/// request, so there is nothing to fail; the default is to say nothing.
9197
fn push_dropped(&self, bytes: usize, cap: usize) {
@@ -105,6 +111,12 @@ pub trait PushSink<Push>: Send + Sync + 'static {
105111
/// The channel ended: no further push will arrive and every request in
106112
/// flight has been failed. Called exactly once.
107113
///
114+
/// The close comes FIRST: by the time this runs the channel already reports
115+
/// closed to everyone else (`Requester::is_open`) and refuses new requests.
116+
/// So the signal is not the only way to learn of the loss, which is what lets
117+
/// a caller that was not yet in a position to act on the one signal it gets
118+
/// find out by asking instead.
119+
///
108120
/// The same hand-off rule applies, and this is the harder place to keep it:
109121
/// whatever a caller wants to do about a lost channel - unwind the work that
110122
/// was in flight, put a notice in front of the user, fall back to some other

‎src/windhawk-core/broker/src/lib.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
// the `ui` crate took: deny unsafe operations outside an `unsafe` block, keep
3131
// unsafe confined to `pipe.rs` and `security.rs`, and carry a `// SAFETY:` note
3232
// on every block. The rest of the crate is safe.
33+
#![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used))]
3334
#![deny(unsafe_op_in_unsafe_fn)]
3435

3536
mod frame;
@@ -43,15 +44,15 @@ mod version;
4344
pub use frame::{FRAME_HEADER_BYTES, FrameError, decode, encode, read_frame, write_frame};
4445
pub use handler::{BrokerHandler, Disposition, PushSink, RequestFrames, Routed};
4546
pub use pipe::{
46-
Event, PipeReader, PipeStream, channel_name, connect_flags, listener_open_mode,
47+
Event, PipeReader, PipeStream, WriteError, channel_name, connect_flags, listener_open_mode,
4748
listener_pipe_mode,
4849
};
4950
pub use requester::{
5051
AcceptError, AcceptTerms, ChannelError, Handshaken, Listener, Rejection, Requester,
5152
};
5253
pub use responder::{ConnectError, Connection, PushQueue, Pusher, Responder, connect, push_queue};
5354
pub use security::{
54-
Accepted, ClientPeer, Integrity, PeerPolicy, PipeSecurity, RejectReason, SelfIdentity,
55-
ServerPeer, identify_client, identify_server,
55+
Accepted, ClientPeer, Integrity, PeerIntegrity, PeerPolicy, PipeSecurity, RejectReason,
56+
SelfIdentity, ServerPeer, identify_client, identify_server,
5657
};
57-
pub use version::{ChannelConfig, Handshake};
58+
pub use version::{ChannelConfig, HANDSHAKE_FRAME_CAP, Handshake};

0 commit comments

Comments
 (0)