proto becomes bxcore, the one shared crate (M5b task 00)

Done the way the owner asked and the spike mapped: the crate and the
manifests renamed, then what the build reported fixed. Layers: 138
"proto unresolved" errors across 169 files; cargo fmt reordering
imports; six fixture paths built as strings in brokerd's and bxctl's
tests, which the compiler cannot see, and comments naming
crates/proto/; the crate-dependency check and its self-test. One more
the spike did not reach: a `\nproto =` key inside a printf format in
the self-test, which a word-boundary replacement skips because `n` and
`p` are both word characters.

make gate: gate: ok, 944 tests; no new entry in /tmp.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 01:48:38 -07:00
co-authored by Claude Opus 5.5
parent 727e027fcf
commit 2b3ae080b4
311 changed files with 426 additions and 410 deletions
+2 -2
View File
@@ -19,11 +19,11 @@ use std::time::{Duration, Instant};
use brokerd::admin;
use brokerd::broker::{self, Broker};
use brokerd::policy::Label;
use client::{Serve, next, open};
use proto::{
use bxcore::{
ApprovalAnswer, Approve, AuditEvent, DataClass, DecisionRecord, DenyReason, Empty, ErrorCode,
Message, Refuse, SessionId, Timestamp, ToolResponse,
};
use client::{Serve, next, open};
use rig::{Rig, grant_text, request};
use runtime::Recording;
+1 -1
View File
@@ -9,7 +9,7 @@ use std::sync::{Arc, Barrier};
use brokerd::approvals::{Table, Verdict};
use brokerd::policy::{Ask, Outcome, SessionState, decide};
use build::{grant, now, read, set, ts};
use proto::{CallId, DataClass, DenyReason, Mode, PendingApproval, SessionId, Timestamp};
use bxcore::{CallId, DataClass, DenyReason, Mode, PendingApproval, SessionId, Timestamp};
fn ask() -> Ask {
let grants = set(vec![grant("n", "read_file", Mode::Ask).paths(&["/n"])]);
+1 -1
View File
@@ -8,7 +8,7 @@ use std::os::unix::fs::PermissionsExt;
use audit_dir::{D1, D2, TempDir, denied, lines, ts};
use brokerd::audit::{AuditError, RECOVERED_NOTICE, Writer, verify_dir};
use proto::{AuditRecord, Hash32, sha256};
use bxcore::{AuditRecord, Hash32, sha256};
fn mode(path: &std::path::Path) -> u32 {
std::fs::metadata(path).unwrap().permissions().mode() & 0o777
+1 -1
View File
@@ -6,7 +6,7 @@ mod audit_dir;
use audit_dir::{D1, D2, TempDir, denied, lines, ts};
use brokerd::audit::{Writer, verify_dir};
use proto::{AuditRecord, Hash32};
use bxcore::{AuditRecord, Hash32};
/// A kill between creating the day's file and writing its first record leaves it empty. It must
/// open like an empty log, not panic.
+2 -2
View File
@@ -1,13 +1,13 @@
//! What `Writer::open` does with the log it finds: refuse a broken chain, recover a torn tail,
//! accept a break when told to. Do not edit. The fixture logs are in
//! `crates/proto/tests/fixtures/audit/`; each test works on a copy.
//! `crates/bxcore/tests/fixtures/audit/`; each test works on a copy.
#[path = "support/audit_dir.rs"]
mod audit_dir;
use audit_dir::{D1, D2, TempDir, denied, lines, snapshot};
use brokerd::audit::{AuditError, Writer, verify_dir};
use proto::{AuditEvent, AuditRecord, Location, Timestamp};
use bxcore::{AuditEvent, AuditRecord, Location, Timestamp};
type Case = (
&'static str,
+3 -3
View File
@@ -20,18 +20,18 @@ use std::sync::Arc;
use brokerd::broker;
use brokerd::ledger::NOT_RECORDED;
use brokerd::runner::{REFUSING, RunError};
use client::{Serve, call, next, open};
use proto::{
use bxcore::{
ApprovalList, Approve, ApproveResult, AuditEvent, DataClass, DecisionRecord, DenyReason, Empty,
Envelope, ErrorCode, GrantsReport, Message, Refuse, ResultStatus, SessionId, ToolResponse,
Turn, TurnDone, TurnEvent, Usage, WireError,
};
use client::{Serve, call, next, open};
use rig::{Rig, grant_text, request};
use runtime::Recording;
const NOTES: &str = r#"{"path":"/n/a"}"#;
fn read_notes(call_id: u64) -> proto::ToolRequest {
fn read_notes(call_id: u64) -> bxcore::ToolRequest {
request("s1", call_id, "read_file", NOTES)
}
+3 -3
View File
@@ -18,11 +18,11 @@ use std::time::{Duration, Instant};
use brokerd::broker::{self, Broker, GONE};
use brokerd::ledger::Answer;
use client::{Serve, next, open};
use proto::{
use bxcore::{
AuditEvent, DataClass, DecisionRecord, DenyReason, Message, ResultStatus, Timestamp,
ToolResponse,
};
use client::{Serve, next, open};
use rig::{Rig, grant_text, request};
use runtime::Recording;
@@ -220,7 +220,7 @@ fn a_requester_gone_at_the_last_look_runs_nothing_and_closes_the_call() {
..
} => {
assert_eq!((*status, *decision), (ResultStatus::Failed, 0));
assert_eq!(*sha256, proto::sha256(GONE.as_bytes()).unwrap());
assert_eq!(*sha256, bxcore::sha256(GONE.as_bytes()).unwrap());
assert_eq!(*bytes, GONE.len() as u64);
}
other => panic!("{other:?}"),
+2 -2
View File
@@ -20,11 +20,11 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::time::Duration;
use brokerd::ledger::Answer;
use client::{Serve, call};
use proto::{
use bxcore::{
AuditEvent, AuditRecord, CallId, DataClass, DecisionRecord, Message, SessionId, Timestamp,
ToolResponse,
};
use client::{Serve, call};
use rig::{Rig, grant_text, request};
use runtime::Recording;
+1 -1
View File
@@ -15,8 +15,8 @@ use brokerd::container::{
use brokerd::policy::{Outcome, SessionState, decide};
use brokerd::runner::run;
use build::{grant, now, read, request, set};
use bxcore::{DataClass, Mode, ToolRequest, ToolResponse};
use fake_podman::{Fake, Lines, serial};
use proto::{DataClass, Mode, ToolRequest, ToolResponse};
fn call(podman: &Podman, req: ToolRequest, grants: Vec<build::Build>) -> ToolResponse {
let decision = match decide(req, &set(grants), SessionState::default(), now()) {
+1 -1
View File
@@ -14,8 +14,8 @@ use brokerd::container::{CANNOT_START, Podman, RUNBOOK, TIMED_OUT};
use brokerd::policy::{Outcome, SessionState, decide};
use brokerd::runner::run;
use build::{fetch, grant, now, set};
use bxcore::{Mode, ToolResponse};
use fake_podman::{Fake, Lines, path, serial};
use proto::{Mode, ToolResponse};
/// For `run -d` (the proxy): make the socket file in the mounted directory, as the proxy does.
const PROXY_OK: &str = r#"for a in "$@"; do case "$a" in --volume=*:/run/egress:rw) v=${a#--volume=}; v=${v%:/run/egress:rw};; esac; done"#;
+1 -1
View File
@@ -15,8 +15,8 @@ use brokerd::pipes::GRACE;
use brokerd::policy::{Outcome, SessionState, decide};
use brokerd::runner::run;
use build::{grant, now, read, set};
use bxcore::{Mode, ToolResponse};
use fake_podman::{Fake, Lines, serial};
use proto::{Mode, ToolResponse};
fn call(fake: &Fake, extra: &str, log: &Lines) -> (ToolResponse, Duration) {
let podman = Podman::new(fake.runner(extra), fake.dir.join("egress"), log.sink());
+1 -1
View File
@@ -11,8 +11,8 @@ use brokerd::container::{CANNOT_START, COULD_NOT_RUN, Podman, UNEXPECTED};
use brokerd::policy::{Outcome, SessionState, decide};
use brokerd::runner::run;
use build::{fetch, grant, now, read, set};
use bxcore::{Mode, ToolRequest, ToolResponse};
use fake_podman::{Fake, Lines, serial};
use proto::{Mode, ToolRequest, ToolResponse};
const FORGED: &str = "real line\nbrokerd: forged\nsee docs/runbook.md#grants-invalid";
+3 -3
View File
@@ -23,12 +23,12 @@ use brokerd::broker::{self, Broker};
use brokerd::config::Gateway;
use brokerd::courier::{self, Timing};
use brokerd::ledger::Answer;
use client::{Serve, next, open};
use fake_gateway::{FakeGateway, KYLE, POST};
use proto::{
use bxcore::{
ApprovalAnswer, ApprovalReply, AuditEvent, DenyReason, GatewayOutcome, Message, Timestamp,
ToolResponse,
};
use client::{Serve, next, open};
use fake_gateway::{FakeGateway, KYLE, POST};
use rig::{Rig, grant_text, request};
use runtime::Recording;
+3 -3
View File
@@ -7,7 +7,7 @@
mod tmp;
use brokerd::grants::{GrantSet, LoadedGrant, RUNBOOK, load, render, valid_id};
use proto::{Constraints, DataClass, Grant, GrantProblem, Hash32, Mode};
use bxcore::{Constraints, DataClass, Grant, GrantProblem, Hash32, Mode};
use std::path::{Path, PathBuf};
use tmp::TempDir;
@@ -66,8 +66,8 @@ fn the_valid_fixture_loads_in_id_order_with_file_hashes() {
assert!(!notes.grant.untrusted);
assert_eq!(notes.grant.constraints.paths, ["/home/kyle/notes"]);
let bytes = std::fs::read(fixture("valid").join("notes-read.toml")).unwrap();
assert_eq!(notes.sha256, proto::sha256(&bytes).unwrap());
// Defaults from `proto::Grant`.
assert_eq!(notes.sha256, bxcore::sha256(&bytes).unwrap());
// Defaults from `bxcore::Grant`.
let scratch = &set.grants()[3];
assert_eq!(scratch.grant.result_class, DataClass::Private);
assert!(scratch.grant.untrusted);
+4 -4
View File
@@ -16,7 +16,7 @@ use std::panic::AssertUnwindSafe;
use brokerd::ledger::{Call, Decided, Grants, NOT_RECORDED, POISONED, STOPPED};
use brokerd::policy::{Label, SessionState};
use build::{grant, now, read, set};
use proto::{
use bxcore::{
AuditEvent, CallId, DataClass, DecisionRecord, DenyReason, GrantProblem, Mode, ResultStatus,
SessionId, ToolResponse,
};
@@ -80,7 +80,7 @@ fn an_allowed_call_is_recorded_in_full() {
arguments,
outcome: DecisionRecord::Allowed {},
grant: Some("n".to_string()),
grant_sha256: Some(proto::sha256(b"n").unwrap()),
grant_sha256: Some(bxcore::sha256(b"n").unwrap()),
taint: DataClass::Private,
untrusted: false,
}
@@ -270,7 +270,7 @@ fn a_result_raises_the_state_then_is_recorded() {
untrusted: true,
truncated: false,
bytes: 3,
sha256: proto::sha256(b"key").unwrap(),
sha256: bxcore::sha256(b"key").unwrap(),
taint_after: DataClass::Secret,
}]
);
@@ -327,7 +327,7 @@ fn a_failure_changes_no_state_and_is_recorded_by_its_message() {
"the label the result would have had"
);
assert_eq!(*bytes, 18);
assert_eq!(*sha256, proto::sha256(b"the tool timed out").unwrap());
assert_eq!(*sha256, bxcore::sha256(b"the tool timed out").unwrap());
assert_eq!(*taint_after, DataClass::Private, "the taint before");
}
other => panic!("{other:?}"),
+1 -1
View File
@@ -14,7 +14,7 @@ use brokerd::approvals::Verdict;
use brokerd::ledger::{Answer, Answered, Decided, Grants, Ledger};
use brokerd::policy::{Ask, Label};
use build::{grant, now, read, set};
use proto::{
use bxcore::{
ApprovalAnswer, AuditEvent, CallId, DataClass, DecisionRecord, DenyReason, Mode, SessionId,
};
use rig::Rig;
+1 -1
View File
@@ -15,7 +15,7 @@ mod tmp;
use brokerd::ledger::Call;
use brokerd::policy::{Label, SessionState};
use build::now;
use proto::{AuditEvent, CallId, DataClass, SessionId, ToolResponse};
use bxcore::{AuditEvent, CallId, DataClass, SessionId, ToolResponse};
use rig::Rig;
fn label(class: DataClass, untrusted: bool) -> Label {
+1 -1
View File
@@ -14,7 +14,7 @@ use brokerd::approvals::Table;
use brokerd::ledger::{Answer, Decided, Grants, Ledger};
use brokerd::policy::Ask;
use build::{grant, now, read, set};
use proto::{ApprovalAnswer, AuditEvent, CallId, DataClass, Mode, PendingApproval, SessionId};
use bxcore::{ApprovalAnswer, AuditEvent, CallId, DataClass, Mode, PendingApproval, SessionId};
use rig::Rig;
const KYLE: &str = "k0000000000000000000000000";
+2 -2
View File
@@ -21,11 +21,11 @@ use brokerd::memory_port::{MemoryPort, Routed, UNREACHABLE};
use brokerd::policy::{Outcome, SessionState, decide};
use brokerd::runner::run;
use build::{grant, now, read, request, set};
use fake_podman::{Fake, Lines, serial};
use proto::{
use bxcore::{
DataClass, Envelope, MemoryCall, Message, Mode, ToolRequest, ToolResponse, read_frame,
write_frame,
};
use fake_podman::{Fake, Lines, serial};
use runtime::{Recording, Shared};
use tmp::TempDir;
+1 -1
View File
@@ -11,7 +11,7 @@ use brokerd::builtin::{BUILT_IN, MEMORY, RECALL};
use brokerd::grants::{GrantSet, load};
use brokerd::policy::{Label, Outcome, decide};
use build::{allowed, grant, now, private, request, secret, set};
use proto::{DataClass, DenyReason, Mode, sha256};
use bxcore::{DataClass, DenyReason, Mode, sha256};
use tmp::TempDir;
#[test]
+1 -1
View File
@@ -14,7 +14,7 @@ use brokerd::podman::{container_name, egress_args, tool_args};
use brokerd::policy::{Outcome, SessionState, decide};
use brokerd::runner::{RunError, RunOutput, RunSpec, Runtime, run};
use build::{fetch, grant, now, read, request, set, shell, write};
use proto::{CallId, Mode, SessionId, ToolRequest};
use bxcore::{CallId, Mode, SessionId, ToolRequest};
const IMAGE: &str = "localhost/boxmaker-tools@sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
+1 -1
View File
@@ -7,7 +7,7 @@ mod build;
use brokerd::policy::decide;
use build::{allowed, fetch, grant, now, private, read, reason, request, set, shell, write};
use proto::{DenyReason, Mode};
use bxcore::{DenyReason, Mode};
#[test]
fn no_grants_means_no_grant() {
+2 -2
View File
@@ -8,7 +8,7 @@ use brokerd::policy::{Label, decide};
use build::{
allowed, asked, denied, fetch, grant, now, private, read, reason, request, secret, set, shell,
};
use proto::{DataClass, DenyReason, Mode};
use bxcore::{DataClass, DenyReason, Mode};
#[test]
fn the_most_restrictive_mode_wins_among_three_matching_grants() {
@@ -348,7 +348,7 @@ fn a_decision_and_an_ask_carry_what_the_broker_and_the_runner_need() {
r#"{"path":"/home/kyle/scratch/a.txt","content":"hello"}"#
);
assert_eq!(ask.grant(), "asks");
assert_eq!(ask.grant_sha256(), proto::sha256(b"asks").unwrap());
assert_eq!(ask.grant_sha256(), bxcore::sha256(b"asks").unwrap());
assert_eq!(ask.matched_path(), Some("/home/kyle/scratch"));
assert_eq!(ask.paths(), ["/home/kyle/scratch"]);
assert!(ask.hosts().is_empty());
+1 -1
View File
@@ -13,8 +13,8 @@ mod oracle;
use brokerd::grants::{GrantSet, LoadedGrant};
use brokerd::policy::{Outcome, SessionState, decide, redecide};
use bxcore::{DataClass, DenyReason, Mode, Timestamp};
use oracle::{CLASSES, Expected, NOW_MS, Rng, oracle, some_grant, some_grants, some_request};
use proto::{DataClass, DenyReason, Mode, Timestamp};
const SEEDS: [u64; 5] = [1, 2, 3, 0xB0C5, 20_260_918];
+6 -3
View File
@@ -7,7 +7,7 @@ mod build;
use brokerd::grants::GrantSet;
use brokerd::policy::{Ask, Label, Outcome, decide, redecide};
use build::{grant, now, private, read, secret, set};
use proto::{DataClass, DenyReason, Mode};
use bxcore::{DataClass, DenyReason, Mode};
const PATH: &str = "/home/kyle/notes/a.md";
@@ -49,7 +49,10 @@ fn auto_now_lets_the_call_run_under_the_grant_that_matches_now() {
]);
let decision = redecide(pending(), &grants, private(), now()).unwrap();
assert_eq!(decision.grant(), "now-auto");
assert_eq!(decision.grant_sha256(), proto::sha256(b"now-auto").unwrap());
assert_eq!(
decision.grant_sha256(),
bxcore::sha256(b"now-auto").unwrap()
);
assert_eq!(decision.matched_path(), Some("/home/kyle"));
assert_eq!(decision.paths(), ["/home/kyle"]);
assert_eq!(
@@ -103,7 +106,7 @@ fn a_deny_grant_was_added_while_the_approval_waited() {
assert_eq!(denial.grant.as_deref(), Some("no-notes"));
assert_eq!(
denial.grant_sha256,
Some(proto::sha256(b"no-notes").unwrap())
Some(bxcore::sha256(b"no-notes").unwrap())
);
}
+1 -1
View File
@@ -10,7 +10,7 @@ use brokerd::args::{ToolArgs, ToolName};
use brokerd::policy::{Decision, Outcome, SessionState, decide};
use brokerd::runner::{Mount, REFUSING, Refusing, RunError, RunOutput, run};
use build::{grant, now, read, request, set};
use proto::{DataClass, Mode, ToolRequest, ToolResponse};
use bxcore::{DataClass, Mode, ToolRequest, ToolResponse};
use runtime::Recording;
fn allowed(grants: Vec<build::Build>, request: ToolRequest) -> Decision {
+9 -5
View File
@@ -11,7 +11,7 @@ use std::time::{Duration, Instant};
use brokerd::audit::RECOVERED_NOTICE;
use brokerd::runner::REFUSING;
use proto::{
use bxcore::{
AuditEvent, CallId, DenyReason, Empty, Envelope, ErrorCode, Message, PROTOCOL_VERSION,
ResultStatus, SessionId, ToolRequest, ToolResponse,
};
@@ -100,7 +100,11 @@ impl Home {
.flat_map(|n| {
let text = std::fs::read_to_string(dir.join(n)).unwrap();
text.lines()
.map(|l| serde_json::from_str::<proto::AuditRecord>(l).unwrap().event)
.map(|l| {
serde_json::from_str::<bxcore::AuditRecord>(l)
.unwrap()
.event
})
.collect::<Vec<_>>()
})
.collect()
@@ -143,10 +147,10 @@ fn exchange(socket: &Path, id: u64, msg: Message) -> Vec<Envelope> {
r#final: true,
msg,
};
proto::write_frame(&mut stream, &env).unwrap();
bxcore::write_frame(&mut stream, &env).unwrap();
let mut frames = Vec::new();
loop {
let env = proto::read_frame(&mut stream).unwrap();
let env = bxcore::read_frame(&mut stream).unwrap();
let last = env.r#final;
frames.push(env);
if last {
@@ -296,7 +300,7 @@ fn an_approval_nobody_answers_expires() {
fn copy_case(home: &Home, case: &str, only: &[&str]) {
let from = format!(
"{}/../proto/tests/fixtures/audit/{case}",
"{}/../bxcore/tests/fixtures/audit/{case}",
env!("CARGO_MANIFEST_DIR")
);
std::fs::create_dir_all(home.path("audit")).unwrap();
+1 -1
View File
@@ -58,7 +58,7 @@ fn a_break_is_accepted_and_the_next_plain_start_serves() {
std::fs::create_dir_all(&audit).unwrap();
std::fs::create_dir_all(dir.path().join("grants")).unwrap();
let fixture =
Path::new(env!("CARGO_MANIFEST_DIR")).join("../proto/tests/fixtures/audit/changed-byte");
Path::new(env!("CARGO_MANIFEST_DIR")).join("../bxcore/tests/fixtures/audit/changed-byte");
// The damage is in the first file; an ordinary start checks only the latest, so copy that one
// alone, as `audit_startup.rs` does.
std::fs::copy(
+2 -2
View File
@@ -10,11 +10,11 @@ use std::path::Path;
use std::process::{Child, Command, Stdio};
use std::time::{Duration, Instant};
use fake_podman::{Fake, IMAGE, serial};
use proto::{
use bxcore::{
CallId, DataClass, Envelope, Message, PROTOCOL_VERSION, SessionId, ToolRequest, ToolResponse,
read_frame, write_frame,
};
use fake_podman::{Fake, IMAGE, serial};
struct Running(Child);
+1 -1
View File
@@ -5,7 +5,7 @@ mod tmp;
use brokerd::policy::{Label, SessionState};
use brokerd::state::{RUNBOOK, StateError, StateStore};
use proto::{DataClass, SessionId};
use bxcore::{DataClass, SessionId};
use std::os::unix::fs::PermissionsExt;
use tmp::TempDir;
+4 -4
View File
@@ -6,7 +6,7 @@ use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicU32, Ordering};
use proto::{AuditEvent, CallId, DataClass, DecisionRecord, SessionId, Timestamp};
use bxcore::{AuditEvent, CallId, DataClass, DecisionRecord, SessionId, Timestamp};
pub const D1: &str = "2026-09-17.jsonl";
pub const D2: &str = "2026-09-18.jsonl";
@@ -28,14 +28,14 @@ impl TempDir {
TempDir { path }
}
/// A copy of the fixture log `case` from `crates/proto/tests/fixtures/audit/`. With `only`,
/// A copy of the fixture log `case` from `crates/bxcore/tests/fixtures/audit/`. With `only`,
/// just those files: damage in an older file is not seen by an ordinary start, so tests of
/// the startup check copy the damaged file alone.
pub fn case(case: &str, only: Option<&[&str]>) -> TempDir {
let dir = TempDir::unmade(case);
std::fs::create_dir_all(&dir.path).unwrap();
let from = format!(
"{}/../proto/tests/fixtures/audit/{case}",
"{}/../bxcore/tests/fixtures/audit/{case}",
env!("CARGO_MANIFEST_DIR")
);
let mut copied = 0;
@@ -88,7 +88,7 @@ pub fn denied(call: u64) -> AuditEvent {
tool: "read_file".to_string(),
arguments: r#"{"path":"/etc/hosts"}"#.to_string(),
outcome: DecisionRecord::Denied {
reason: proto::DenyReason::NoGrant,
reason: bxcore::DenyReason::NoGrant,
},
grant: None,
grant_sha256: None,
+2 -2
View File
@@ -6,7 +6,7 @@
use brokerd::grants::{GrantSet, LoadedGrant};
use brokerd::policy::{Ask, Decision, Denial, Outcome, SessionState};
use proto::{
use bxcore::{
CallId, Constraints, DataClass, DenyReason, Grant, Mode, SessionId, Timestamp, ToolRequest,
};
@@ -39,7 +39,7 @@ pub fn grant(id: &str, tool: &str, mode: Mode) -> Build {
constraints: Constraints::default(),
},
// Stands in for the file's hash, and differs from grant to grant.
sha256: proto::sha256(id.as_bytes()).unwrap(),
sha256: bxcore::sha256(id.as_bytes()).unwrap(),
})
}
+3 -3
View File
@@ -11,7 +11,7 @@ use std::sync::Arc;
use std::time::Duration;
use brokerd::broker::{self, Broker};
use proto::{Envelope, Message, PROTOCOL_VERSION, ToolRequest};
use bxcore::{Envelope, Message, PROTOCOL_VERSION, ToolRequest};
use crate::rig::Rig;
use crate::runtime::{Recording, Shared};
@@ -49,7 +49,7 @@ pub fn open(
r#final: true,
msg,
};
proto::write_frame(&mut client, &env).unwrap();
bxcore::write_frame(&mut client, &env).unwrap();
client
}
@@ -60,7 +60,7 @@ pub fn next(stream: &mut UnixStream) -> Envelope {
let peer_closed = cfg!(target_vendor = "apple") && e.raw_os_error() == Some(22);
assert!(peer_closed, "set_read_timeout: {e}");
}
proto::read_frame(stream).unwrap()
bxcore::read_frame(stream).unwrap()
}
/// Sends a tool request to `broker::handle` and reads every frame up to the final one.
+5 -2
View File
@@ -8,7 +8,7 @@ use std::path::{Path, PathBuf};
use std::sync::mpsc::{self, Receiver};
use std::time::Duration;
use proto::{
use bxcore::{
ApprovalPosted, ApprovalReply, Envelope, ErrorCode, GatewayOutcome, Message, PROTOCOL_VERSION,
PendingApproval, WireError, read_frame, write_frame,
};
@@ -141,7 +141,10 @@ impl Conn {
/// Did the courier close the connection within `wait`, without sending anything?
pub fn closed_within(&mut self, wait: Duration) -> bool {
self.stream.set_read_timeout(Some(wait)).unwrap();
matches!(read_frame(&mut self.stream), Err(proto::FrameError::Closed))
matches!(
read_frame(&mut self.stream),
Err(bxcore::FrameError::Closed)
)
}
pub fn close(self) {
+2 -2
View File
@@ -10,7 +10,7 @@
use brokerd::grants::LoadedGrant;
use brokerd::policy::SessionState;
use proto::{
use bxcore::{
CallId, Constraints, DataClass, DenyReason, Grant, Mode, SessionId, Timestamp, ToolRequest,
};
@@ -119,7 +119,7 @@ pub fn some_grant(rng: &mut Rng, id: usize) -> LoadedGrant {
secret: None,
constraints,
},
sha256: proto::sha256(format!("file {id}").as_bytes()).unwrap(),
sha256: bxcore::sha256(format!("file {id}").as_bytes()).unwrap(),
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ use brokerd::audit::Writer;
use brokerd::config::{Approvals, Config, Paths, Sockets};
use brokerd::ledger::Ledger;
use brokerd::state::StateStore;
use proto::{AuditEvent, AuditRecord, CallId, SessionId, ToolRequest};
use bxcore::{AuditEvent, AuditRecord, CallId, SessionId, ToolRequest};
use crate::sink::{Flaky, Lines, Switch};
use crate::tmp::TempDir;
+1 -1
View File
@@ -9,7 +9,7 @@ use std::sync::{Arc, Mutex};
use brokerd::audit::{AuditError, Writer};
use brokerd::ledger::AuditSink;
use proto::{AuditEvent, Timestamp};
use bxcore::{AuditEvent, Timestamp};
/// Switches shared between a test and its `Flaky` sink.
#[derive(Clone, Default)]