feat: rename ALPN prefix from alknet/ to alk/ (v0.1.1)

- CHANNELS_ALPN: b"alknet/channels" → b"alk/channels"
- CallAdapter::alpn(): b"alknet/call" → b"alk/call"
- derive_alpn_from_op_name: alknet/ prefix → alk/ prefix
- All ALPN string literals in src/ and docs/ updated
- ADR-004 amended with prefix rename rationale
- AGENTS.md, README.md updated
- Version bumped to 0.1.1

Review: docs/reviews/003-alpn-prefix-rename.md

Verification:
- cargo test: 542 passed, 0 failed
- cargo clippy --all-targets -- -D warnings: clean
- cargo fmt --check: clean
- cargo doc --no-deps: clean
This commit is contained in:
deepseek-v4-pro committed 2026-08-14 13:55:28 +00:00
1 parent 3cce1410c4
commit 08e7df2aa0
60 files changed
+837 -328

No files matched your search

+31 -31
View File
@@ -37,7 +37,7 @@ use super::reassembly::{MpscRecvStream, MpscSendStream};
/// and the `CallConnection` (for calling open ops on channel 0).
///
/// The consumer dials the transport and establishes the
/// `alknet/channels` ALPN, then hands the `Connection` to
/// `alk/channels` ALPN, then hands the `Connection` to
/// `from_connection`. The client runs the demux/mux in spawned tasks
/// and exposes `open_channel` to call the per-ALPN open ops
/// (`channels/<alpn>/sub`, `channels/<alpn>/pub`) on channel 0.
@@ -48,8 +48,8 @@ pub struct ChannelClient {
impl ChannelClient {
/// Construct from an established `Connection` (the consumer dials
/// the transport and establishes the `alknet/channels` ALPN).
/// Installs channel 0 (pre-negotiated as `alknet/call`,
/// the transport and establishes the `alk/channels` ALPN).
/// Installs channel 0 (pre-negotiated as `alk/call`,
/// ADR-036), wraps it as a `CallConnection` in single-stream call
/// mode (ADR-036 amendment), spawns the demux and mux tasks, and
/// returns the client.
@@ -93,7 +93,7 @@ impl ChannelClient {
// (for `call.requested`) and a read pump (for responses).
let channel0_source =
super::source::channel_source(channel0_recv, channel0_send, remote_addr);
let channel0_conn = Connection::from_source(channel0_source, b"alknet/call".to_vec());
let channel0_conn = Connection::from_source(channel0_source, b"alk/call".to_vec());
let channel0_bidi = channel0_conn.accept_bi().await?;
let (single_stream_writer, single_stream_reader) =
crate::protocol::connection::split_single_stream(channel0_bidi);
@@ -165,7 +165,7 @@ impl ChannelClient {
/// `Connection` from these via `channel_source` and
/// `Connection::from_source`.
///
/// `alpn` is the data-plane ALPN (e.g. `alknet/tty`), used for
/// `alpn` is the data-plane ALPN (e.g. `alk/tty`), used for
/// observability in the local manager.
pub async fn open_channel(
&self,
@@ -346,15 +346,15 @@ mod tests {
let (client_end, server_end) = tokio::io::duplex(64 * 1024);
let client_conn =
Connection::from_bidi(client_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(client_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let server_conn =
Connection::from_bidi(server_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(server_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let adapter = ChannelsAdapter::new(
make_install_channel_zero(Arc::clone(&registry)),
Arc::new(NoCap),
);
let auth = AuthContext::anonymous(b"alknet/channels");
let auth = AuthContext::anonymous(b"alk/channels");
let _server_handle = tokio::spawn(async move {
let _ = crate::core::types::ProtocolHandler::handle(&adapter, server_conn, &auth).await;
});
@@ -388,15 +388,15 @@ mod tests {
let (client_end, server_end) = tokio::io::duplex(64 * 1024);
let client_conn =
Connection::from_bidi(client_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(client_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let server_conn =
Connection::from_bidi(server_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(server_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let adapter = ChannelsAdapter::new(
make_install_channel_zero(Arc::clone(&registry)),
Arc::new(NoCap),
);
let auth = AuthContext::anonymous(b"alknet/channels");
let auth = AuthContext::anonymous(b"alk/channels");
let _server_handle = tokio::spawn(async move {
let _ = crate::core::types::ProtocolHandler::handle(&adapter, server_conn, &auth).await;
});
@@ -471,15 +471,15 @@ mod tests {
let (client_end, server_end) = tokio::io::duplex(64 * 1024);
let client_conn =
Connection::from_bidi(client_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(client_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let server_conn =
Connection::from_bidi(server_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(server_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let adapter = ChannelsAdapter::new(
make_install_channel_zero(Arc::clone(&registry)),
Arc::new(NoCap),
);
let auth = AuthContext::anonymous(b"alknet/channels");
let auth = AuthContext::anonymous(b"alk/channels");
let _server_handle = tokio::spawn(async move {
let _ = crate::core::types::ProtocolHandler::handle(&adapter, server_conn, &auth).await;
});
@@ -584,15 +584,15 @@ mod tests {
let (client_end, server_end) = tokio::io::duplex(64 * 1024);
let client_conn =
Connection::from_bidi(client_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(client_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let server_conn =
Connection::from_bidi(server_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(server_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let adapter = ChannelsAdapter::new(
make_install_channel_zero(Arc::clone(&registry)),
Arc::new(NoCap),
);
let auth = AuthContext::anonymous(b"alknet/channels");
let auth = AuthContext::anonymous(b"alk/channels");
let _server_handle = tokio::spawn(async move {
let _ = crate::core::types::ProtocolHandler::handle(&adapter, server_conn, &auth).await;
});
@@ -819,7 +819,7 @@ mod tests {
AccessControl::default(),
None,
)
.with_channel_open(ChannelOpenSpec::new("alknet/tty"));
.with_channel_open(ChannelOpenSpec::new("alk/tty"));
core.register_openable(
spec,
Arc::clone(&open_handler),
@@ -842,12 +842,12 @@ mod tests {
let (client_end, server_end) = tokio::io::duplex(64 * 1024);
let client_conn =
Connection::from_bidi(client_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(client_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let server_conn =
Connection::from_bidi(server_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(server_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let adapter = ChannelsAdapter::new(install_hook, Arc::new(NoCap));
let auth = AuthContext::anonymous(b"alknet/channels");
let auth = AuthContext::anonymous(b"alk/channels");
let _server_handle = tokio::spawn(async move {
let _ = crate::core::types::ProtocolHandler::handle(&adapter, server_conn, &auth).await;
});
@@ -926,12 +926,12 @@ mod tests {
assert!(dyn_policy.check_open(&alice).is_ok());
manager
.open_channel("alknet/tty", "alice", None)
.open_channel("alk/tty", "alice", None)
.await
.expect("open alice");
assert!(dyn_policy.check_open(&bob).is_ok());
manager
.open_channel("alknet/tty", "bob", None)
.open_channel("alk/tty", "bob", None)
.await
.expect("open bob");
@@ -988,9 +988,9 @@ mod tests {
let m3 = Arc::clone(&manager);
let (r1, r2, r3) = tokio::join!(
m1.open_channel("alknet/a", "alice", None),
m2.open_channel("alknet/b", "bob", None),
m3.open_channel("alknet/c", "carol", None),
m1.open_channel("alk/a", "alice", None),
m2.open_channel("alk/b", "bob", None),
m3.open_channel("alk/c", "carol", None),
);
let successes = [r1.is_ok(), r2.is_ok(), r3.is_ok()]
@@ -1135,7 +1135,7 @@ mod tests {
AccessControl::default(),
None,
)
.with_channel_open(ChannelOpenSpec::new("alknet/tty"));
.with_channel_open(ChannelOpenSpec::new("alk/tty"));
core.register_openable(
spec,
Arc::clone(&open_handler),
@@ -1157,12 +1157,12 @@ mod tests {
let (client_end, server_end) = tokio::io::duplex(64 * 1024);
let client_conn =
Connection::from_bidi(client_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(client_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let server_conn =
Connection::from_bidi(server_end, b"alknet/channels".to_vec(), Some(TEST_ADDR));
Connection::from_bidi(server_end, b"alk/channels".to_vec(), Some(TEST_ADDR));
let adapter = ChannelsAdapter::new(install_hook, Arc::new(NoCap));
let auth = AuthContext::anonymous(b"alknet/channels");
let auth = AuthContext::anonymous(b"alk/channels");
let _server_handle = tokio::spawn(async move {
let _ = crate::core::types::ProtocolHandler::handle(&adapter, server_conn, &auth).await;
});
@@ -1175,7 +1175,7 @@ mod tests {
.open_channel(
"channels/tty/sub",
serde_json::json!({ "container": "abc" }),
"alknet/tty",
"alk/tty",
)
.await
.expect("open_channel");