Watch
0
0
Fork
You've already forked hyperhive
0

agent_icon: the subject's docs no longer mention a writer that publishes directly

This commit is contained in:
iris 2026-11-16 23:45:09 +01:00 • committed by mara
commit f8a0388457

View file

@ -40,8 +40,8 @@ pub const MEDIA_TYPE: &str = "image/svg+xml";
/// The subject `agent`'s entry is written on: `$KV.<bucket>.<key>`, where the /// The subject `agent`'s entry is written on: `$KV.<bucket>.<key>`, where the
/// key is the agent name and nothing else. /// key is the agent name and nothing else.
/// ///
/// A KV put is a `JetStream` publish to this subject, so a writer that /// A KV put is a `JetStream` publish to this subject, and the bucket's `get`
/// publishes directly has to use the same subject the bucket's `get` reads. /// reads the same one.
#[must_use] #[must_use]
pub fn subject(agent: &str) -> String { pub fn subject(agent: &str) -> String {
format!("$KV.{BUCKET}.{agent}") format!("$KV.{BUCKET}.{agent}")
@ -51,9 +51,8 @@ pub fn subject(agent: &str) -> String {
mod tests { mod tests {
use super::subject; use super::subject;
/// One token after the bucket, the agent name alone. That is what the /// One token after the bucket, the agent name alone: no hive in the key, so
/// per-agent grant `$KV.agent-icons.{agent}` expands to, and what a /// a hive-scoped subject (`$KV.<bucket>.<hive>.*`, two tokens) cannot match.
/// hive-scoped grant (`$KV.<bucket>.<hive>.*`, two tokens) cannot match.
#[test] #[test]
fn the_published_subject_carries_the_agent_and_no_placement() { fn the_published_subject_carries_the_agent_and_no_placement() {
assert_eq!(subject("iris"), "$KV.agent-icons.iris"); assert_eq!(subject("iris"), "$KV.agent-icons.iris");