6 Commits
Author SHA1 Message Date
jackos1998andClaude Opus 5.5 c516409f9a release: Bump to 0.2.0
CI / Check (pull_request) Successful in 5m4s
CI / Check (push) Successful in 4m49s
Recipients named by their comments in the rules, and the audit history
showing what approvers saw as they saw it. Both are compatible: old
audit records still read, and the builder's new field has a default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:36:07 +00:00
jackos1998andClaude Opus 5.5 0b2cdf4155 web: Show history details as approvals show them
CI / Check (push) Successful in 4m44s
The audit log kept a request's detail as text, so the web app's history
showed it as one preformatted block. Keep the structure instead, and
render it with the same fields, tables and coloured diffs as a pending
request. Older records' text still reads, as a text section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:34:58 +00:00
jackos1998andClaude Opus 5.5 9d08b5cf8f secret: Name recipients by their comments in the rules
CI / Check (pull_request) Successful in 4m44s
CI / Check (push) Successful in 4m49s
Approvals could only name recipients listed in the broker's config, so
host keys showed abbreviated. The builder already evaluates the main
branch's rules; take names from the SSH keys' comments there too
(`ssh-ed25519 AAAA… shill`), which age ignores. Every path's keys
count, so a key added to a secret is named as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:28:10 +00:00
slop-cannon Botandjackos1998 50b3103b9f deploy: Label unchanged versions and bump to 0.1.1
CI / Check (push) Successful in 4m45s
Show `unchanged` in the deployment approval's Version column when Nix
reports a size change for the same version. Keep colour-formatted sizes
in the Size column and render them as plain text.

Bump Cargo and its lock entry to `0.1.1`. The first release tag used
the package version already shipped by nixfiles, so that update
produced no package version delta. After this lands and passes CI,
tag `v0.1.1` and update the nixfiles pin.

---------

Co-authored-by: Jack O'Sullivan <jackos1998@gmail.com>
Reviewed-on: #6
Co-authored-by: slop-cannon <slop-cannon@nul.ie>
2026-11-26 22:51:19 +00:00
jackos1998 e59d5d377e release: Derive the Nix version from Cargo
CI / Check (pull_request) Successful in 4m43s
CI / Check (push) Successful in 5m43s
2026-11-26 21:48:34 +00:00
jackos1998 5123ba7643 ci: Check branch changes once per pull request 2026-11-26 21:47:57 +00:00
18 changed files with 196 additions and 41 deletions

No files matched your search

