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
+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)]