+3 -2
View File
@@ -2,6 +2,7 @@ name: CI
on:
push:
branches: [main]
pull_request:
jobs:
@@ -18,7 +19,7 @@ jobs:
extra-conf: |
sandbox-fallback = false
# Builds the package with its tests, clippy, rustfmt and the VM test (which needs KVM), and
# evaluates the other outputs
# Builds the package with its tests, runs clippy, rustfmt, shellcheck and the VM test
# (which needs KVM), and evaluates the other outputs
- name: Check the flake
run: nix flake check -L
+2 -1
View File
@@ -39,7 +39,8 @@ of devenv's scripts, `devenv test` or the demo's host side.
errors) and the tests.
- `cargo fmt` — the crate is formatted with `rustfmt` (`rustfmt.toml`); run it on code you change.
- `nix build` — the package, which also runs the tests.
- CI ([`.gitea/workflows/ci.yaml`](.gitea/workflows/ci.yaml)) runs `nix flake check` on every push:
- CI ([`.gitea/workflows/ci.yaml`](.gitea/workflows/ci.yaml)) runs `nix flake check` for pull
requests and pushes to `main`:
the package with its tests, `clippy` (warnings as errors), `fmt` (`cargo fmt --check`),
`shellcheck` on `src/**/*.sh` and the VM test. Keep them passing. `nix flake check --no-build`
fails where the VM test's keys haven't been built, because the test reads them at evaluation.
Generated
+1 -1
View File
@@ -3859,7 +3859,7 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "slop-broker"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"age",
"anyhow",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "slop-broker"
version = "0.1.0"
version = "0.2.0"
edition = "2024"
description = "Approval broker that runs privileged operations for coding agents"
license = "MIT"
+14
View File
@@ -45,6 +45,20 @@ The development environment is [devenv](https://devenv.sh): direnv with `.envrc`
and `cargo clippy --all-targets` work there, `devenv test` runs both, and `vm-test` runs the NixOS
VM test (needs KVM). See [`AGENTS.md`](AGENTS.md) for conventions.
## Releasing
Use SemVer for the CLI, request protocol and Nix module options. Bump the patch for
compatible fixes and the minor for compatible features. While the major is zero,
use a minor bump for breaking changes and document how to upgrade. After `1.0.0`,
bump the major for breaking changes.
1. Set `package.version` in `Cargo.toml` and run `cargo check` to refresh
`Cargo.lock`. The Nix package reads the version from `Cargo.toml`.
2. After the release commit lands on `main` and passes CI, tag it `v<version>` and
push the tag. Keep published tags fixed.
3. Update the `slop-broker` input in nixfiles to `ref=refs/tags/v<version>` and run
`nix flake update slop-broker` there to refresh its lock entry.
## License
MIT; see [`LICENSE`](LICENSE).
+6 -3
View File
@@ -328,8 +328,9 @@ operation, and nothing acts on the structure besides showing it.
Each request, decision, approver, lease use and result is an event with the request's ID. The
broker writes it to the journal as a line of text and to `audit.jsonl` in its state directory as a
line of JSON. `slop-approve log [-n 50] [--json]` shows the recent events through the approve
socket, with each request's full detail. Secret operations record the file and the blob ID of the
line of JSON, keeping what approvers were shown with its structure, so the web app's history shows
it as the request did. `slop-approve log [-n 50] [--json]` shows the recent events through the
approve socket, with each request's full detail. Secret operations record the file and the blob ID of the
ciphertext they were sent, never values.
## Operations
@@ -511,7 +512,9 @@ only people should be able to push to, and the approval shows what that branch s
in the rules, added or removed; or that the path isn't in the rules.
- Only the protected branch's Nix is evaluated, never a requester's commit, so this doesn't need
the builder approval.
- `secrets.names` labels well-known keys (such as people's); other keys are shown abbreviated.
- Keys are labelled by name from `secrets.names` (well-known keys, such as people's), then from
SSH keys' comments anywhere in the branch's rules (`ssh-ed25519 AAAA… shill`, which age
ignores). Other keys are shown abbreviated.
- **The broker's own key.** The broker always adds it to the recipients, and says so, so it can
change the file later.
- **Sensitive requests.** Requests that read a secret, change who can read one or name content as
+1 -1
View File
@@ -4,7 +4,7 @@ let
in
rustPlatform.buildRustPackage {
pname = "slop-broker";
version = "0.1.0";
inherit ((builtins.fromTOML (builtins.readFile ../Cargo.toml)).package) version;
src = toSource {
root = ../.;
+53 -6
View File
@@ -10,6 +10,7 @@ use std::time::SystemTime;
use anyhow::Result;
use serde::{Deserialize, Serialize};
use crate::detail::{Detail, Section};
use crate::proto::ApprovedBy;
/// One line of the audit file.
@@ -40,14 +41,14 @@ pub enum Event {
requester: String,
op: String,
summary: String,
detail: String,
detail: Shown,
/// Agent-supplied.
label: Option<String>,
},
/// What approvers are shown once preparing a request (such as building a deploy) finished.
Prepared {
id: String,
detail: String,
detail: Shown,
},
Approved {
id: String,
@@ -100,6 +101,39 @@ impl Event {
}
}
/// What approvers were shown of a request. Records from before the broker kept the structure
/// have its text.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Shown {
Detail(Detail),
Text(String),
}
impl Shown {
pub fn to_text(&self) -> String {
match self {
Shown::Detail(detail) => detail.to_text(),
Shown::Text(text) => text.clone(),
}
}
/// The structure, with old records' text as one text section.
pub fn to_detail(&self) -> Detail {
match self {
Shown::Detail(detail) => detail.clone(),
Shown::Text(text) if text.is_empty() => Detail::default(),
Shown::Text(text) => Detail { fields: vec![], sections: vec![Section::text("Text", text)] },
}
}
}
impl From<Detail> for Shown {
fn from(detail: Detail) -> Shown {
Shown::Detail(detail)
}
}
/// Request IDs are long; approvers type a prefix, and logs show the same.
pub fn short(id: &str) -> &str {
&id[..id.len().min(6)]
@@ -115,7 +149,7 @@ impl fmt::Display for Event {
}
Event::Request { id, requester, summary, detail, label, .. } => {
write!(f, "{} {requester} asks: {summary}", short(id))?;
if let Some(line) = detail.lines().next() {
if let Some(line) = detail.to_text().lines().next() {
write!(f, "; {line}")?;
}
if let Some(label) = label {
@@ -125,7 +159,7 @@ impl fmt::Display for Event {
}
Event::Prepared { id, detail } => {
write!(f, "{} ready for approval", short(id))?;
if let Some(line) = detail.lines().next() {
if let Some(line) = detail.to_text().lines().next() {
write!(f, "; {line}")?;
}
Ok(())
@@ -165,7 +199,7 @@ impl Record {
let time = self.time.replace('T', " ").trim_end_matches('Z').to_owned();
let mut text = format!("{time} {}\n", self.event);
if let Event::Request { detail, .. } | Event::Prepared { detail, .. } = &self.event {
for line in detail.lines().skip(1) {
for line in detail.to_text().lines().skip(1) {
text += &format!("{:21}{line}\n", "");
}
}
@@ -248,7 +282,7 @@ mod tests {
requester: "slop-cannon".into(),
op: "ssh".into(),
summary: "ssh river".into(),
detail: "Command: a\nmore".into(),
detail: Shown::Text("Command: a\nmore".into()),
label: Some("why".into()),
},
};
@@ -258,4 +292,17 @@ mod tests {
\x20 more\n"
);
}
#[test]
fn keeps_what_approvers_saw_and_reads_old_text() {
let detail = Detail::code("Command", "uptime");
let event = Event::Prepared { id: "a".into(), detail: detail.clone().into() };
let line = serde_json::to_string(&event).unwrap();
assert_eq!(serde_json::from_str::<Event>(&line).unwrap(), event);
let old: Event = serde_json::from_str(r#"{"event":"prepared","id":"a","detail":"Command: uptime"}"#).unwrap();
let Event::Prepared { detail: old, .. } = old else { panic!("{old:?}") };
assert_eq!(old, Shown::Text("Command: uptime".into()));
assert_eq!(old.to_text(), detail.to_text());
}
}
+16 -1
View File
@@ -103,6 +103,9 @@ pub struct SecretContext {
pub paths: Vec<String>,
/// The path's recipients in the branch's rules file, or `None` if it has no entry.
pub recipients: Option<Vec<String>>,
/// Keys by name, from SSH keys' comments anywhere in the rules file.
#[serde(default)]
pub names: BTreeMap<String, String>,
}
/// A commit as approvers see it before anything is built. Everything but `on_branch` is
@@ -524,7 +527,19 @@ async fn secret_context(config: &BuilderConfig, request: &SecretRequest) -> Resu
let rules = rules(config, &commit, &request.rules).await?;
let recipients = rules.get(&*request.path).cloned();
Ok(SecretContext { branch: config.branch.clone(), commit, paths, recipients })
let names = commented(rules.values().flatten());
Ok(SecretContext { branch: config.branch.clone(), commit, paths, recipients, names })
}
/// SSH keys by their comments, like `ssh-ed25519 AAAA… shill`; age ignores the comment.
fn commented<'a>(keys: impl Iterator<Item = &'a String>) -> BTreeMap<String, String> {
keys.filter_map(|key| match key.split_whitespace().collect::<Vec<_>>().as_slice() {
[kind, key, comment @ ..] if kind.starts_with("ssh-") && !comment.is_empty() => {
Some((comment.join(" "), format!("{kind} {key}")))
}
_ => None,
})
.collect()
}
/// Paths in `git ls-tree -r -z` output whose object is `blob`.
+2 -2
View File
@@ -1,6 +1,6 @@
//! What approvers are shown of a request: fields, then tables, lists and text. Operations build
//! it; every surface renders it. The web app shows the structure, the others [`Detail::to_text`],
//! which is also what the audit log keeps and passkey confirmations fingerprint.
//! it; every surface renders it. The web app shows the structure (also in the audit history,
//! which keeps it), the others [`Detail::to_text`], which passkey confirmations fingerprint.
//!
//! The structure is the same for every operation, so surfaces don't need to know any of them.
//! All of it can carry agent-written text, which every surface makes printable when it shows it.
+20 -6
View File
@@ -417,12 +417,24 @@ impl Changes {
/// and size change.
fn package_cells(line: &str) -> [&str; 3] {
let Some((name, rest)) = line.split_once(": ") else { return [line, "", ""] };
let is_size = |s: &str| s.starts_with(['+', '-']);
match rest.rsplit_once(", ") {
Some((version, size)) if is_size(size) => [name, version, size],
_ if is_size(rest) => [name, "", rest],
_ => [name, rest, ""],
if let Some((version, size)) = rest.rsplit_once(", ")
&& let Some(size) = package_size(size)
{
return [name, version, size];
}
if let Some(size) = package_size(rest) {
return [name, "unchanged", size];
}
[name, rest, ""]
}
fn package_size(value: &str) -> Option<&str> {
// Some Nix versions indicate the direction with colour even on piped output.
value
.strip_prefix("\x1b[31;1m")
.or_else(|| value.strip_prefix("\x1b[32;1m"))
.and_then(|size| size.strip_suffix("\x1b[0m"))
.or_else(|| value.starts_with(['+', '-']).then_some(value))
}
#[cfg(test)]
@@ -432,7 +444,9 @@ mod tests {
#[test]
fn splits_package_lines() {
assert_eq!(package_cells("a: 1.0 → 1.1, +3.4 KiB"), ["a", "1.0 → 1.1", "+3.4 KiB"]);
assert_eq!(package_cells("b: -12.0 KiB"), ["b", "", "-12.0 KiB"]);
assert_eq!(package_cells("b: -12.0 KiB"), ["b", "unchanged", "-12.0 KiB"]);
assert_eq!(package_cells("b: \x1b[31;1m12.0 KiB\x1b[0m"), ["b", "unchanged", "12.0 KiB"]);
assert_eq!(package_cells("b: 1.0 → 1.1, \x1b[32;1m-12.0 KiB\x1b[0m"), ["b", "1.0 → 1.1", "-12.0 KiB"]);
assert_eq!(package_cells("c: ∅ → 2.0"), ["c", "∅ → 2.0", ""]);
assert_eq!(package_cells("odd"), ["odd", "", ""]);
}
+22 -1
View File
@@ -152,7 +152,8 @@ fn describe(op: &SecretOp, context: &SecretContext, config: &SecretsConfig, own:
if let Some(requested) = op.recipients() {
let (recipients, added) = with_own(requested, own);
let rules = &config.rules;
let label = |r: &Recipient| label(r, &config.names);
let names = names(config, context);
let label = |r: &Recipient| label(r, &names);
let rows: Vec<Row> = match context.recipients.as_ref().map(|keys| expected(keys)) {
Some(expected) => {
@@ -216,6 +217,17 @@ fn same(a: &[Recipient], b: &[Recipient]) -> bool {
a.iter().all(|r| b.contains(r)) && b.iter().all(|r| a.contains(r))
}
/// The configured names, then the comments on the main branch's keys.
fn names(config: &SecretsConfig, context: &SecretContext) -> BTreeMap<String, Recipient> {
let mut names = config.names.clone();
for (name, key) in &context.names {
if let Ok(key) = Recipient::normalize(key) {
names.entry(name.clone()).or_insert(key);
}
}
names
}
fn label(recipient: &Recipient, names: &BTreeMap<String, Recipient>) -> String {
names.iter().find(|(_, r)| *r == recipient).map_or_else(|| recipient.abbreviated(), |(name, _)| name.clone())
}
@@ -412,6 +424,7 @@ mod tests {
commit: "0123456789abcdef0123456789abcdef01234567".parse().unwrap(),
paths: paths.iter().map(|p| p.to_string()).collect(),
recipients,
names: BTreeMap::new(),
}
}
@@ -528,6 +541,14 @@ mod tests {
let (detail, sensitive) = describe(&set(vec![dev.clone()]), &context(&[], None), &config, &own);
assert!(sensitive && detail.to_text().contains("isn't in secrets.nix"), "{}", detail.to_text());
// The main branch's key comments name recipients, though not over the configured names.
let mut named = context(&[], Some(vec![dev.to_string()]));
named.names = BTreeMap::from([("box".into(), host.to_string()), ("not-dev".into(), dev.to_string())]);
named.names.insert("bad".into(), "nonsense".into());
let (detail, _) = describe(&set(vec![host.clone(), dev.clone()]), &named, &config, &own);
let labels: Vec<_> = statuses(&detail).into_iter().map(|(label, ..)| label).collect();
assert_eq!(labels, ["box".to_owned(), "dev".to_owned(), own.abbreviated()]);
}
/// Each recipient row's key, status and tone.
+3 -3
View File
@@ -195,7 +195,7 @@ async fn process(broker: &Broker, requester: &str, request: Request, io: &mut Io
requester: requester.to_owned(),
op: parsed.op.to_string(),
summary: parsed.summary.clone(),
detail: parsed.detail.to_text(),
detail: parsed.detail.clone().into(),
label: label.clone(),
});
@@ -239,7 +239,7 @@ async fn process(broker: &Broker, requester: &str, request: Request, io: &mut Io
Ok(gate) => gate,
Err(error) => return failed(error),
};
log(Event::Prepared { id: id.clone(), detail: gate.detail.to_text() });
log(Event::Prepared { id: id.clone(), detail: gate.detail.clone().into() });
let (by, approver) = match authorize(broker, &id, requester, &gate, label.clone(), io).await {
Ok(Some(approval)) => approval,
@@ -263,7 +263,7 @@ async fn process(broker: &Broker, requester: &str, request: Request, io: &mut Io
return failed(error);
}
log(Event::Prepared { id: id.clone(), detail: parsed.detail.to_text() });
log(Event::Prepared { id: id.clone(), detail: parsed.detail.clone().into() });
}
let (approved_by, approver) = match authorize(broker, &id, requester, &parsed, label, io).await {
+11 -8
View File
@@ -1,7 +1,8 @@
//! The audit log gathered by request: what was asked, who approved it and how it ended.
use std::collections::HashMap;
use crate::audit::{Event, Record};
use crate::audit::{Event, Record, Shown};
use crate::detail::Detail;
use crate::proto::ApprovedBy;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -165,8 +166,8 @@ fn summarize(id: String, records: Vec<Record>) -> History {
history
}
/// One event in a request's timeline: what happened, and any longer text to show with it.
pub fn describe(event: &Event) -> (String, Option<String>) {
/// One event in a request's timeline: what happened, and what approvers were shown with it.
pub fn describe(event: &Event) -> (String, Option<Detail>) {
match event {
Event::Unknown { peer } => (format!("Refused a connection from {peer}"), None),
Event::Invalid { error, .. } => (format!("Invalid request: {error}"), None),
@@ -175,11 +176,9 @@ pub fn describe(event: &Event) -> (String, Option<String>) {
if let Some(label) = label {
text += &format!(" (label: {label})");
}
(text, Some(detail.clone()).filter(|d| !d.is_empty()))
}
Event::Prepared { detail, .. } => {
("Prepared for approval".into(), Some(detail.clone()).filter(|d| !d.is_empty()))
(text, shown(detail))
}
Event::Prepared { detail, .. } => ("Prepared for approval".into(), shown(detail)),
Event::Approved { by, approver, step, .. } => {
let by = match (by, approver) {
(ApprovedBy::Policy, _) => "policy".to_owned(),
@@ -204,6 +203,10 @@ pub fn describe(event: &Event) -> (String, Option<String>) {
}
}
fn shown(detail: &Shown) -> Option<Detail> {
Some(detail.to_detail()).filter(|d| !d.fields.is_empty() || !d.sections.is_empty())
}
#[cfg(test)]
mod tests {
use super::*;
@@ -218,7 +221,7 @@ mod tests {
requester: "slop-cannon".into(),
op: "ssh".into(),
summary: format!("ssh {id}"),
detail: "Command: uptime".into(),
detail: Detail::code("Command", "uptime").into(),
label: None,
}
}
+32 -1
View File
@@ -67,7 +67,7 @@ fn section_titles(detail: &Detail) -> String {
detail.sections.iter().map(Section::title).collect::<Vec<_>>().join(", ")
}
fn describe(record: &Record) -> (String, Option<String>) {
fn describe(record: &Record) -> (String, Option<Detail>) {
history::describe(&record.event)
}
@@ -270,4 +270,35 @@ mod tests {
assert!(html.contains("needs-passkey"));
assert!(html.contains("Needs passkey"));
}
#[test]
fn history_shows_what_approvers_saw() {
use crate::audit::{Event, Record, Shown};
let mut detail = Detail::code("Command", "uptime");
detail.section(Section::diff("Diff", "@@ -1 +1 @@\n-b\n+a"));
let records = vec![
Record {
time: "2026-11-27T10:00:00Z".into(),
event: Event::Request {
id: "abc".into(),
requester: "slop-cannon".into(),
op: "ssh".into(),
summary: "ssh river".into(),
detail: detail.into(),
label: None,
},
},
Record {
time: "2026-11-27T10:00:01Z".into(),
event: Event::Prepared { id: "abc".into(), detail: Shown::Text("Old: text".into()) },
},
];
let (histories, _) = super::history::gather(records);
let html = request("broker", "token", "abc", None, Some(&histories[0]), 0).0;
assert!(html.contains("<dt>Command</dt><dd class=\"neutral\"><code>uptime</code></dd>"), "{html}");
assert!(html.contains("<span class=\"diff-add\">+a</span>"), "{html}");
assert!(html.contains("Details (Text)") && html.contains("<pre>Old: text</pre>"), "{html}");
}
}
+1 -1
View File
@@ -80,7 +80,7 @@
{% for record in records %}
{% let (text, detail) = self::describe(record) %}
<li>{% call time(record.time) %}{% endcall %} <span>{{ text }}</span>
{%- if let Some(detail) = detail %}<details><summary>Details</summary><pre>{{ detail }}</pre></details>{% endif %}</li>
{%- if let Some(detail) = detail %}{% call detail(detail, false) %}{% endcall %}{% endif %}</li>
{% endfor %}
</ol>
{% endmacro %}
+1 -1
View File
@@ -237,7 +237,7 @@ async fn approvers_see_the_whole_command_and_stdin_that_run() {
// So is the audit log.
let records = broker.audit.tail(10).unwrap();
let slop_broker::audit::Event::Request { detail: logged, .. } = &records[0].event else { panic!("{records:?}") };
assert_eq!(*logged, detail);
assert_eq!(logged.to_text(), detail);
// Multi-line commands are shown as text rather than a one-line field.
let mut client = Client::start(&broker, ssh(&["echo one\necho two"])).await;
+7 -2
View File
@@ -122,13 +122,16 @@ fn secrets_are_looked_up_on_the_branch() {
git(&work, &["init", "--quiet", "--initial-branch=master"]);
std::fs::write(work.join("secrets/a.age"), "age-encryption.org/v1\nreal\n").unwrap();
std::fs::write(work.join("secrets/copy.age"), "age-encryption.org/v1\nreal\n").unwrap();
std::fs::write(work.join("secrets.nix"), "{ \"secrets/a.age\".publicKeys = [ \"age1dev\" ]; }\n").unwrap();
let rules = |keys: &str| {
format!("{{ \"secrets/a.age\".publicKeys = [ \"age1dev\" ]; \"secrets/b.age\".publicKeys = [ {keys} ]; }}\n")
};
std::fs::write(work.join("secrets.nix"), rules("\"ssh-ed25519 AAAA box\"")).unwrap();
git(&work, &["add", "."]);
git(&work, &["commit", "--quiet", "-m", "Secrets"]);
// An agent's branch can't change what the main branch says.
git(&work, &["checkout", "--quiet", "-b", "agent"]);
std::fs::write(work.join("secrets.nix"), "{ \"secrets/a.age\".publicKeys = [ \"age1agent\" ]; }\n").unwrap();
std::fs::write(work.join("secrets.nix"), rules("\"ssh-ed25519 AAAA box\" \"ssh-ed25519 BBBB box\"")).unwrap();
git(&work, &["commit", "--quiet", "-am", "Change the rules"]);
let state = directory.path().join("state");
@@ -154,6 +157,8 @@ fn secrets_are_looked_up_on_the_branch() {
let context: SecretContext = ask(&config, &BuilderRequest::Secret(request.clone()));
assert_eq!(context.paths, ["secrets/a.age", "secrets/copy.age"]);
assert_eq!(context.recipients, Some(vec!["age1dev".to_owned()]));
// Names come from comments on every path's keys.
assert_eq!(context.names, std::collections::BTreeMap::from([("box".to_owned(), "ssh-ed25519 AAAA".to_owned())]));
assert_eq!(&*context.commit, git(&work, &["rev-parse", "master"]));
let unknown = SecretRequest { blob: None, path: "secrets/new.age".parse().unwrap(), ..request };