rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 heartwoode20211a7d36464e3e1dfb3dc7b468f492587615f
{
"request": "trigger",
"version": 1,
"event_type": "patch",
"repository": {
"id": "rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5",
"name": "heartwood",
"description": "Radicle Heartwood Protocol & Stack",
"private": false,
"default_branch": "master",
"delegates": [
"did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT",
"did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz"
]
},
"action": "Created",
"patch": {
"id": "bea09df15505cfcebc72ad40f629747d2e82f670",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"title": "Introduce Canonical Reference Rules",
"state": {
"status": "merged",
"conflicts": []
},
"before": "e30e66e009393ee4b25692581a37f42320725085",
"after": "e20211a7d36464e3e1dfb3dc7b468f492587615f",
"commits": [
"e20211a7d36464e3e1dfb3dc7b468f492587615f",
"68fe9fd588dfcedfe87f43c1ea0bfe61a84d9e54",
"cf77406758bd624f2567aebe627e5e8951f46413",
"56f3af445ae64ef1a904046fd3f89132338eafe0",
"8110f7b4ed83d63bfafd05f32801795e3a0c6258",
"f7c5e03456c491fea7c3aa8a0c06fe72e606299c"
],
"target": "3fc92f83fe089263c470b328414d923227cf0e4a",
"labels": [],
"assignees": [],
"revisions": [
{
"id": "bea09df15505cfcebc72ad40f629747d2e82f670",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Introduce canonical reference rules via a payload entry in the identity\ndocument. The payload is identified by `xyz.radicle.crefs`, and the payload\ncurrently contains one key `rules`, which is followed by the set of rules. For\neach rule, there is a reference pattern string to identify the rule, which in\nturn is composed of the `allow` and `threshold` values. The canonical reference\nrules are now used to check for canonical updates. However, if none are\navailable, then the `threshold`, `delegates`, and the project `defaultBranch`\nare used to construct a single rule for the default branch as a fallback. **Note\nthat if the rules are present, and there is no default branch rule then the\ncanonical reference for the default branch will not be computed**.",
"base": "e30e66e009393ee4b25692581a37f42320725085",
"oid": "c7d8494bba0989cd30af9649a1914dcca80509ec",
"timestamp": 1750249544
},
{
"id": "e1843518fed7d26055d74adff23b920f9ab201fb",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Introduce canonical reference rules via a payload entry in the identity\ndocument. The payload is identified by `xyz.radicle.crefs`, and the payload\ncurrently contains one key `rules`, which is followed by the set of rules. For\neach rule, there is a reference pattern string to identify the rule, which in\nturn is composed of the `allow` and `threshold` values. The canonical\nreference rules are now used to check for canonical updates. The rule for the\n`defaultBranch` of an `xyz.radicle.project` is synthesized from the identity\ndocument fields: `threshold` and `delegates`. This means that a rule for that\nreference is not allowed within the rule set. This checked when performing a\n`rad id update`.\n\nChanges from previous revision:\n- Checks against default branch when updating\n- Refactors business logic away from the CLI into an `doc::update` module\n- Includes pushing canonical tag example\n- Reword CHANGELOG entry",
"base": "e30e66e009393ee4b25692581a37f42320725085",
"oid": "924a75d1b0b5a1149c34d51064d9ec94a8249f99",
"timestamp": 1750411367
},
{
"id": "1a117d1d8aa9b8fb9b4149bca07f0df4e35252d9",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Changes:\n- Report matched rules when checking default branch\n- Remove erroneous `eprintln`\n- Reword to `commit for canonical reference`\n- Reword docs for `Allowed::Set`\n- Remove erroneous `no_run`",
"base": "e30e66e009393ee4b25692581a37f42320725085",
"oid": "e20211a7d36464e3e1dfb3dc7b468f492587615f",
"timestamp": 1750420942
},
{
"id": "977dfa45912cf6b88e9be818cb2714dfbcbe5dae",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Minor changes to wording, do not say \"canonical head\" but \"canonical reference\". Rebase.",
"base": "fb8681f5bc5460a7970f023d61b272d0a1474711",
"oid": "408d4f27e7ef6a56ca1998802c4e8feb9da991ac",
"timestamp": 1752677819
}
]
}
}
{
"response": "triggered",
"run_id": {
"id": "500dc881-7831-42c0-b3ab-36f51233656f"
},
"info_url": "https://cci.rad.levitte.org//500dc881-7831-42c0-b3ab-36f51233656f.html"
}
Started at: 2026-09-08 03:12:35.893464+02:00
Commands:
$ rad clone rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 .
✓ Creating checkout in ./...
✓ Remote cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT added
✓ Remote-tracking branch cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/master created for z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT
✓ Remote fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM added
✓ Remote-tracking branch fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM/master created for z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM
✓ Remote lorenz@z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz added
✓ Remote-tracking branch lorenz@z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz/master created for z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz
✓ Repository successfully cloned under /opt/radcis/ci.rad.levitte.org/cci/state/500dc881-7831-42c0-b3ab-36f51233656f/w/
╭────────────────────────────────────╮
│ heartwood │
│ Radicle Heartwood Protocol & Stack │
│ 189 issues · 38 patches │
╰────────────────────────────────────╯
Run `cd ./.` to go to the repository directory.
Exit code: 0
$ rad patch checkout bea09df15505cfcebc72ad40f629747d2e82f670
✓ Switched to branch patch/bea09df at revision 1a117d1
✓ Branch patch/bea09df setup to track rad/patches/bea09df15505cfcebc72ad40f629747d2e82f670
Exit code: 0
$ git config advice.detachedHead false
Exit code: 0
$ git checkout e20211a7d36464e3e1dfb3dc7b468f492587615f
HEAD is now at e20211a7 chore: add canonical references to CHANGELOG
Exit code: 0
$ rad patch show bea09df15505cfcebc72ad40f629747d2e82f670 -p
╭──────────────────────────────────────────────────────────────────────────────────╮
│ Title Introduce Canonical Reference Rules │
│ Patch bea09df15505cfcebc72ad40f629747d2e82f670 │
│ Author fintohaps z6Mkire…SQZ3voM │
│ Head e20211a7d36464e3e1dfb3dc7b468f492587615f │
│ Base e30e66e009393ee4b25692581a37f42320725085 │
│ Target master │
│ Branches patch/bea09df │
│ Commits ahead 6, behind 1023 │
│ Status merged │
│ │
│ Introduce canonical reference rules via a payload entry in the identity │
│ document. The payload is identified by `xyz.radicle.crefs`, and the payload │
│ currently contains one key `rules`, which is followed by the set of rules. For │
│ each rule, there is a reference pattern string to identify the rule, which in │
│ turn is composed of the `allow` and `threshold` values. The canonical reference │
│ rules are now used to check for canonical updates. However, if none are │
│ available, then the `threshold`, `delegates`, and the project `defaultBranch` │
│ are used to construct a single rule for the default branch as a fallback. **Note │
│ that if the rules are present, and there is no default branch rule then the │
│ canonical reference for the default branch will not be computed**. │
├──────────────────────────────────────────────────────────────────────────────────┤
│ e20211a chore: add canonical references to CHANGELOG │
│ 68fe9fd cli: test canonical tags │
│ cf77406 radicle: disallow default branch │
│ 56f3af4 cli: extract document update logic │
│ 8110f7b radicle: canonical references payload │
│ f7c5e03 radicle: canonical reference rules │
├──────────────────────────────────────────────────────────────────────────────────┤
│ ● Revision bea09df @ e30e66e..c7d8494 by fintohaps z6Mkire…SQZ3voM 1 year ago │
│ ↑ Revision e184351 @ e30e66e..924a75d by fintohaps z6Mkire…SQZ3voM 1 year ago │
│ ↑ Revision 1a117d1 @ e30e66e..e20211a by fintohaps z6Mkire…SQZ3voM 1 year ago │
│ ↑ Revision 977dfa4 @ fb8681f..408d4f2 by lorenz z6MkkPv…WX5sTEz 1 year ago │
│ └─ ✓ merged by lorenz z6MkkPv…WX5sTEz │
╰──────────────────────────────────────────────────────────────────────────────────╯
commit e20211a7d36464e3e1dfb3dc7b468f492587615f
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Wed Jun 18 11:07:06 2025 +0200
chore: add canonical references to CHANGELOG
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9f297bce..0591f4143 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+- Introduce canonical reference rules via a payload entry in the identity
+ document. The payload is identified by `xyz.radicle.crefs`, and the payload
+ currently contains one key `rules`, which is followed by the set of rules. For
+ each rule, there is a reference pattern string to identify the rule, which in
+ turn is composed of the `allow` and `threshold` values. The canonical
+ reference rules are now used to check for canonical updates. The rule for the
+ `defaultBranch` of an `xyz.radicle.project` is synthesized from the identity
+ document fields: `threshold` and `delegates`. This means that a rule for that
+ reference is not allowed within the rule set. This checked when performing a
+ `rad id update`.
+
## Release Highlights
## Deprecations
commit 68fe9fd588dfcedfe87f43c1ea0bfe61a84d9e54
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Wed Jun 18 14:36:19 2025 +0200
cli: test canonical tags
Add a test to exercise adding canonical reference rules and pushing new
canonical tags.
A change in `rad id` was required to allow adding a new payload to the document,
i.e. one that does not already exist.
Adding rules is also documented in the man page for `rad id`.
diff --git a/crates/radicle-cli/examples/git/git-push-canonical-tags.md b/crates/radicle-cli/examples/git/git-push-canonical-tags.md
new file mode 100644
index 000000000..78789369e
--- /dev/null
+++ b/crates/radicle-cli/examples/git/git-push-canonical-tags.md
@@ -0,0 +1,213 @@
+In this example, we will show how we can make other references become canonical.
+To illustrate, we will use Git tags as an example. The storage of the repository
+should look something like this by the end of the example:
+
+~~~
+storage/z6cFWeWpnZNHh9rUW8phgA3b5yGt/refs
+├── heads
+│ └── main
+├── namespaces
+│ ├── z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+│ │ └── refs
+│ │ ├── cobs
+│ │ │ └── xyz.radicle.id
+│ │ │ └── 865c48204bd7bb7f088b8db90ffdccb48cfa0a50
+│ │ ├── heads
+│ │ │ └── master
+│ │ ├── tags
+│ │ │ ├── v1.0-hotfix
+│ │ │ └── v1.0
+│ │ └── rad
+│ │ ├── id
+│ │ └── sigrefs
+│ └── z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
+│ └── refs
+│ ├── heads
+│ │ └── master
+│ ├── tags
+│ │ ├── v1.0-hotfix
+│ │ └── v1.0
+│ └── rad
+│ ├── id
+│ └── sigrefs
+├── rad
+│ └── id
+└── tags
+ ├── v1.0-hotfix
+ └── v1.0
+~~~
+
+Noting that there are tags under `refs/tags` now.
+
+To start, Alice will add a new payload to the repository identity. The
+identifier for this payload is `xyz.radicle.crefs`. It contains a single field
+with the key `rules`, and the value for this key is an array of rules. In this
+case, we will have two rules: one for `refs/tags/*` and one for `refs/tags/qa/*`
+(see RIP-0004 for more information on the rules).
+
+``` ~alice
+$ rad id update --title "Add canonical reference rules" --payload xyz.radicle.crefs rules '{ "refs/tags/*": { "threshold": 1, "allow": "delegates" }, "refs/tags/qa/*": { "threshold": 1, "allow": "delegates" }}'
+✓ Identity revision [..] created
+╭────────────────────────────────────────────────────────────────────────╮
+│ Title Add canonical reference rules │
+│ Revision c3349f07bfe6a82bbeb2989d2de4a918408f9831 │
+│ Blob 85fa09e2de93b825d5231778dbb34143004a4bca │
+│ Author did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │
+│ State accepted │
+│ Quorum yes │
+├────────────────────────────────────────────────────────────────────────┤
+│ ✓ did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi alice (you) │
+╰────────────────────────────────────────────────────────────────────────╯
+
+@@ -1,13 +1,25 @@
+ {
+ "payload": {
++ "xyz.radicle.crefs": {
++ "rules": {
++ "refs/tags/*": {
++ "allow": "delegates",
++ "threshold": 1
++ },
++ "refs/tags/qa/*": {
++ "allow": "delegates",
++ "threshold": 1
++ }
++ }
++ },
+ "xyz.radicle.project": {
+ "defaultBranch": "master",
+ "description": "Radicle Heartwood Protocol & Stack",
+ "name": "heartwood"
+ }
+ },
+ "delegates": [
+ "did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"
+ ],
+ "threshold": 1
+ }
+```
+
+Now, Alice will create a tag and push it:
+
+``` ~alice
+$ git tag v1.0-hotfix
+```
+
+``` ~alice (stderr)
+$ git push rad --tags
+✓ Canonical head for refs/tags/v1.0-hotfix updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
+✓ Synced with 1 seed(s)
+To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ * [new tag] v1.0-hotfix -> v1.0-hotfix
+```
+
+Notice that the output included a message about a canonical reference being
+updated:
+
+~~~
+✓ Canonical reference refs/tags/v1.0-hotfix updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
+~~~
+
+On the other side, Bob performs a fetch and now has the tags locally:
+
+``` ~bob (stderr)
+$ cd heartwood
+$ git fetch rad
+From rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji
+ * [new tag] v1.0-hotfix -> rad/tags/v1.0-hotfix
+ * [new tag] v1.0-hotfix -> v1.0-hotfix
+```
+
+In the next portion of this example, we want to show that using a `threshold` of
+`2` requires both delegates. To do this, Bob creates a `master` reference, Alice
+adds him as a remote, and adds him to the identity delegates, as well as setting
+the `threshold` to `2` for the `refs/tags/*` rule:
+
+``` ~bob
+$ rad remote add z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name alice
+✓ Follow policy updated for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (alice)
+Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
+✓ Target met: 1 seed(s)
+✓ Remote alice added
+✓ Remote-tracking branch alice/master created for z6MknSL…StBU8Vi
+$ git push rad master
+```
+
+``` ~alice
+$ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob
+✓ Follow policy updated for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob)
+Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
+✓ Target met: 1 seed(s)
+✓ Remote bob added
+✓ Remote-tracking branch bob/master created for z6Mkt67…v4N1tRk
+$ rad id update --title "Add Bob" --delegate did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --no-confirm -q
+27ab0d77a95581c59ca9d30e679ceb06a9f758db
+$ rad id update --title "Update canonical reference rules" --payload xyz.radicle.crefs rules '{ "refs/tags/*": { "threshold": 2, "allow": "delegates" }, "refs/tags/qa/*": { "threshold": 1, "allow": "delegates" } }' -q
+dace164ba43fa51802697ec28d0b1965a9d7808b
+```
+
+**Note:** here we have to specify all the rules again to update the `threshold`.
+In reality, you can use `rad id update --edit` and edit the payload in your
+editor instead.
+
+``` ~bob
+$ rad sync -f
+Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s).
+✓ Target met: 1 seed(s)
+🌱 Fetched from z6MknSL…StBU8Vi
+$ rad id accept dace164ba43fa51802697ec28d0b1965a9d7808b -q
+```
+
+When Bob creates a new tag and pushes it, we see that there's a warning that
+no quorum was found for the new tag:
+
+``` ~bob (stderr)
+$ git tag v2.0
+$ git push rad --tags
+warn: could not determine commit for canonical reference 'refs/tags/v2.0', no commit with at least 2 vote(s) found (threshold not met)
+warn: it is recommended to find a commit to agree upon
+✓ Synced with 1 seed(s)
+To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
+ * [new tag] v1.0-hotfix -> v1.0-hotfix
+ * [new tag] v2.0 -> v2.0
+```
+
+Alice can then fetch and checkout the new tag, create one on her side, and push
+it:
+
+``` ~alice (stderr)
+$ git fetch bob
+From rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
+ * [new tag] v1.0-hotfix -> bob/tags/v1.0-hotfix
+ * [new tag] v2.0 -> bob/tags/v2.0
+```
+
+``` ~alice
+$ git checkout bob/tags/v2.0
+$ git tag v2.0
+```
+
+``` ~alice (stderr)
+$ git push rad --tags
+✓ Canonical head for refs/tags/v2.0 updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
+✓ Synced with 1 seed(s)
+To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ * [new tag] v2.0 -> v2.0
+```
+
+Now that Bob has also pushed this tag, we can see that the tag was made
+canonical.
+
+For the final portion of the example, we will show that both delegates aren't
+required for pushing tags that match the rule `refs/tags/qa/*`. To show this,
+Bob will create a tag and push it, and we should see that the canonical
+reference is created:
+
+``` ~bob (stderr)
+$ git tag qa/v2.1
+$ git push rad --tags
+✓ Canonical head for refs/tags/qa/v2.1 updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
+✓ Synced with 1 seed(s)
+To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
+ * [new tag] qa/v2.1 -> qa/v2.1
+```
diff --git a/crates/radicle-cli/tests/commands.rs b/crates/radicle-cli/tests/commands.rs
index 548414d04..30631947b 100644
--- a/crates/radicle-cli/tests/commands.rs
+++ b/crates/radicle-cli/tests/commands.rs
@@ -3100,6 +3100,48 @@ fn git_tag() {
.unwrap();
}
+#[test]
+fn git_push_canonical_tags() {
+ let mut environment = Environment::new();
+ let alice = environment.node(Config::test(Alias::new("alice")));
+ let bob = environment.node(Config::test(Alias::new("bob")));
+ let working = environment.tmp().join("working");
+
+ let rid = RepoId::from_str("z42hL2jL4XNk6K8oHQaSWfMgCL7ji").unwrap();
+ fixtures::repository(working.join("alice"));
+
+ test(
+ "examples/rad-init.md",
+ working.join("alice"),
+ Some(&alice.home),
+ [],
+ )
+ .unwrap();
+
+ let alice = alice.spawn();
+ let mut bob = bob.spawn();
+
+ bob.connect(&alice).converge([&alice]);
+ bob.clone(rid, working.join("bob")).unwrap();
+ formula(
+ &environment.tmp(),
+ "examples/git/git-push-canonical-tags.md",
+ )
+ .unwrap()
+ .home(
+ "alice",
+ working.join("alice"),
+ [("RAD_HOME", alice.home.path().display())],
+ )
+ .home(
+ "bob",
+ working.join("bob"),
+ [("RAD_HOME", bob.home.path().display())],
+ )
+ .run()
+ .unwrap();
+}
+
#[test]
fn rad_workflow() {
let mut environment = Environment::new();
diff --git a/rad-id.1.adoc b/rad-id.1.adoc
index 91ab86430..73a57d2f7 100644
--- a/rad-id.1.adoc
+++ b/rad-id.1.adoc
@@ -18,7 +18,7 @@ rad-id - Manage changes to a Radicle repository's identity.
*rad id* _edit_ <revision-id> [--title <string>] [--description <string>] [<option>...] +
*rad id* _show_ <revision-id> [<option>...] +
*rad id* _accept_ | _reject_ <revision-id> [<option>...] +
-*rad id* _redact_ <revision-id> [<option>...]
+*rad id* _redact_ <revision-id> [<option>...] +
== Description
@@ -176,3 +176,49 @@ To remove a delegate and update the threshold, use the *--rescind* option:
As with adding a delegate, this change will require approval from the remaining
delegates. Make sure you set an appropriate new threshold when removing
delegates!
+
+=== Adding Canonical References Rules
+
+To update the canonical reference rules of the project, use the `--payload
+xyz.radicle.crefs` option while updating, `rules` as the key, and the rules
+object as the value. Here is an example below:
+
+ $ rad id update --title "Update canonical reference rules" \
+ --payload xyz.radicle.crefs rules '{
+ "refs/heads/master": { "threshold": 1, "allow": "delegates" },
+ "refs/tags/*": { "threshold": 2, "allow": "delegates" },
+ "refs/tags/qa/*": { "threshold": 1, "allow": "delegates" }
+ }'
+
+Alternatively, you can use the `--edit` option for the `update` command and edit
+the payload directly. Here is an example of what that may look like:
+
+ {
+ "payload": {
+ "xyz.radicle.crefs": {
+ "rules": {
+ "refs/heads/master": {
+ "allow": "delegates",
+ "threshold": 1
+ },
+ "refs/tags/*": {
+ "allow": "delegates",
+ "threshold": 1
+ },
+ "refs/tags/qa/*": {
+ "allow": "delegates",
+ "threshold": 1
+ }
+ }
+ },
+ "xyz.radicle.project": {
+ "defaultBranch": "master",
+ "description": "Radicle Heartwood Protocol & Stack",
+ "name": "heartwood"
+ }
+ },
+ "delegates": [
+ "did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"
+ ],
+ "threshold": 1
+ }
commit cf77406758bd624f2567aebe627e5e8951f46413
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Thu Jun 19 14:47:52 2025 +0200
radicle: disallow default branch
Ensure that the default branch is only ever synthesized from the `Doc`'s
`threshold` and `delegates` value. If the rule is ever written into a `RawDoc`,
then the update of the that `RawDoc` must go through the `update::veryify`
function, which checks that the rule is not present.
diff --git a/crates/radicle-node/src/worker/fetch/error.rs b/crates/radicle-node/src/worker/fetch/error.rs
index a9111a6a5..6c9d753f3 100644
--- a/crates/radicle-node/src/worker/fetch/error.rs
+++ b/crates/radicle-node/src/worker/fetch/error.rs
@@ -71,5 +71,5 @@ pub enum Canonical {
#[error(transparent)]
Identity(#[from] radicle::storage::RepositoryError),
#[error(transparent)]
- Payload(#[from] radicle::identity::PayloadError),
+ CanonicalRefs(#[from] radicle::identity::doc::CanonicalRefsError),
}
diff --git a/crates/radicle-remote-helper/src/push.rs b/crates/radicle-remote-helper/src/push.rs
index c03dce73d..b6f1e5fad 100644
--- a/crates/radicle-remote-helper/src/push.rs
+++ b/crates/radicle-remote-helper/src/push.rs
@@ -6,7 +6,7 @@ use std::str::FromStr;
use std::{assert_eq, io};
use radicle::identity::crefs::GetCanonicalRefs as _;
-use radicle::identity::doc::DefaultBranchRuleError;
+use radicle::identity::doc::CanonicalRefsError;
use radicle::node::device::Device;
use thiserror::Error;
@@ -118,7 +118,7 @@ pub enum Error {
#[error(transparent)]
Quorum(#[from] radicle::git::canonical::QuorumError),
#[error(transparent)]
- DefaultBranchRule(#[from] radicle::identity::doc::DefaultBranchRuleError),
+ CanonicalRefs(#[from] radicle::identity::doc::CanonicalRefsError),
}
/// Push command.
@@ -271,7 +271,7 @@ pub fn run(
let identity = stored.identity()?;
let crefs = identity.canonical_refs_or_default(|| {
let rule = identity.doc().default_branch_rule()?;
- Ok::<_, DefaultBranchRuleError>(CanonicalRefs::from_iter([rule]))
+ Ok::<_, CanonicalRefsError>(CanonicalRefs::from_iter([rule]))
})?;
let rules = crefs.rules();
let me = Did::from(nid);
diff --git a/crates/radicle/src/identity/crefs.rs b/crates/radicle/src/identity/crefs.rs
index 112d5ccf0..939d5b16c 100644
--- a/crates/radicle/src/identity/crefs.rs
+++ b/crates/radicle/src/identity/crefs.rs
@@ -69,7 +69,7 @@ impl RawCanonicalRefs {
R: Fn() -> Delegates,
{
let rules = Rules::from_raw(self.rules, resolve)?;
- Ok(CanonicalRefs { rules })
+ Ok(CanonicalRefs::new(rules))
}
}
diff --git a/crates/radicle/src/identity/doc.rs b/crates/radicle/src/identity/doc.rs
index 169876aee..db27c47d6 100644
--- a/crates/radicle/src/identity/doc.rs
+++ b/crates/radicle/src/identity/doc.rs
@@ -241,8 +241,6 @@ impl PayloadId {
#[derive(Debug, Error)]
pub enum PayloadError {
- #[error(transparent)]
- CanonicalRefs(#[from] rules::ValidationError),
#[error("json: {0}")]
Json(#[from] serde_json::Error),
#[error("payload '{0}' not found in identity document")]
@@ -914,14 +912,32 @@ impl Doc {
}
}
+#[derive(Debug, Error)]
+pub enum CanonicalRefsError {
+ #[error(transparent)]
+ Json(#[from] serde_json::Error),
+ #[error(transparent)]
+ CanonicalRefs(#[from] rules::ValidationError),
+ #[error(transparent)]
+ DefaultBranch(#[from] DefaultBranchRuleError),
+}
+
impl crefs::GetCanonicalRefs for Doc {
- type Error = PayloadError;
+ type Error = CanonicalRefsError;
fn canonical_refs(&self) -> Result<Option<CanonicalRefs>, Self::Error> {
self.raw_canonical_refs().and_then(|raw| {
raw.map(|raw| {
raw.try_into_canonical_refs(&mut || self.delegates.clone())
- .map_err(PayloadError::from)
+ .map_err(CanonicalRefsError::from)
+ .and_then(|mut crefs| {
+ self.default_branch_rule()
+ .map_err(CanonicalRefsError::from)
+ .map(|rule| {
+ crefs.extend([rule]);
+ crefs
+ })
+ })
})
.transpose()
})
@@ -930,7 +946,27 @@ impl crefs::GetCanonicalRefs for Doc {
fn raw_canonical_refs(&self) -> Result<Option<RawCanonicalRefs>, Self::Error> {
let value = self.payload.get(&PayloadId::canonical_refs());
let crefs = value
- .map(|value| serde_json::from_value((**value).clone()).map_err(PayloadError::from))
+ .map(|value| {
+ serde_json::from_value((**value).clone()).map_err(CanonicalRefsError::from)
+ })
+ .transpose()?;
+ Ok(crefs)
+ }
+}
+
+impl crefs::GetCanonicalRefs for RawDoc {
+ type Error = CanonicalRefsError;
+
+ fn canonical_refs(&self) -> Result<Option<CanonicalRefs>, Self::Error> {
+ Ok(None)
+ }
+
+ fn raw_canonical_refs(&self) -> Result<Option<RawCanonicalRefs>, Self::Error> {
+ let value = self.payload.get(&PayloadId::canonical_refs());
+ let crefs = value
+ .map(|value| {
+ serde_json::from_value((**value).clone()).map_err(CanonicalRefsError::from)
+ })
.transpose()?;
Ok(crefs)
}
diff --git a/crates/radicle/src/identity/doc/update.rs b/crates/radicle/src/identity/doc/update.rs
index 146623194..9a55f681b 100644
--- a/crates/radicle/src/identity/doc/update.rs
+++ b/crates/radicle/src/identity/doc/update.rs
@@ -5,12 +5,13 @@ use std::{collections::BTreeSet, str::FromStr};
use serde_json as json;
use crate::{
+ git,
identity::crefs::GetCanonicalRefs as _,
prelude::Did,
storage::{refs, ReadRepository, RepositoryError},
};
-use super::{Doc, PayloadId, RawDoc, Visibility};
+use super::{Doc, PayloadError, PayloadId, RawDoc, Visibility};
/// [`EditVisibility`] allows the visibility of a [`RawDoc`] to be edited using
/// the [`visibility`] function.
@@ -186,18 +187,44 @@ pub fn payload(
/// [`Project`]: crate::identity::Project
/// [`CanonicalRefs`]: crate::identity::CanonicalRefs
pub fn verify(raw: RawDoc) -> Result<Doc, error::DocVerification> {
- let proposal = raw.verified()?;
- // Verify that the payloads can still be parsed into the correct types.
- if let Err(super::PayloadError::Json(e)) = proposal.project() {
- return Err(error::DocVerification::PayloadJson {
- id: PayloadId::project(),
- err: e,
- });
+ let proposal = raw.clone().verified()?;
+ // Verify that the project payload is valid
+ // TODO(finto): perhaps this should be handled by JSON Schemas instead
+ let project = match proposal.project() {
+ Ok(project) => Some(project),
+ Err(PayloadError::NotFound(_)) => None,
+ Err(PayloadError::Json(e)) => {
+ return Err(error::DocVerification::PayloadError {
+ id: PayloadId::project(),
+ err: e.to_string(),
+ })
+ }
+ };
+ // Ensure that if we have canonical reference rules and a project, that no
+ // rule exists for the default branch. This rule must be synthesized when
+ // constructing the canonical reference rules.
+ match raw
+ .raw_canonical_refs()
+ .map(|rcrefs| rcrefs.and_then(|c| project.map(|p| (c, p))))
+ {
+ Ok(Some((crefs, project))) => {
+ let default = git::Qualified::from(git::lit::refs_heads(project.default_branch()));
+ let matches = crefs
+ .raw_rules()
+ .matches(&default)
+ .map(|(pattern, _)| pattern.to_string())
+ .collect::<Vec<_>>();
+ if !matches.is_empty() {
+ return Err(error::DocVerification::DisallowDefault { matches, default });
+ }
+ }
+ _ => { /* we validate below */ }
}
- if let Err(super::PayloadError::Json(e)) = proposal.canonical_refs() {
- return Err(error::DocVerification::PayloadJson {
+ // Verify that the canonical references payload is valid
+ if let Err(e) = proposal.canonical_refs() {
+ return Err(error::DocVerification::PayloadError {
id: PayloadId::canonical_refs(),
- err: e,
+ err: e.to_string(),
});
}
Ok(proposal)
@@ -233,3 +260,101 @@ where
Ok((dids.len() - missing.len() < threshold).then_some(missing))
}
+
+#[allow(clippy::unwrap_used)]
+#[cfg(test)]
+mod test {
+ use serde_json::json;
+
+ use crate::{
+ git,
+ identity::{
+ crefs::GetCanonicalRefs,
+ doc::{update::error, PayloadId},
+ },
+ prelude::RawDoc,
+ test::arbitrary,
+ };
+
+ #[test]
+ fn test_can_update_crefs() {
+ let raw = arbitrary::gen::<RawDoc>(1);
+ let raw = super::payload(
+ raw,
+ vec![(
+ PayloadId::canonical_refs(),
+ "rules".to_string(),
+ json!({
+ "refs/tags/*": {
+ "threshold": 1,
+ "allow": "delegates"
+ }
+ }),
+ )],
+ )
+ .unwrap();
+ let verified = super::verify(raw);
+ assert!(verified.is_ok(), "Unexpected error {:?}", verified);
+ }
+
+ #[test]
+ fn test_cannot_include_default_branch_rule() {
+ let raw = arbitrary::gen::<RawDoc>(1);
+ let branch = git::Qualified::from(git::lit::refs_heads(
+ raw.project().unwrap().default_branch(),
+ ));
+ let raw = super::payload(
+ raw,
+ vec![(
+ PayloadId::canonical_refs(),
+ "rules".to_string(),
+ json!({
+ "refs/tags/*": {
+ "threshold": 1,
+ "allow": "delegates"
+ },
+ branch.as_str(): {
+ "threshold": 1,
+ "allow": "delegates",
+ }
+ }),
+ )],
+ )
+ .unwrap();
+ assert!(
+ matches!(
+ super::verify(raw),
+ Err(error::DocVerification::DisallowDefault { .. })
+ ),
+ "Verification should be rejected for including default branch rule"
+ )
+ }
+
+ #[test]
+ fn test_default_branch_rule_exists_after_verification() {
+ let raw = arbitrary::gen::<RawDoc>(1);
+ let branch = git::Qualified::from(git::lit::refs_heads(
+ raw.project().unwrap().default_branch(),
+ ));
+ let raw = super::payload(
+ raw,
+ vec![(
+ PayloadId::canonical_refs(),
+ "rules".to_string(),
+ json!({
+ "refs/tags/*": {
+ "threshold": 1,
+ "allow": "delegates"
+ }
+ }),
+ )],
+ )
+ .unwrap();
+ let verified = super::verify(raw).unwrap();
+ let crefs = verified.canonical_refs().unwrap().unwrap();
+ assert!(
+ crefs.rules().matches(&branch).next().is_some(),
+ "Default branch rule is missing!"
+ );
+ }
+}
diff --git a/crates/radicle/src/identity/doc/update/error.rs b/crates/radicle/src/identity/doc/update/error.rs
index 02ebd9108..a9e664f4b 100644
--- a/crates/radicle/src/identity/doc/update/error.rs
+++ b/crates/radicle/src/identity/doc/update/error.rs
@@ -1,6 +1,6 @@
-use serde_json as json;
use thiserror::Error;
+use crate::git;
use crate::git::RefString;
use crate::identity::{doc::PayloadId, Did, DocError};
@@ -25,9 +25,14 @@ pub enum PayloadError {
#[derive(Debug, Error)]
pub enum DocVerification {
#[error("failed to verify `{id}`, {err}")]
- PayloadJson { id: PayloadId, err: json::Error },
+ PayloadError { id: PayloadId, err: String },
#[error(transparent)]
Doc(#[from] DocError),
+ #[error("incompatible payloads: The rule(s) xyz.radicle.crefs.rules.{matches:?} matches the value of xyz.radicle.project.defaultBranch ('{default}'). Possible resolutions: Change the name of the default branch or remove the rule(s).")]
+ DisallowDefault {
+ matches: Vec<String>,
+ default: git::Qualified<'static>,
+ },
}
#[derive(Clone, Debug)]
diff --git a/crates/radicle/src/storage.rs b/crates/radicle/src/storage.rs
index bff28f13d..dab7f1ed1 100644
--- a/crates/radicle/src/storage.rs
+++ b/crates/radicle/src/storage.rs
@@ -124,6 +124,8 @@ pub enum RepositoryError {
MissingBranchRule,
#[error("could not get the default branch rule: {0}")]
DefaultBranchRule(#[from] doc::DefaultBranchRuleError),
+ #[error("failed to get canonical reference rules: {0}")]
+ CanonicalRefs(#[from] doc::CanonicalRefsError),
}
impl RepositoryError {
commit 56f3af445ae64ef1a904046fd3f89132338eafe0
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Thu Jun 19 14:08:49 2025 +0200
cli: extract document update logic
The business logic of modifying the identity document should not live in the CLI
code for updating said document.
Instead, we extract out that logic into separate update functions and these are
using from the CLI instead.
diff --git a/crates/radicle-cli/examples/rad-id-private.md b/crates/radicle-cli/examples/rad-id-private.md
index 63998838b..711ee25e8 100644
--- a/crates/radicle-cli/examples/rad-id-private.md
+++ b/crates/radicle-cli/examples/rad-id-private.md
@@ -79,7 +79,8 @@ then the command will fail since there is no longer an allow list to work with:
``` (fails)
$ rad id update --visibility public --allow did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
-✗ Error: `--allow` and `--disallow` cannot be used with `--visibility public`
+✗ Error: `--allow` and `--disallow` should only be used for private repositories
+✗ Hint: use `--visibility private` to make the repository private, or perhaps you meant to use `--delegate`/`--rescind`
```
Let's change the repository to `public`:
diff --git a/crates/radicle-cli/src/commands/id.rs b/crates/radicle-cli/src/commands/id.rs
index 3a0f4dc5a..2690454e8 100644
--- a/crates/radicle-cli/src/commands/id.rs
+++ b/crates/radicle-cli/src/commands/id.rs
@@ -1,16 +1,16 @@
use std::collections::BTreeSet;
-use std::str::FromStr;
use std::{ffi::OsString, io};
use anyhow::{anyhow, Context};
use radicle::cob::identity::{self, IdentityMut, Revision, RevisionId};
-use radicle::identity::{doc, Doc, Identity, PayloadError, RawDoc, Visibility};
+use radicle::identity::doc::update;
+use radicle::identity::doc::update::EditVisibility;
+use radicle::identity::{doc, Doc, Identity, RawDoc};
use radicle::node::device::Device;
use radicle::node::NodeId;
use radicle::prelude::{Did, RepoId};
-use radicle::storage::refs;
-use radicle::storage::{ReadRepository, ReadStorage as _, WriteRepository};
+use radicle::storage::{ReadStorage as _, WriteRepository};
use radicle::{cob, crypto, Profile};
use radicle_surf::diff::Diff;
use radicle_term::Element;
@@ -88,29 +88,6 @@ pub enum Operation {
ListRevisions,
}
-#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
-pub enum EditVisibility {
- #[default]
- Public,
- Private,
-}
-
-#[derive(thiserror::Error, Debug)]
-#[error("'{0}' is not a valid visibility type")]
-pub struct EditVisibilityParseError(String);
-
-impl FromStr for EditVisibility {
- type Err = EditVisibilityParseError;
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- match s {
- "public" => Ok(EditVisibility::Public),
- "private" => Ok(EditVisibility::Private),
- _ => Err(EditVisibilityParseError(s.to_owned())),
- }
- }
-}
-
#[derive(Default, PartialEq, Eq)]
pub enum OperationName {
Accept,
@@ -398,76 +375,38 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
let mut proposal = current.doc.clone().edit();
proposal.threshold = threshold.unwrap_or(proposal.threshold);
- if !allow.is_disjoint(&disallow) {
- let overlap = allow
- .intersection(&disallow)
- .map(Did::to_string)
- .collect::<Vec<_>>();
- anyhow::bail!("`--allow` and `--disallow` must not overlap: {overlap:?}")
- }
-
- match (&mut proposal.visibility, visibility) {
- (Visibility::Public, None | Some(EditVisibility::Public)) if !allow.is_empty() || !disallow.is_empty() => {
- return Err(Error::WithHint {
+ let proposal = match visibility {
+ Some(edit) => update::visibility(proposal, edit),
+ None => proposal,
+ };
+ let proposal = match update::privacy_allow_list(proposal, allow, disallow) {
+ Ok(proposal) => proposal,
+ Err(e) => match e {
+ update::error::PrivacyAllowList::Overlapping(overlap) => anyhow::bail!("`--allow` and `--disallow` must not overlap: {overlap:?}"),
+ update::error::PrivacyAllowList::PublicVisibility => return Err(Error::WithHint {
err:
anyhow!("`--allow` and `--disallow` should only be used for private repositories"),
hint: "use `--visibility private` to make the repository private, or perhaps you meant to use `--delegate`/`--rescind`",
}.into())
}
- (Visibility::Public, None | Some(EditVisibility::Public)) => { /* no-op */ },
- (Visibility::Private { allow: existing }, None | Some(EditVisibility::Private)) => {
- for did in allow {
- existing.insert(did);
- }
- for did in disallow {
- existing.remove(&did);
+ };
+ let threshold = proposal.threshold;
+ let proposal = match update::delegates(proposal, delegates, rescind, &repo)? {
+ Ok(proposal) => proposal,
+ Err(errs) => {
+ term::error(format!("failed to verify delegates for {rid}"));
+ term::error(format!(
+ "the threshold of {} delegates cannot be met..",
+ threshold
+ ));
+ for e in errs {
+ print_delegate_verification_error(&e);
}
+ anyhow::bail!("fatal: refusing to update identity document");
}
- (Visibility::Public, Some(EditVisibility::Private)) => {
- // We ignore disallow since only allowing matters and the sets are disjoint.
- proposal.visibility = Visibility::Private { allow };
- }
- (Visibility::Private { .. }, Some(EditVisibility::Public)) if !allow.is_empty() || !disallow.is_empty() => {
- anyhow::bail!("`--allow` and `--disallow` cannot be used with `--visibility public`")
- }
- (Visibility::Private { .. }, Some(EditVisibility::Public)) => {
- proposal.visibility = Visibility::Public;
- }
- }
- proposal.delegates = proposal
- .delegates
- .into_iter()
- .chain(delegates)
- .filter(|d| !rescind.contains(d))
- .collect::<Vec<_>>();
- if let Some(errs) = verify_delegates(&proposal, &repo)? {
- term::error(format!("failed to verify delegates for {rid}"));
- term::error(format!(
- "the threshold of {} delegates cannot be met..",
- proposal.threshold
- ));
- for e in errs {
- e.print();
- }
- anyhow::bail!("fatal: refusing to update identity document");
- }
+ };
- for (id, key, val) in payload {
- if let Some(ref mut payload) = proposal.payload.get_mut(&id) {
- if let Some(obj) = payload.as_object_mut() {
- if val.is_null() {
- obj.remove(&key);
- } else {
- obj.insert(key, val);
- }
- } else {
- anyhow::bail!("payload `{id}` is not a map");
- }
- } else {
- anyhow::bail!("payload `{id}` not found in identity document");
- }
- }
- proposal
+ update::payload(proposal, payload)?
};
// If `--edit` is specified, the document can also be edited via a text edit.
@@ -489,11 +428,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
proposal
};
- // Verify that the project payload can still be parsed into the `Project` type.
- if let Err(PayloadError::Json(e)) = proposal.project() {
- anyhow::bail!("failed to verify `xyz.radicle.project`, {e}");
- }
- let proposal = proposal.verified()?;
+ let proposal = update::verify(proposal)?;
if proposal == current.doc {
if !options.quiet {
term::print(term::format::italic(
@@ -793,62 +728,19 @@ fn print_diff(
Ok(())
}
-#[derive(Clone)]
-enum VerificationError {
- MissingDefaultBranch {
- branch: radicle::git::RefString,
- did: Did,
- },
- MissingDelegate {
- did: Did,
- },
-}
-
-impl VerificationError {
- fn print(&self) {
- match self {
- VerificationError::MissingDefaultBranch { branch, did } => term::error(format!(
- "missing {} for {} in local storage",
- term::format::secondary(branch),
- term::format::did(did)
- )),
- VerificationError::MissingDelegate { did } => {
- term::error(format!("the delegate {did} is missing"));
- term::hint(format!(
- "run `rad follow {did}` to follow this missing peer"
- ));
- }
- }
- }
-}
-
-fn verify_delegates<S>(
- proposal: &RawDoc,
- repo: &S,
-) -> anyhow::Result<Option<Vec<VerificationError>>>
-where
- S: ReadRepository,
-{
- let dids = &proposal.delegates;
- let threshold = proposal.threshold;
- let (canonical, _) = repo.canonical_head()?;
- let mut missing = Vec::with_capacity(dids.len());
-
- for did in dids {
- match refs::SignedRefsAt::load((*did).into(), repo)? {
- None => {
- missing.push(VerificationError::MissingDelegate { did: *did });
- }
- Some(refs::SignedRefsAt { sigrefs, .. }) => {
- if sigrefs.get(&canonical).is_none() {
- missing.push(VerificationError::MissingDefaultBranch {
- branch: canonical.to_ref_string(),
- did: *did,
- });
- }
- }
+fn print_delegate_verification_error(err: &update::error::DelegateVerification) {
+ use update::error::DelegateVerification::*;
+ match err {
+ MissingDefaultBranch { branch, did } => term::error(format!(
+ "missing {} for {} in local storage",
+ term::format::secondary(branch),
+ term::format::did(did)
+ )),
+ MissingDelegate { did } => {
+ term::error(format!("the delegate {did} is missing"));
+ term::hint(format!(
+ "run `rad follow {did}` to follow this missing peer"
+ ));
}
}
-
- Ok((dids.len() - missing.len() < threshold).then_some(missing))
}
diff --git a/crates/radicle/src/identity/doc.rs b/crates/radicle/src/identity/doc.rs
index b3f4c1b36..169876aee 100644
--- a/crates/radicle/src/identity/doc.rs
+++ b/crates/radicle/src/identity/doc.rs
@@ -1,3 +1,5 @@
+pub mod update;
+
mod id;
use std::collections::{BTreeMap, BTreeSet};
diff --git a/crates/radicle/src/identity/doc/update.rs b/crates/radicle/src/identity/doc/update.rs
new file mode 100644
index 000000000..146623194
--- /dev/null
+++ b/crates/radicle/src/identity/doc/update.rs
@@ -0,0 +1,235 @@
+pub mod error;
+
+use std::{collections::BTreeSet, str::FromStr};
+
+use serde_json as json;
+
+use crate::{
+ identity::crefs::GetCanonicalRefs as _,
+ prelude::Did,
+ storage::{refs, ReadRepository, RepositoryError},
+};
+
+use super::{Doc, PayloadId, RawDoc, Visibility};
+
+/// [`EditVisibility`] allows the visibility of a [`RawDoc`] to be edited using
+/// the [`visibility`] function.
+///
+/// Note that this differs from [`Visibility`] since the
+/// [`EditVisibility::Private`] variant does not hold the allowed set of
+/// [`Did`]s.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+pub enum EditVisibility {
+ #[default]
+ Public,
+ Private,
+}
+
+impl FromStr for EditVisibility {
+ type Err = error::ParseEditVisibility;
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ match s {
+ "public" => Ok(EditVisibility::Public),
+ "private" => Ok(EditVisibility::Private),
+ _ => Err(error::ParseEditVisibility(s.to_owned())),
+ }
+ }
+}
+
+/// Change the visibility of the [`RawDoc`], using the provided
+/// [`EditVisibility`].
+pub fn visibility(mut raw: RawDoc, edit: EditVisibility) -> RawDoc {
+ match (&mut raw.visibility, edit) {
+ (Visibility::Public, EditVisibility::Public) => raw,
+ (Visibility::Private { .. }, EditVisibility::Private) => raw,
+ (Visibility::Public, EditVisibility::Private) => {
+ raw.visibility = Visibility::private([]);
+ raw
+ }
+ (Visibility::Private { .. }, EditVisibility::Public) => {
+ raw.visibility = Visibility::Public;
+ raw
+ }
+ }
+}
+
+/// Change the `allow` set of a document if the visibility is set to
+/// [`Visibility::Private`].
+///
+/// All `Did`s in the `allow` set are added to the set, while all `Did`s in the
+/// `disallow` set are removed from the set.
+///
+/// # Errors
+///
+/// This will fail when `allow` and `disallow` are not disjoint, i.e. they
+/// contain at least share one `Did`.
+///
+/// This will fail when the [`Visibility`] of the document is
+/// [`Visibility::Public`].
+pub fn privacy_allow_list(
+ mut raw: RawDoc,
+ allow: BTreeSet<Did>,
+ disallow: BTreeSet<Did>,
+) -> Result<RawDoc, error::PrivacyAllowList> {
+ if allow.is_empty() && disallow.is_empty() {
+ return Ok(raw);
+ }
+
+ if !allow.is_disjoint(&disallow) {
+ let overlap = allow
+ .intersection(&disallow)
+ .map(Did::to_string)
+ .collect::<Vec<_>>();
+ return Err(error::PrivacyAllowList::Overlapping(overlap));
+ }
+
+ match &mut raw.visibility {
+ Visibility::Public => Err(error::PrivacyAllowList::PublicVisibility),
+ Visibility::Private { allow: existing } => {
+ for did in allow {
+ existing.insert(did);
+ }
+ for did in disallow {
+ existing.remove(&did);
+ }
+ Ok(raw)
+ }
+ }
+}
+
+/// Change the delegates of the document and perform some verification based on
+/// the new set of delegates.
+///
+/// The set of `additions` are added to the delegates, while the set to
+/// `removals` are removed from the delegates. Note that `removals` will take
+/// precedence over the additions, i.e. if an addition and removal overlap, then
+/// the [`Did`] will not be in the final set.
+///
+/// The result is either the updated [`RawDoc`] or a set of
+/// [`error::DelegateVerification`] errors – which may be reported by the caller
+/// to provide better error messaging.
+///
+/// # Errors
+///
+/// This will fail if an operation using the repository fails.
+pub fn delegates<S>(
+ mut raw: RawDoc,
+ additions: Vec<Did>,
+ removals: Vec<Did>,
+ repo: &S,
+) -> Result<Result<RawDoc, Vec<error::DelegateVerification>>, RepositoryError>
+where
+ S: ReadRepository,
+{
+ if additions.is_empty() && removals.is_empty() {
+ return Ok(Ok(raw));
+ }
+
+ raw.delegates = raw
+ .delegates
+ .into_iter()
+ .chain(additions)
+ .filter(|d| !removals.contains(d))
+ .collect::<Vec<_>>();
+ match verify_delegates(&raw, repo)? {
+ Some(errors) => Ok(Err(errors)),
+ None => Ok(Ok(raw)),
+ }
+}
+
+// TODO(finto): I think this API would likely be much nicer if we use [JSON Patch][patch] and [JSON Merge Patch][merge]
+//
+// [patch]: https://datatracker.ietf.org/doc/html/rfc6902
+// [merge]: https://datatracker.ietf.org/doc/html/rfc7396
+/// Change the payload of the document, using the set of triples:
+///
+/// - [`PayloadId`]: the identifier for the document [`Payload`]
+/// - [`String`]: the key within the [`Payload`] that is being updated
+/// - [`json::Value`]: the value to update the [`Payload`]
+///
+/// # Errors
+///
+/// This fails if one of the [`PayloadId`]s does not point to a JSON object as
+/// its value.
+///
+/// [`Payload`]: super::Payload
+pub fn payload(
+ mut raw: RawDoc,
+ payload: Vec<(PayloadId, String, json::Value)>,
+) -> Result<RawDoc, error::PayloadError> {
+ for (id, key, val) in payload {
+ if let Some(ref mut payload) = raw.payload.get_mut(&id) {
+ if let Some(obj) = payload.as_object_mut() {
+ if val.is_null() {
+ obj.remove(&key);
+ } else {
+ obj.insert(key, val);
+ }
+ } else {
+ return Err(error::PayloadError::ExpectedObject { id });
+ }
+ } else {
+ raw.payload
+ .insert(id, serde_json::json!({ key: val }).into());
+ }
+ }
+ Ok(raw)
+}
+
+/// Verify the document.
+///
+/// This ensures performs the verification of the [`RawDoc`] into the [`Doc`],
+/// while also checking the [`Project`] and [`CanonicalRefs`] will also
+/// deserialize correctly.
+///
+/// [`Project`]: crate::identity::Project
+/// [`CanonicalRefs`]: crate::identity::CanonicalRefs
+pub fn verify(raw: RawDoc) -> Result<Doc, error::DocVerification> {
+ let proposal = raw.verified()?;
+ // Verify that the payloads can still be parsed into the correct types.
+ if let Err(super::PayloadError::Json(e)) = proposal.project() {
+ return Err(error::DocVerification::PayloadJson {
+ id: PayloadId::project(),
+ err: e,
+ });
+ }
+ if let Err(super::PayloadError::Json(e)) = proposal.canonical_refs() {
+ return Err(error::DocVerification::PayloadJson {
+ id: PayloadId::canonical_refs(),
+ err: e,
+ });
+ }
+ Ok(proposal)
+}
+
+fn verify_delegates<S>(
+ proposal: &RawDoc,
+ repo: &S,
+) -> Result<Option<Vec<error::DelegateVerification>>, RepositoryError>
+where
+ S: ReadRepository,
+{
+ let dids = &proposal.delegates;
+ let threshold = proposal.threshold;
+ let (canonical, _) = repo.canonical_head()?;
+ let mut missing = Vec::with_capacity(dids.len());
+
+ for did in dids {
+ match refs::SignedRefsAt::load((*did).into(), repo)? {
+ None => {
+ missing.push(error::DelegateVerification::MissingDelegate { did: *did });
+ }
+ Some(refs::SignedRefsAt { sigrefs, .. }) => {
+ if sigrefs.get(&canonical).is_none() {
+ missing.push(error::DelegateVerification::MissingDefaultBranch {
+ branch: canonical.to_ref_string(),
+ did: *did,
+ });
+ }
+ }
+ }
+ }
+
+ Ok((dids.len() - missing.len() < threshold).then_some(missing))
+}
diff --git a/crates/radicle/src/identity/doc/update/error.rs b/crates/radicle/src/identity/doc/update/error.rs
new file mode 100644
index 000000000..02ebd9108
--- /dev/null
+++ b/crates/radicle/src/identity/doc/update/error.rs
@@ -0,0 +1,37 @@
+use serde_json as json;
+use thiserror::Error;
+
+use crate::git::RefString;
+use crate::identity::{doc::PayloadId, Did, DocError};
+
+#[derive(Debug, Error)]
+#[error("'{0}' is not a valid visibility type")]
+pub struct ParseEditVisibility(pub(super) String);
+
+#[derive(Debug, Error)]
+pub enum PrivacyAllowList {
+ #[error("overlapping allow and disallow of DIDs {0:?}")]
+ Overlapping(Vec<String>),
+ #[error("the visibility of the document is public")]
+ PublicVisibility,
+}
+
+#[derive(Debug, Error)]
+pub enum PayloadError {
+ #[error("payload found under `{id}` is expected to be a map")]
+ ExpectedObject { id: PayloadId },
+}
+
+#[derive(Debug, Error)]
+pub enum DocVerification {
+ #[error("failed to verify `{id}`, {err}")]
+ PayloadJson { id: PayloadId, err: json::Error },
+ #[error(transparent)]
+ Doc(#[from] DocError),
+}
+
+#[derive(Clone, Debug)]
+pub enum DelegateVerification {
+ MissingDefaultBranch { branch: RefString, did: Did },
+ MissingDelegate { did: Did },
+}
commit 8110f7b4ed83d63bfafd05f32801795e3a0c6258
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Thu Jun 12 14:06:49 2025 +0200
radicle: canonical references payload
diff --git a/crates/radicle-cli/examples/git/git-push-amend.md b/crates/radicle-cli/examples/git/git-push-amend.md
index b3cd985ca..80c78c0d2 100644
--- a/crates/radicle-cli/examples/git/git-push-amend.md
+++ b/crates/radicle-cli/examples/git/git-push-amend.md
@@ -21,7 +21,7 @@ $ git commit --amend -m "Neue Änderungen" --allow-empty -q
``` ~alice (stderr)
$ git push rad master -f
-✓ Canonical head updated to 9170c8795d3a78f0381a0ffafb20ea69fb0f5b6b
+✓ Canonical head for refs/heads/master updated to 9170c8795d3a78f0381a0ffafb20ea69fb0f5b6b
✓ Synced with 1 seed(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ fb25886...9170c87 master -> master (forced update)
diff --git a/crates/radicle-cli/examples/git/git-push-converge.md b/crates/radicle-cli/examples/git/git-push-converge.md
index 2ceca3ac0..188bd764a 100644
--- a/crates/radicle-cli/examples/git/git-push-converge.md
+++ b/crates/radicle-cli/examples/git/git-push-converge.md
@@ -91,8 +91,7 @@ commit:
``` ~alice (stderr)
$ git push rad -f
-warn: could not determine canonical tip for `refs/heads/master`
-warn: no commit found with at least 3 vote(s) (threshold not met)
+warn: could not determine commit for canonical reference 'refs/heads/master', no commit with at least 3 vote(s) found (threshold not met)
warn: it is recommended to find a commit to agree upon
✓ Synced with 2 seed(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
@@ -117,7 +116,7 @@ become the canonical `master`.
``` ~bob (stderr)
$ git push rad
-✓ Canonical head updated to 3a75f66dd0020c9a0355cc6ec21f15de989e2001
+✓ Canonical head for refs/heads/master updated to 3a75f66dd0020c9a0355cc6ec21f15de989e2001
✓ Synced with 2 seed(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk
2a37862..0f9bd80 master -> master
@@ -138,7 +137,7 @@ HEAD is now at 0f9bd80 Merge remote-tracking branch 'eve/master'
``` ~eve (stderr)
$ git push rad
-✓ Canonical head updated to 0f9bd8035c04b3f73f5408e73e8454879b20800b
+✓ Canonical head for refs/heads/master updated to 0f9bd8035c04b3f73f5408e73e8454879b20800b
✓ Synced with 2 seed(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z
3a75f66..0f9bd80 master -> master
diff --git a/crates/radicle-cli/examples/git/git-push-diverge.md b/crates/radicle-cli/examples/git/git-push-diverge.md
index 46d1fcb89..296939475 100644
--- a/crates/radicle-cli/examples/git/git-push-diverge.md
+++ b/crates/radicle-cli/examples/git/git-push-diverge.md
@@ -44,7 +44,7 @@ integrate Bob's changes before pushing ours:
``` ~alice (stderr) (fail) RAD_HINT=1
$ git push rad
-hint: you are attempting to push a commit that would cause your upstream to diverge from the canonical head
+hint: you are attempting to push a commit that would cause your upstream to diverge from the canonical reference refs/heads/master
hint: to integrate the remote changes, run `git pull --rebase` and try again
error: refusing to update branch to commit that is not a descendant of canonical head
error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi'
@@ -62,7 +62,7 @@ f2de534 Second commit
```
``` ~alice RAD_SOCKET=/dev/null (stderr)
$ git push rad
-✓ Canonical head updated to f6cff86594495e9beccfeda7c20173e55c1dd9fc
+✓ Canonical head for refs/heads/master updated to f6cff86594495e9beccfeda7c20173e55c1dd9fc
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..f6cff86 master -> master
```
@@ -75,7 +75,7 @@ $ git reset --hard HEAD^ -q
```
``` ~alice RAD_SOCKET=/dev/null (stderr)
$ git push -f
-✓ Canonical head updated to 319a7dc3b195368ded4b099f8c90bbb80addccd3
+✓ Canonical head for refs/heads/master updated to 319a7dc3b195368ded4b099f8c90bbb80addccd3
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ f6cff86...319a7dc master -> master (forced update)
```
diff --git a/crates/radicle-cli/examples/git/git-push-rollback.md b/crates/radicle-cli/examples/git/git-push-rollback.md
index be55bc18c..840f68ec3 100644
--- a/crates/radicle-cli/examples/git/git-push-rollback.md
+++ b/crates/radicle-cli/examples/git/git-push-rollback.md
@@ -35,7 +35,7 @@ Fast-forward
``` ~alice (stderr)
$ git push rad
-✓ Canonical head updated to 319a7dc3b195368ded4b099f8c90bbb80addccd3
+✓ Canonical head for refs/heads/master updated to 319a7dc3b195368ded4b099f8c90bbb80addccd3
✓ Synced with 1 seed(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..319a7dc master -> master
@@ -54,7 +54,7 @@ push and the new canonical head becomes the previous commit again:
``` ~alice (stderr)
$ git push rad -f
-✓ Canonical head updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
+✓ Canonical head for refs/heads/master updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
✓ Synced with 1 seed(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ 319a7dc...f2de534 master -> master (forced update)
diff --git a/crates/radicle-cli/examples/rad-id-threshold.md b/crates/radicle-cli/examples/rad-id-threshold.md
index fe139debe..7471f4f0e 100644
--- a/crates/radicle-cli/examples/rad-id-threshold.md
+++ b/crates/radicle-cli/examples/rad-id-threshold.md
@@ -64,7 +64,7 @@ $ git commit -v -m "Define power requirements"
``` ~alice (stderr) RAD_SOCKET=/dev/null
$ git push rad master
-✓ Canonical head updated to 3e674d1a1df90807e934f9ae5da2591dd6848a33
+✓ Canonical head for refs/heads/master updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..3e674d1 master -> master
```
diff --git a/crates/radicle-cli/examples/rad-merge-after-update.md b/crates/radicle-cli/examples/rad-merge-after-update.md
index 0fe08a2a3..f0b73429f 100644
--- a/crates/radicle-cli/examples/rad-merge-after-update.md
+++ b/crates/radicle-cli/examples/rad-merge-after-update.md
@@ -16,7 +16,7 @@ $ git commit --amend --allow-empty -q -m "Amended change"
$ git checkout master -q
$ git merge feature/1 -q
$ git push rad master
-✓ Canonical head updated to 954bcdb5008447ce294a61a21d7eb87afbe7f4a6
+✓ Canonical head for refs/heads/master updated to 954bcdb5008447ce294a61a21d7eb87afbe7f4a6
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..954bcdb master -> master
```
diff --git a/crates/radicle-cli/examples/rad-merge-no-ff.md b/crates/radicle-cli/examples/rad-merge-no-ff.md
index f6de66bcb..ce5d3f060 100644
--- a/crates/radicle-cli/examples/rad-merge-no-ff.md
+++ b/crates/radicle-cli/examples/rad-merge-no-ff.md
@@ -37,7 +37,7 @@ Finally, we push master and expect the patch to be merged.
``` (stderr) RAD_SOCKET=/dev/null
$ git push rad master
✓ Patch 696ec5508494692899337afe6713fe1796d0315c merged
-✓ Canonical head updated to 737a10cfa29111afeb0d43cf3545cee386b939ec
+✓ Canonical head for refs/heads/master updated to 737a10cfa29111afeb0d43cf3545cee386b939ec
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..737a10c master -> master
```
diff --git a/crates/radicle-cli/examples/rad-merge-via-push.md b/crates/radicle-cli/examples/rad-merge-via-push.md
index 27aa55cf0..efa235ee1 100644
--- a/crates/radicle-cli/examples/rad-merge-via-push.md
+++ b/crates/radicle-cli/examples/rad-merge-via-push.md
@@ -70,7 +70,7 @@ When we push to `rad/master`, we automatically merge the patches:
$ git push rad master
✓ Patch 356f73863a8920455ff6e77cd9c805d68910551b merged
✓ Patch 696ec5508494692899337afe6713fe1796d0315c merged
-✓ Canonical head updated to d6399c71702b40bae00825b3c444478d06b4e91c
+✓ Canonical head for refs/heads/master updated to d6399c71702b40bae00825b3c444478d06b4e91c
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..d6399c7 master -> master
```
@@ -148,7 +148,7 @@ the first patch, even though they were pushed together.
$ git reset --hard HEAD^
$ git push -f rad
! Patch 356f73863a8920455ff6e77cd9c805d68910551b reverted at revision 356f738
-✓ Canonical head updated to 20aa5dde6210796c3a2f04079b42316a31d02689
+✓ Canonical head for refs/heads/master updated to 20aa5dde6210796c3a2f04079b42316a31d02689
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ d6399c7...20aa5dd master -> master (forced update)
```
diff --git a/crates/radicle-cli/examples/rad-patch-merge-draft.md b/crates/radicle-cli/examples/rad-patch-merge-draft.md
index f13f6e830..2ea699307 100644
--- a/crates/radicle-cli/examples/rad-patch-merge-draft.md
+++ b/crates/radicle-cli/examples/rad-patch-merge-draft.md
@@ -14,7 +14,7 @@ $ git checkout master -q
$ git merge feature/1
$ git push rad master
✓ Patch 8dfb4dcafc4346158c8160410dd3f2b0616ad4fe merged
-✓ Canonical head updated to 20aa5dde6210796c3a2f04079b42316a31d02689
+✓ Canonical head for refs/heads/master updated to 20aa5dde6210796c3a2f04079b42316a31d02689
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..20aa5dd master -> master
```
diff --git a/crates/radicle-cli/examples/rad-patch-open-explore.md b/crates/radicle-cli/examples/rad-patch-open-explore.md
index adc9da828..d04de892d 100644
--- a/crates/radicle-cli/examples/rad-patch-open-explore.md
+++ b/crates/radicle-cli/examples/rad-patch-open-explore.md
@@ -38,7 +38,7 @@ $ git checkout master -q
$ git merge changes -q
$ git push rad master
✓ Patch acab0ec777a97d013f30be5d5d1aec32562ecb02 merged
-✓ Canonical head updated to b2b6432af93f8fe188e32d400263021b602cfec8
+✓ Canonical head for refs/heads/master updated to b2b6432af93f8fe188e32d400263021b602cfec8
✓ Synced with 1 seed(s)
https://app.radicle.xyz/nodes/[..]/rad:z3yXbb1sR6UG6ixxV2YF9jUP7ABra/tree/b2b6432af93f8fe188e32d400263021b602cfec8
diff --git a/crates/radicle-cli/examples/rad-patch-revert-merge.md b/crates/radicle-cli/examples/rad-patch-revert-merge.md
index efb33561b..d3ce7b416 100644
--- a/crates/radicle-cli/examples/rad-patch-revert-merge.md
+++ b/crates/radicle-cli/examples/rad-patch-revert-merge.md
@@ -12,7 +12,7 @@ Switched to branch 'master'
$ git merge feature/1
$ git push rad master
✓ Patch 696ec5508494692899337afe6713fe1796d0315c merged
-✓ Canonical head updated to 20aa5dde6210796c3a2f04079b42316a31d02689
+✓ Canonical head for refs/heads/master updated to 20aa5dde6210796c3a2f04079b42316a31d02689
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..20aa5dd master -> master
```
@@ -50,7 +50,7 @@ When pushing, notice that we're told our patch is reverted.
``` (stderr) RAD_SOCKET=/dev/null
$ git push rad master --force
! Patch 696ec5508494692899337afe6713fe1796d0315c reverted at revision 696ec55
-✓ Canonical head updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
+✓ Canonical head for refs/heads/master updated to f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+ 20aa5dd...f2de534 master -> master (forced update)
```
diff --git a/crates/radicle-cli/examples/workflow/5-patching-maintainer.md b/crates/radicle-cli/examples/workflow/5-patching-maintainer.md
index 9951438d4..39b40dd50 100644
--- a/crates/radicle-cli/examples/workflow/5-patching-maintainer.md
+++ b/crates/radicle-cli/examples/workflow/5-patching-maintainer.md
@@ -92,7 +92,7 @@ Fast-forward
``` (stderr)
$ git push rad master
✓ Patch e4934b6d9dbe01ce3c7fbb5b77a80d5f1dacdc46 merged at revision 9d62420
-✓ Canonical head updated to f567f695d25b4e8fb63b5f5ad2a584529826e908
+✓ Canonical head for refs/heads/master updated to f567f695d25b4e8fb63b5f5ad2a584529826e908
✓ Synced with 1 seed(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
f2de534..f567f69 master -> master
diff --git a/crates/radicle-node/src/worker/fetch.rs b/crates/radicle-node/src/worker/fetch.rs
index fa2df3bc7..f3ae1f442 100644
--- a/crates/radicle-node/src/worker/fetch.rs
+++ b/crates/radicle-node/src/worker/fetch.rs
@@ -7,15 +7,18 @@ use localtime::LocalTime;
use radicle::cob::TypedId;
use radicle::crypto::PublicKey;
+use radicle::identity::crefs::GetCanonicalRefs as _;
use radicle::identity::DocAt;
use radicle::prelude::NodeId;
use radicle::prelude::RepoId;
+use radicle::storage::git::Repository;
use radicle::storage::refs::RefsAt;
use radicle::storage::{
ReadRepository, ReadStorage as _, RefUpdate, RemoteRepository, RepositoryError,
WriteRepository as _,
};
use radicle::{cob, git, node, Storage};
+use radicle_fetch::git::refs::Applied;
use radicle_fetch::{Allowed, BlockList, FetchLimit};
use super::channels::ChannelsFlush;
@@ -89,8 +92,6 @@ impl Handle {
remote: PublicKey,
refs_at: Option<Vec<RefsAt>>,
) -> Result<FetchResult, error::Fetch> {
- use git::canonical::QuorumError::{Diverging, NoCandidates};
-
let (result, clone, notifs) = match self {
Self::Clone { mut handle, tmp } => {
log::debug!(target: "worker", "{} cloning from {remote}", handle.local());
@@ -145,15 +146,19 @@ impl Handle {
log::trace!(target: "worker", "Set HEAD to {}", head.new);
}
}
- Err(RepositoryError::Quorum(Diverging(e))) => {
- log::warn!(target: "worker", "Fetch could not set HEAD: {e}")
+ Err(RepositoryError::Quorum(radicle::git::canonical::QuorumError::Git(e))) => {
+ return Err(e.into())
}
- Err(RepositoryError::Quorum(NoCandidates(e))) => {
+ Err(RepositoryError::Quorum(e)) => {
log::warn!(target: "worker", "Fetch could not set HEAD: {e}")
}
Err(e) => return Err(e.into()),
}
+ if let Err(e) = set_canonical_refs(&repo, &applied) {
+ log::warn!(target: "worker", "Failed to set canonical references: {e}");
+ }
+
// Notifications are only posted for pulls, not clones.
if let Some(mut store) = notifs {
// Only create notifications for repos that we have
@@ -377,3 +382,71 @@ where
Ok(())
}
+
+fn set_canonical_refs(repo: &Repository, applied: &Applied) -> Result<(), error::Canonical> {
+ let identity = repo.identity()?;
+ let rules = match identity
+ .canonical_refs()?
+ .map(|crefs| crefs.rules().clone())
+ .filter(|rules| !rules.is_empty())
+ {
+ None => return Ok(()),
+ Some(rules) => rules,
+ };
+
+ for update in applied.updated.iter() {
+ let name = match update {
+ RefUpdate::Updated { name, .. } | RefUpdate::Created { name, .. } => name,
+ _ => {
+ log::trace!(target: "worker", "Skipping update {update}");
+ continue;
+ }
+ };
+ let Some(name) = name.clone().into_qualified() else {
+ log::warn!(target: "worker", "Skipping update for canonical reference '{name}' because it is not qualified.");
+ continue;
+ };
+ let Some(name) = name.to_namespaced() else {
+ log::warn!(target: "worker", "Skipping update for canonical reference '{name}' because it is not namespaced.");
+ continue;
+ };
+
+ let name = name.strip_namespace();
+
+ let canonical = match rules.canonical(name.clone(), repo) {
+ Ok(Some(canonical)) => canonical,
+ Ok(None) => continue,
+ Err(e) => {
+ log::warn!(target: "worker", "Failed to get canonical reference rule for {name}: {e}");
+ continue;
+ }
+ };
+
+ match canonical.quorum(&repo.backend) {
+ Err(err) => {
+ log::warn!(
+ target: "worker",
+ "Failed to calculate canonical reference: {}",
+ err,
+ );
+ continue;
+ }
+ Ok((refname, oid)) => {
+ if let Err(e) = repo.backend.reference(
+ refname.clone().as_str(),
+ *oid,
+ true,
+ "set-canonical-reference from fetch (radicle)",
+ ) {
+ log::warn!(
+ target: "worker",
+ "Failed to set canonical reference {}->{}: {e}",
+ refname,
+ oid
+ );
+ }
+ }
+ }
+ }
+ Ok(())
+}
diff --git a/crates/radicle-node/src/worker/fetch/error.rs b/crates/radicle-node/src/worker/fetch/error.rs
index 406b1e234..a9111a6a5 100644
--- a/crates/radicle-node/src/worker/fetch/error.rs
+++ b/crates/radicle-node/src/worker/fetch/error.rs
@@ -65,3 +65,11 @@ pub enum Handle {
#[error(transparent)]
Repository(#[from] radicle::storage::RepositoryError),
}
+
+#[derive(Debug, Error)]
+pub enum Canonical {
+ #[error(transparent)]
+ Identity(#[from] radicle::storage::RepositoryError),
+ #[error(transparent)]
+ Payload(#[from] radicle::identity::PayloadError),
+}
diff --git a/crates/radicle-remote-helper/src/push.rs b/crates/radicle-remote-helper/src/push.rs
index eaeccb888..c03dce73d 100644
--- a/crates/radicle-remote-helper/src/push.rs
+++ b/crates/radicle-remote-helper/src/push.rs
@@ -5,6 +5,8 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::{assert_eq, io};
+use radicle::identity::crefs::GetCanonicalRefs as _;
+use radicle::identity::doc::DefaultBranchRuleError;
use radicle::node::device::Device;
use thiserror::Error;
@@ -15,8 +17,7 @@ use radicle::cob::patch::cache::Patches as _;
use radicle::crypto;
use radicle::explorer::ExplorerResource;
use radicle::git::canonical;
-use radicle::git::canonical::Canonical;
-use radicle::identity::Did;
+use radicle::identity::{CanonicalRefs, Did};
use radicle::node;
use radicle::node::{Handle, NodeId};
use radicle::storage;
@@ -116,6 +117,8 @@ pub enum Error {
/// Quorum error.
#[error(transparent)]
Quorum(#[from] radicle::git::canonical::QuorumError),
+ #[error(transparent)]
+ DefaultBranchRule(#[from] radicle::identity::doc::DefaultBranchRuleError),
}
/// Push command.
@@ -203,6 +206,10 @@ pub fn run(
}
}
let delegates = stored.delegates()?;
+ let identity = stored.identity()?;
+ let project = identity.project()?;
+ let canonical_ref = git::refs::branch(project.default_branch());
+ let mut set_canonical_refs: Vec<(git::Qualified, git::Oid)> = Vec::with_capacity(specs.len());
// For each refspec, push a ref or delete a ref.
for spec in specs {
@@ -262,8 +269,11 @@ pub fn run(
)
} else {
let identity = stored.identity()?;
- let project = identity.project()?;
- let canonical_ref = git::refs::branch(project.default_branch());
+ let crefs = identity.canonical_refs_or_default(|| {
+ let rule = identity.doc().default_branch_rule()?;
+ Ok::<_, DefaultBranchRuleError>(CanonicalRefs::from_iter([rule]))
+ })?;
+ let rules = crefs.rules();
let me = Did::from(nid);
// If we're trying to update the canonical head, make sure
@@ -272,66 +282,51 @@ pub fn run(
//
// Note that we *do* allow rolling back to a previous commit on the
// canonical branch.
- if dst == canonical_ref && delegates.contains(&me) && delegates.len() > 1 {
- let head = working.find_reference(src.as_str())?;
- let head = head.peel_to_commit()?.id();
-
- let mut canonical = Canonical::default_branch(
- stored,
- &project,
- identity.delegates().as_ref(),
- identity.threshold(),
- )?;
- let converges = canonical::converges(
- canonical
- .tips()
- .filter_map(|(did, tip)| (*did != me).then_some(tip)),
- head.into(),
- &working,
- )?;
- if converges {
- canonical.modify_vote(me, head.into());
- }
+ if let Some(mut canonical) = rules.canonical(dst.clone(), stored)? {
+ if canonical.is_allowed(&me) {
+ let head = working.find_reference(src.as_str())?;
+ let head = head.peel_to_commit()?.id();
+ let converges =
+ canonical.converges(&working, (&me, &head.into()))?;
+
+ // If `canonical` is empty then we're creating a new reference.
+ // If we're the only delegate then we need to modify our vote.
+ if converges || canonical.has_no_tips() || canonical.is_only(&me) {
+ canonical.modify_vote(me, head.into());
+ }
- match canonical.quorum(&working) {
- Ok(canonical_oid) => {
- // Canonical head is an ancestor of head.
- let is_ff = head == *canonical_oid
- || working.graph_descendant_of(head, *canonical_oid)?;
-
- if !is_ff && !converges {
- if hints {
- hint(
- "you are attempting to push a commit that would cause \
- your upstream to diverge from the canonical head",
- );
- hint(
- "to integrate the remote changes, run `git pull --rebase` \
- and try again",
- );
+ match canonical.quorum(&working) {
+ Ok((dst, canonical_oid)) => {
+ // Canonical head is an ancestor of head.
+ let is_ff = head == *canonical_oid
+ || working.graph_descendant_of(head, *canonical_oid)?;
+
+ if !is_ff && !converges {
+ if hints {
+ hint(
+ format!("you are attempting to push a commit that would cause \
+ your upstream to diverge from the canonical reference {dst}"),
+ );
+ hint(
+ "to integrate the remote changes, run `git pull --rebase` \
+ and try again",
+ );
+ }
+ return Err(Error::HeadsDiverge(
+ head.into(),
+ canonical_oid,
+ ));
}
- return Err(Error::HeadsDiverge(
- head.into(),
- canonical_oid,
- ));
+ set_canonical_refs
+ .push((dst.clone().to_owned(), canonical_oid));
+ }
+ Err(canonical::QuorumError::Git(e)) => return Err(e.into()),
+ Err(e) => {
+ warn(e.to_string());
+ warn("it is recommended to find a commit to agree upon");
}
}
- Err(canonical::QuorumError::Diverging(e)) => {
- warn(format!(
- "could not determine canonical tip for `{canonical_ref}`"
- ));
- warn(e.to_string());
- warn("it is recommended to find a commit to agree upon");
- }
- Err(canonical::QuorumError::NoCandidates(e)) => {
- warn(format!(
- "could not determine canonical tip for `{canonical_ref}`"
- ));
- warn(e.to_string());
- warn("it is recommended to find a commit to agree upon");
- }
- Err(e) => return Err(e.into()),
- };
+ }
}
push(src, &dst, *force, &nid, &working, stored, patches, &signer)
}
@@ -354,16 +349,50 @@ pub fn run(
if !ok.is_empty() {
let _ = stored.sign_refs(&signer)?;
- // N.b. if an error occurs then there may be no quorum
- if let Ok(head) = stored.set_head() {
- if head.is_updated() {
+ for (refname, oid) in &set_canonical_refs {
+ let print_update = || {
eprintln!(
- "{} Canonical head updated to {}",
+ "{} Canonical head for {} updated to {}",
term::format::positive("✓"),
- term::format::secondary(head.new),
- );
+ term::format::secondary(refname),
+ term::format::secondary(oid),
+ )
+ };
+
+ // N.b. special case for handling the canonical ref, since it
+ // creates a symlink to HEAD
+ if *refname == canonical_ref
+ && stored
+ .set_head()
+ .map(|head| head.is_updated())
+ .unwrap_or(false)
+ {
+ print_update();
+ continue;
}
- };
+
+ match stored.backend.refname_to_id(refname.as_str()) {
+ Ok(new) if new != **oid => {
+ stored.backend.reference(
+ refname.as_str(),
+ **oid,
+ true,
+ "set-canonical-reference from git-push (radicle)",
+ )?;
+ print_update();
+ }
+ Err(e) if e.code() == git::raw::ErrorCode::NotFound => {
+ stored.backend.reference(
+ refname.as_str(),
+ **oid,
+ true,
+ "set-canonical-reference from git-push (radicle)",
+ )?;
+ print_update();
+ }
+ _ => {}
+ }
+ }
if !opts.no_sync {
if profile.policies()?.is_seeding(&stored.id)? {
diff --git a/crates/radicle/src/git/canonical.rs b/crates/radicle/src/git/canonical.rs
index 2f5e92826..eefcfd379 100644
--- a/crates/radicle/src/git/canonical.rs
+++ b/crates/radicle/src/git/canonical.rs
@@ -2,126 +2,64 @@ pub mod rules;
pub use rules::{MatchedRule, RawRule, Rules, ValidRule};
use std::collections::BTreeMap;
-use std::fmt;
-use nonempty::NonEmpty;
use raw::Repository;
use thiserror::Error;
use crate::prelude::Did;
-use crate::prelude::Project;
use crate::storage::ReadRepository;
use super::raw;
-use super::{lit, Oid, Qualified};
+use super::{Oid, Qualified};
/// A collection of [`Did`]s and their [`Oid`]s that is the tip for a given
/// reference for that [`Did`].
///
-/// The general construction of `Canonical` is by using the
-/// [`Canonical::reference`] constructor. For the default branch of a
-/// [`Project`], use [`Canonical::default_branch`].
+/// The general construction of `Canonical` is by using the [`Canonical::new`]
+/// constructor.
///
/// `Canonical` can then be used for performing calculations about the
/// canonicity of the reference, most importantly the [`Canonical::quorum`].
+///
+/// References to the refname and the matched rule are kept, as they
+/// are very handy for generating error messages.
#[derive(Debug)]
-pub struct Canonical {
+pub struct Canonical<'a, 'b> {
+ refname: Qualified<'a>,
+ rule: &'b ValidRule,
tips: BTreeMap<Did, Oid>,
- threshold: usize,
}
/// Error that can occur when calculation the [`Canonical::quorum`].
#[derive(Debug, Error)]
pub enum QuorumError {
/// Could not determine a quorum [`Oid`], due to diverging tips.
- #[error("could not determine canonical reference tip, {0}")]
- Diverging(Diverging),
+ #[error("could not determine commit for canonical reference '{refname}', found diverging commits {longest} and {head}, with base commit {base} and threshold {threshold}")]
+ Diverging {
+ refname: String,
+ threshold: usize,
+ base: Oid,
+ longest: Oid,
+ head: Oid,
+ },
/// Could not determine a base candidate from the given set of delegates.
- #[error("could not determine canonical reference tip, {0}")]
- NoCandidates(NoCandidates),
+ #[error("could not determine commit for canonical reference '{refname}', no commit with at least {threshold} vote(s) found (threshold not met)")]
+ NoCandidates { refname: String, threshold: usize },
/// An error occurred from [`git2`].
#[error(transparent)]
Git(#[from] git2::Error),
}
-/// No candidates were found for the [`Canonical::quorum`] calculation.
-///
-/// The [`fmt::Display`] is used in [`QuorumError`], to provide information on
-/// the threshold and delegates in the calculation.
-#[derive(Debug)]
-pub struct NoCandidates {
- threshold: usize,
-}
-
-impl fmt::Display for NoCandidates {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- let NoCandidates { threshold } = self;
- write!(
- f,
- "no commit found with at least {threshold} vote(s) (threshold not met)"
- )
- }
-}
-
-/// Diverging commits were found during the [`Canonical::quorum`] calculation.
-///
-/// The [`fmt::Display`] is used in [`QuorumError`], to provide information on
-/// the threshold, base commit, and the two diverging commits, in the
-/// calculation.
-#[derive(Debug)]
-pub struct Diverging {
- threshold: usize,
- base: Oid,
- longest: Oid,
- head: Oid,
-}
-
-impl fmt::Display for Diverging {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- let Diverging {
- threshold,
- base,
- longest,
- head,
- } = self;
- write!(f, "found diverging commits {longest} and {head}, with base commit {base} and threshold {threshold}")
- }
-}
-
-impl Canonical {
- /// Construct the set of canonical tips of the `Project::default_branch` for
- /// the given `delegates`.
- pub fn default_branch<S>(
- repo: &S,
- project: &Project,
- delegates: &NonEmpty<Did>,
- threshold: usize,
- ) -> Result<Self, raw::Error>
- where
- S: ReadRepository,
- {
- Self::reference(
- repo,
- &lit::refs_heads(project.default_branch()).into(),
- delegates,
- threshold,
- )
- }
-
- /// Construct the set of canonical tips given for the given `delegates` and
- /// the reference `name`.
- pub fn reference<S>(
- repo: &S,
- refname: &Qualified,
- delegates: &NonEmpty<Did>,
- threshold: usize,
- ) -> Result<Self, raw::Error>
+impl<'a, 'b> Canonical<'a, 'b> {
+ /// Construct the set of canonical tips given for the given `rule` and
+ /// the reference `refname`.
+ pub fn new<S>(repo: &S, refname: Qualified<'a>, rule: &'b ValidRule) -> Result<Self, raw::Error>
where
S: ReadRepository,
{
let mut tips = BTreeMap::new();
- for delegate in delegates.iter() {
- match repo.reference_oid(delegate, refname) {
+ for delegate in rule.allowed().iter() {
+ match repo.reference_oid(delegate, &refname) {
Ok(tip) => {
tips.insert(*delegate, tip);
}
@@ -135,7 +73,11 @@ impl Canonical {
Err(e) => return Err(e),
}
}
- Ok(Canonical { tips, threshold })
+ Ok(Canonical {
+ refname,
+ tips,
+ rule,
+ })
}
/// Return the set of [`Did`]s and their [`Oid`] tip.
@@ -143,36 +85,18 @@ impl Canonical {
self.tips.iter()
}
- /// Returns `true` is there were no tips found for any of the delegates for
+ /// Returns `true` if there were no tips found for any of the DIDs for
/// the given reference.
///
/// N.b. this may be the case when a new reference is being created.
- pub fn is_empty(&self) -> bool {
+ pub fn has_no_tips(&self) -> bool {
self.tips.is_empty()
}
-}
-/// Check that a given `target` converges with any of the provided `tips`.
-///
-/// It converges if the `target` is either equal to, ahead of, or behind any of
-/// the tips.
-pub fn converges<'a>(
- tips: impl Iterator<Item = &'a Oid>,
- target: Oid,
- repo: &Repository,
-) -> Result<bool, raw::Error> {
- for tip in tips {
- match repo.graph_ahead_behind(*target, **tip)? {
- (0, 0) => return Ok(true),
- (ahead, behind) if ahead > 0 && behind == 0 => return Ok(true),
- (ahead, behind) if behind > 0 && ahead == 0 => return Ok(true),
- (_, _) => {}
- }
+ pub fn refname(&self) -> &Qualified {
+ &self.refname
}
- Ok(false)
-}
-impl Canonical {
/// In some cases, we allow the vote to be modified. For example, when the
/// `did` is pushing a new commit, we may want to see if the new commit will
/// reach a quorum.
@@ -180,6 +104,41 @@ impl Canonical {
self.tips.insert(did, new);
}
+ /// Check that the provided `did` is part of the set of allowed
+ /// DIDs of the matching rule.
+ pub fn is_allowed(&self, did: &Did) -> bool {
+ self.rule.allowed().contains(did)
+ }
+
+ /// Check that the provided `did` is the only DID in the set of allowed
+ /// DIDs of the matching rule.
+ pub fn is_only(&self, did: &Did) -> bool {
+ self.rule.allowed().is_only(did)
+ }
+
+ /// Checks that setting the given candidate tip would converge with at least
+ /// one other known tip.
+ ///
+ /// It converges if the candidate Oid is either equal to, ahead of, or behind any of
+ /// the tips.
+ pub fn converges(
+ &self,
+ repo: &Repository,
+ candidate: (&Did, &Oid),
+ ) -> Result<bool, raw::Error> {
+ for tip in self
+ .tips
+ .iter()
+ .filter_map(|(did, tip)| (did != candidate.0).then_some(tip))
+ {
+ let (ahead, behind) = repo.graph_ahead_behind(**candidate.1, **tip)?;
+ if ahead * behind == 0 {
+ return Ok(true);
+ }
+ }
+ Ok(false)
+ }
+
/// Computes the quorum or "canonical" tip based on the tips, of `Canonical`,
/// and the threshold. This can be described as the latest commit that is
/// included in at least `threshold` histories. In case there are multiple tips
@@ -187,7 +146,7 @@ impl Canonical {
///
/// Also returns an error if `heads` is empty or `threshold` cannot be
/// satisified with the number of heads given.
- pub fn quorum(self, repo: &raw::Repository) -> Result<Oid, QuorumError> {
+ pub fn quorum(self, repo: &raw::Repository) -> Result<(Qualified<'a>, Oid), QuorumError> {
let mut candidates = BTreeMap::<_, usize>::new();
// Build a list of candidate commits and count how many "votes" each of them has.
@@ -212,14 +171,12 @@ impl Canonical {
}
}
// Keep commits which pass the threshold.
- candidates.retain(|_, votes| *votes >= self.threshold);
+ candidates.retain(|_, votes| *votes >= self.threshold());
- let (mut longest, _) =
- candidates
- .pop_first()
- .ok_or(QuorumError::NoCandidates(NoCandidates {
- threshold: self.threshold,
- }))?;
+ let (mut longest, _) = candidates.pop_first().ok_or(QuorumError::NoCandidates {
+ refname: self.refname.to_string(),
+ threshold: self.threshold(),
+ })?;
// Now that all scores are calculated, figure out what is the longest branch
// that passes the threshold. In case of divergence, return an error.
@@ -253,15 +210,20 @@ impl Canonical {
// o (base)
// |
//
- return Err(QuorumError::Diverging(Diverging {
- threshold: self.threshold,
+ return Err(QuorumError::Diverging {
+ refname: self.refname.to_string(),
+ threshold: self.threshold(),
base: base.into(),
longest,
head: *head,
- }));
+ });
}
}
- Ok((*longest).into())
+ Ok((self.refname, (*longest).into()))
+ }
+
+ fn threshold(&self) -> usize {
+ (*self.rule.threshold()).into()
}
}
@@ -281,7 +243,7 @@ mod tests {
threshold: usize,
repo: &git::raw::Repository,
) -> Result<Oid, QuorumError> {
- let tips = heads
+ let tips: BTreeMap<Did, Oid> = heads
.iter()
.enumerate()
.map(|(i, head)| {
@@ -290,7 +252,24 @@ mod tests {
(did, (*head).into())
})
.collect();
- Canonical { tips, threshold }.quorum(repo)
+
+ let refname =
+ git::refs::branch(git_ext::ref_format::RefStr::try_from_str("master").unwrap());
+
+ let rule: RawRule = crate::git::canonical::rules::Rule::new(
+ crate::git::canonical::rules::Allowed::Delegates,
+ threshold,
+ );
+ let delegates = crate::identity::doc::Delegates::new(tips.keys().cloned()).unwrap();
+ let rule = rule.validate(&mut || delegates.clone()).unwrap();
+
+ Canonical {
+ refname,
+ tips,
+ rule: &rule,
+ }
+ .quorum(repo)
+ .map(|(_, oid)| oid)
}
#[test]
@@ -352,9 +331,6 @@ mod tests {
assert_eq!(quorum(&[*c0], 1, &repo).unwrap(), c0);
assert_eq!(quorum(&[*c1], 1, &repo).unwrap(), c1);
assert_eq!(quorum(&[*c2], 1, &repo).unwrap(), c2);
- assert_eq!(quorum(&[*c0], 0, &repo).unwrap(), c0);
- assert_matches!(quorum(&[], 0, &repo), Err(QuorumError::NoCandidates(_)));
- assert_matches!(quorum(&[*c0], 2, &repo), Err(QuorumError::NoCandidates(_)));
// C1
// |
@@ -380,23 +356,23 @@ mod tests {
// C0
assert_matches!(
quorum(&[*c1, *c2, *b2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*c2, *b2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*b2, *c2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*c2, *b2], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_matches!(
quorum(&[*b2, *c2], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_eq!(quorum(&[*c1, *c2, *b2], 2, &repo).unwrap(), c1);
assert_eq!(quorum(&[*c1, *c2, *b2], 3, &repo).unwrap(), c1);
@@ -404,7 +380,7 @@ mod tests {
assert_eq!(quorum(&[*b2, *c2, *c2], 2, &repo).unwrap(), c2);
assert_matches!(
quorum(&[*b2, *b2, *c2, *c2], 2, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
// B2 C2 C3
@@ -415,15 +391,15 @@ mod tests {
assert_eq!(quorum(&[*b2, *c2, *c2], 2, &repo).unwrap(), c2);
assert_matches!(
quorum(&[*b2, *c2, *c2], 3, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_matches!(
quorum(&[*b2, *c2, *b2, *c2], 3, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_matches!(
quorum(&[*c3, *b2, *c2, *b2, *c2, *c3], 3, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
// B2 C2
@@ -433,19 +409,19 @@ mod tests {
// C0
assert_matches!(
quorum(&[*c2, *b2, *a1], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*c2, *b2, *a1], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_matches!(
quorum(&[*c2, *b2, *a1], 3, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_matches!(
quorum(&[*c1, *c2, *b2, *a1], 4, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_eq!(quorum(&[*c0, *c1, *c2, *b2, *a1], 2, &repo).unwrap(), c1,);
assert_eq!(quorum(&[*c0, *c1, *c2, *b2, *a1], 3, &repo).unwrap(), c1,);
@@ -453,23 +429,23 @@ mod tests {
assert_eq!(quorum(&[*c0, *c1, *c2, *b2, *a1], 4, &repo).unwrap(), c0,);
assert_matches!(
quorum(&[*a1, *a1, *c2, *c2, *c1], 2, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*a1, *a1, *c2, *c2, *c1], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*a1, *a1, *c2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*b2, *b2, *c2, *c2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*b2, *b2, *c2, *c2, *a1], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
// M2 M1
@@ -482,27 +458,27 @@ mod tests {
assert_eq!(quorum(&[*m1], 1, &repo).unwrap(), m1);
assert_matches!(
quorum(&[*m1, *m2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*m2, *m1], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*m1, *m2], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_matches!(
quorum(&[*m1, *m2, *c2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*m1, *a1], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*m1, *a1], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_eq!(quorum(&[*m1, *m2, *b2, *c1], 4, &repo).unwrap(), c1);
assert_eq!(quorum(&[*m1, *m1, *b2], 2, &repo).unwrap(), m1);
@@ -541,11 +517,11 @@ mod tests {
// C0
assert_matches!(
quorum(&[*m1, *m2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*m1, *m2], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
let m3 = fixtures::commit("M3", &[*c2, *c1], &repo);
@@ -557,27 +533,27 @@ mod tests {
// C0
assert_matches!(
quorum(&[*m1, *m3], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*m1, *m3], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_matches!(
quorum(&[*m3, *m1], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*m3, *m1], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
assert_matches!(
quorum(&[*m3, *m2], 1, &repo),
- Err(QuorumError::Diverging(_))
+ Err(QuorumError::Diverging { .. })
);
assert_matches!(
quorum(&[*m3, *m2], 2, &repo),
- Err(QuorumError::NoCandidates(_))
+ Err(QuorumError::NoCandidates { .. })
);
}
}
diff --git a/crates/radicle/src/git/canonical/rules.rs b/crates/radicle/src/git/canonical/rules.rs
index 2b3c6161c..96d708003 100644
--- a/crates/radicle/src/git/canonical/rules.rs
+++ b/crates/radicle/src/git/canonical/rules.rs
@@ -526,16 +526,6 @@ impl MatchedRule<'_> {
pub fn threshold(&self) -> &doc::Threshold {
self.rule().threshold()
}
-
- /// Return the [`Canonical`] representation for the matched rule.
- pub fn canonical(&self, repo: &Repository) -> Result<Canonical, git::raw::Error> {
- Canonical::reference(
- repo,
- &self.refname,
- self.rule.allow.as_ref(),
- self.rule.threshold.into(),
- )
- }
}
/// A set of valid [`Rule`]s, where the set of DIDs and threshold are fully
@@ -577,6 +567,12 @@ impl IntoIterator for Rules {
}
}
+impl Extend<(Pattern, ValidRule)> for Rules {
+ fn extend<T: IntoIterator<Item = (Pattern, ValidRule)>>(&mut self, iter: T) {
+ self.rules.extend(iter)
+ }
+}
+
impl From<Rules> for RawRules {
fn from(Rules { rules }: Rules) -> Self {
Self {
@@ -615,18 +611,32 @@ impl Rules {
Ok(Self { rules: valid })
}
- /// Return the first matching rule for the given `refname`, if there is any.
+ /// Return the matching rules for the given `refname`.
+ pub fn matches<'a>(
+ &self,
+ refname: &Qualified<'a>,
+ ) -> impl Iterator<Item = (&Pattern, &ValidRule)> + use<'a, '_> {
+ let refname_cloned = refname.clone();
+ self.rules
+ .iter()
+ .filter(move |(pattern, _)| pattern.matches(&refname_cloned))
+ }
+
+ /// Match given refname, take the most specific rule, and prepare evaluation
+ /// as [`Canonical`]
///
/// N.b. it will find the first rule that is most specific for the given
/// `refname`.
- pub fn matches<'a>(&self, refname: Qualified<'a>) -> Option<MatchedRule<'a>> {
- self.rules
- .iter()
- .find(|(pattern, _)| pattern.matches(&refname))
- .map(|(_, rule)| MatchedRule {
- refname,
- rule: rule.clone(),
- })
+ pub fn canonical<'a, 'b>(
+ &'a self,
+ refname: Qualified<'b>,
+ repo: &Repository,
+ ) -> Result<Option<Canonical<'b, 'a>>, git::raw::Error> {
+ if let Some((_, rule)) = self.matches(&refname).next() {
+ Ok(Some(Canonical::new(repo, refname, rule)?))
+ } else {
+ Ok(None)
+ }
}
}
@@ -1179,19 +1189,21 @@ mod tests {
// candidates tag.
let stored = storage.repository(rid).unwrap();
let failing = git::Qualified::from(git::lit::refs_tags(failing_tag));
- for (refname, oid) in tags.iter() {
- let matched = rules.matches(refname.clone()).unwrap_or_else(|| {
- panic!("there should be a matching rule for {refname}, rules: {rules:#?}")
- });
- let canonical = matched.canonical(&stored).unwrap();
- if *refname == failing {
+ for (refname, oid) in tags.into_iter() {
+ let canonical = rules
+ .canonical(refname.clone(), &stored)
+ .unwrap()
+ .unwrap_or_else(|| {
+ panic!("there should be a matching rule for {refname}, rules: {rules:#?}")
+ });
+ if refname == failing {
assert!(canonical.quorum(&repo).is_err());
} else {
assert_eq!(
canonical
.quorum(&repo)
.unwrap_or_else(|e| panic!("quorum error for {refname}: {e}")),
- *oid,
+ (refname, oid),
)
}
}
diff --git a/crates/radicle/src/identity.rs b/crates/radicle/src/identity.rs
index c149c83dc..7da9ed90c 100644
--- a/crates/radicle/src/identity.rs
+++ b/crates/radicle/src/identity.rs
@@ -1,8 +1,10 @@
#![warn(clippy::unwrap_used)]
+pub mod crefs;
pub mod did;
pub mod doc;
pub mod project;
+pub use crefs::CanonicalRefs;
pub use crypto::PublicKey;
pub use did::Did;
pub use doc::{Doc, DocAt, DocError, IdError, PayloadError, RawDoc, RepoId, Visibility};
diff --git a/crates/radicle/src/identity/crefs.rs b/crates/radicle/src/identity/crefs.rs
new file mode 100644
index 000000000..112d5ccf0
--- /dev/null
+++ b/crates/radicle/src/identity/crefs.rs
@@ -0,0 +1,124 @@
+use serde::{Deserialize, Serialize};
+
+use crate::git::canonical::{
+ rules::{self, RawRules, Rules, ValidationError},
+ ValidRule,
+};
+
+use super::doc::{Delegates, Payload};
+
+/// Implemented by any data type or store that can return [`CanonicalRefs`] and
+/// [`RawCanonicalRefs`].
+pub trait GetCanonicalRefs {
+ type Error: std::error::Error + Send + Sync + 'static;
+
+ /// Retrieve the [`CanonicalRefs`], returning `Some` if they are not
+ /// present, and `None` if they are missing.
+ ///
+ /// [`Self::Error`] is used to return any domain-specific error by the
+ /// implementing type.
+ fn canonical_refs(&self) -> Result<Option<CanonicalRefs>, Self::Error>;
+
+ /// Retrieve the [`RawCanonicalRefs`], returning `Some` if they are not
+ /// present, and `None` if they are missing.
+ ///
+ /// [`Self::Error`] is used to return any domain-specific error by the
+ /// implementing type.
+ fn raw_canonical_refs(&self) -> Result<Option<RawCanonicalRefs>, Self::Error>;
+
+ /// Retrieve the [`CanonicalRefs`], and in the case of `None`, then use the
+ /// `default` function to return a default set of [`CanonicalRefs`].
+ fn canonical_refs_or_default<D, E>(&self, default: D) -> Result<CanonicalRefs, E>
+ where
+ D: Fn() -> Result<CanonicalRefs, E>,
+ E: From<Self::Error>,
+ {
+ match self.canonical_refs()? {
+ Some(crefs) => Ok(crefs),
+ None => Ok(default()?),
+ }
+ }
+}
+
+/// Configuration for canonical references and their rules.
+///
+/// `RawCanonicalRefs` are verified into [`CanonicalRefs`].
+#[derive(Default, Debug, Clone, PartialEq, Eq, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RawCanonicalRefs {
+ rules: RawRules,
+}
+
+impl RawCanonicalRefs {
+ /// Construct a new [`RawCanonicalRefs`] from a set of [`RawRules`].
+ pub fn new(rules: RawRules) -> Self {
+ Self { rules }
+ }
+
+ /// Return the [`RawRules`].
+ pub fn raw_rules(&self) -> &RawRules {
+ &self.rules
+ }
+
+ /// Validate the [`RawCanonicalRefs`] into a set of [`CanonicalRefs`].
+ pub fn try_into_canonical_refs<R>(
+ self,
+ resolve: &mut R,
+ ) -> Result<CanonicalRefs, ValidationError>
+ where
+ R: Fn() -> Delegates,
+ {
+ let rules = Rules::from_raw(self.rules, resolve)?;
+ Ok(CanonicalRefs { rules })
+ }
+}
+
+/// Configuration for canonical references and their [`Rules`].
+///
+/// [`CanonicalRefs`] can be converted into a [`Payload`] using its [`From`]
+/// implementation.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct CanonicalRefs {
+ rules: Rules,
+}
+
+impl CanonicalRefs {
+ /// Construct a new [`CanonicalRefs`] from a set of [`Rules`].
+ pub fn new(rules: Rules) -> Self {
+ CanonicalRefs { rules }
+ }
+
+ /// Return the [`Rules`].
+ pub fn rules(&self) -> &Rules {
+ &self.rules
+ }
+}
+
+impl FromIterator<(rules::Pattern, ValidRule)> for CanonicalRefs {
+ fn from_iter<T: IntoIterator<Item = (rules::Pattern, ValidRule)>>(iter: T) -> Self {
+ Self::new(Rules::from_iter(iter))
+ }
+}
+
+impl Extend<(rules::Pattern, ValidRule)> for CanonicalRefs {
+ fn extend<T: IntoIterator<Item = (rules::Pattern, ValidRule)>>(&mut self, iter: T) {
+ self.rules.extend(iter)
+ }
+}
+
+#[derive(Debug, thiserror::Error)]
+#[non_exhaustive]
+pub enum CanonicalRefsPayloadError {
+ #[error("could not convert canonical references to JSON: {0}")]
+ Json(#[source] serde_json::Error),
+}
+
+impl TryFrom<CanonicalRefs> for Payload {
+ type Error = CanonicalRefsPayloadError;
+
+ fn try_from(crefs: CanonicalRefs) -> Result<Self, Self::Error> {
+ let value = serde_json::to_value(crefs).map_err(CanonicalRefsPayloadError::Json)?;
+ Ok(Self::from(value))
+ }
+}
diff --git a/crates/radicle/src/identity/doc.rs b/crates/radicle/src/identity/doc.rs
index f9da46d6e..b3f4c1b36 100644
--- a/crates/radicle/src/identity/doc.rs
+++ b/crates/radicle/src/identity/doc.rs
@@ -19,6 +19,7 @@ use crate::cob::identity;
use crate::crypto;
use crate::crypto::Signature;
use crate::git;
+use crate::git::canonical::rules;
use crate::identity::{project::Project, Did};
use crate::node::device::Device;
use crate::storage;
@@ -27,6 +28,9 @@ use crate::storage::{ReadRepository, RepositoryError};
pub use crypto::PublicKey;
pub use id::*;
+use super::crefs::{self, RawCanonicalRefs};
+use super::CanonicalRefs;
+
/// Path to the identity document in the identity branch.
pub static PATH: LazyLock<&Path> = LazyLock::new(|| Path::new("radicle.json"));
/// Maximum length of a string in the identity document.
@@ -73,6 +77,14 @@ impl DocError {
}
}
+#[derive(Debug, Error)]
+pub enum DefaultBranchRuleError {
+ #[error("could not create rule due to the reference name being invalid: {0}")]
+ Pattern(#[from] rules::PatternError),
+ #[error("could not load `xyz.radicle.project` to get default branch name: {0}")]
+ Payload(#[from] PayloadError),
+}
+
/// The version number of the identity document.
///
/// It is used to ensure compatibility when parsing identity documents.
@@ -215,10 +227,20 @@ impl PayloadId {
.expect("PayloadId::project: type name is valid"),
)
}
+
+ pub fn canonical_refs() -> Self {
+ Self(
+ // SAFETY: We know this is valid.
+ TypeName::from_str("xyz.radicle.crefs")
+ .expect("PayloadId::canonical_refs: type name is valid"),
+ )
+ }
}
#[derive(Debug, Error)]
pub enum PayloadError {
+ #[error(transparent)]
+ CanonicalRefs(#[from] rules::ValidationError),
#[error("json: {0}")]
Json(#[from] serde_json::Error),
#[error("payload '{0}' not found in identity document")]
@@ -536,6 +558,11 @@ impl Delegates {
self.0.contains(did)
}
+ /// Check if the `did` is the only delegate of the repository.
+ pub fn is_only(&self, did: &Did) -> bool {
+ self.0.tail.is_empty() && &self.0.head == did
+ }
+
/// Get the number of delegates in the set.
pub fn len(&self) -> usize {
self.0.len()
@@ -715,6 +742,19 @@ impl Doc {
Ok(proj)
}
+ pub fn default_branch_rule(
+ &self,
+ ) -> Result<(rules::Pattern, rules::ValidRule), DefaultBranchRuleError> {
+ let proj = self.project()?;
+ let refname = proj.default_branch();
+ let pattern = rules::Pattern::try_from(git::refs::branch(refname).to_owned())?;
+ let rule = rules::Rule::new(
+ rules::ResolvedDelegates::Delegates(self.delegates.clone()),
+ self.threshold,
+ );
+ Ok((pattern, rule))
+ }
+
/// Return the associated [`Visibility`] of this document.
pub fn visibility(&self) -> &Visibility {
&self.visibility
@@ -872,6 +912,28 @@ impl Doc {
}
}
+impl crefs::GetCanonicalRefs for Doc {
+ type Error = PayloadError;
+
+ fn canonical_refs(&self) -> Result<Option<CanonicalRefs>, Self::Error> {
+ self.raw_canonical_refs().and_then(|raw| {
+ raw.map(|raw| {
+ raw.try_into_canonical_refs(&mut || self.delegates.clone())
+ .map_err(PayloadError::from)
+ })
+ .transpose()
+ })
+ }
+
+ fn raw_canonical_refs(&self) -> Result<Option<RawCanonicalRefs>, Self::Error> {
+ let value = self.payload.get(&PayloadId::canonical_refs());
+ let crefs = value
+ .map(|value| serde_json::from_value((**value).clone()).map_err(PayloadError::from))
+ .transpose()?;
+ Ok(crefs)
+ }
+}
+
#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod test {
diff --git a/crates/radicle/src/storage.rs b/crates/radicle/src/storage.rs
index b4113639d..bff28f13d 100644
--- a/crates/radicle/src/storage.rs
+++ b/crates/radicle/src/storage.rs
@@ -18,7 +18,7 @@ use crate::cob;
use crate::collections::RandomMap;
use crate::git::{canonical, ext as git_ext};
use crate::git::{refspec::Refspec, PatternString, Qualified, RefError, RefStr, RefString};
-use crate::identity::{Did, PayloadError};
+use crate::identity::{doc, Did, PayloadError};
use crate::identity::{Doc, DocAt, DocError};
use crate::identity::{Identity, RepoId};
use crate::node::device::Device;
@@ -120,6 +120,10 @@ pub enum RepositoryError {
Quorum(#[from] canonical::QuorumError),
#[error(transparent)]
Refs(#[from] refs::Error),
+ #[error("missing canonical reference rule for default branch")]
+ MissingBranchRule,
+ #[error("could not get the default branch rule: {0}")]
+ DefaultBranchRule(#[from] doc::DefaultBranchRuleError),
}
impl RepositoryError {
diff --git a/crates/radicle/src/storage/git.rs b/crates/radicle/src/storage/git.rs
index 1a49cd7a3..410f3cb60 100644
--- a/crates/radicle/src/storage/git.rs
+++ b/crates/radicle/src/storage/git.rs
@@ -11,9 +11,9 @@ use std::{fs, io};
use crypto::Verified;
use tempfile::TempDir;
-use crate::git::canonical::Canonical;
+use crate::identity::crefs::GetCanonicalRefs as _;
use crate::identity::doc::DocError;
-use crate::identity::{Doc, DocAt, RepoId};
+use crate::identity::{CanonicalRefs, Doc, DocAt, RepoId};
use crate::identity::{Identity, Project};
use crate::node::device::Device;
use crate::node::SyncedAt;
@@ -749,13 +749,18 @@ impl ReadRepository for Repository {
fn canonical_head(&self) -> Result<(Qualified, Oid), RepositoryError> {
let doc = self.identity_doc()?;
- let project = doc.project()?;
- let branch_ref = git::refs::branch(project.default_branch());
- let raw = self.raw();
- let oid =
- Canonical::default_branch(self, &project, doc.delegates().into(), doc.threshold())?
- .quorum(raw)?;
- Ok((branch_ref, oid))
+ let refname = git::refs::branch(doc.project()?.default_branch());
+ let crefs = match doc.canonical_refs()? {
+ Some(crefs) => crefs,
+ // Fallback to constructing the default branch via the project
+ // payload
+ None => CanonicalRefs::from_iter([doc.default_branch_rule()?]),
+ };
+ Ok(crefs
+ .rules()
+ .canonical(refname, self)?
+ .ok_or(RepositoryError::MissingBranchRule)?
+ .quorum(self.raw())?)
}
fn identity_head(&self) -> Result<Oid, RepositoryError> {
commit f7c5e03456c491fea7c3aa8a0c06fe72e606299c
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Tue Jul 9 09:02:22 2024 +0100
radicle: canonical reference rules
Introduce the `rules` module beneath `canonical`. The implementation follows
the Canonical References RIP[^0].
A `Rule` defines the DIDs and threshold required to get the canonical tip
for a reference (or set of references). Since a `Rule` has some specific
validation rules, there can be two versions of a `Rule`. The `RawRule` is one
that can be easily constructed, serialized, and deserialized. It must then be
validated into a `ValidRule`, which validates any constraints, and can be used
in the computing of a canonical tip.
For convenience, a set of `ValidRule`s is wrapped into the `Rules` type, which
also has a further constraint that each rule refers to a specific `refspec`.
[0]: https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z3trNYnLWS11cJWC6BbxDs5niGo82/patches/1d1ce874f7c39ecdcd8c318bbae46ffd02fe1ea8
diff --git a/Cargo.lock b/Cargo.lock
index 57961bd4e..bbd38b862 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -753,6 +753,12 @@ dependencies = [
"regex-syntax",
]
+[[package]]
+name = "fast-glob"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3afcf4effa2c44390b9912544582d5af29e10dc4c816c5dbebf748e1c7416faa"
+
[[package]]
name = "faster-hex"
version = "0.9.0"
@@ -2353,6 +2359,7 @@ dependencies = [
"crossbeam-channel",
"cyphernet",
"emojis",
+ "fast-glob",
"fastrand",
"git2",
"jsonschema",
diff --git a/crates/radicle/Cargo.toml b/crates/radicle/Cargo.toml
index 38562b02a..08b9a83fe 100644
--- a/crates/radicle/Cargo.toml
+++ b/crates/radicle/Cargo.toml
@@ -22,6 +22,7 @@ chrono = { workspace = true, features = ["clock"], optional = true }
colored = { workspace = true, optional = true }
crossbeam-channel = { workspace = true }
cyphernet = { workspace = true, features = ["tor", "dns", "p2p-ed25519"] }
+fast-glob = { version = "0.3.2" }
fastrand = { workspace = true }
git2 = { workspace = true, features = ["vendored-libgit2"] }
libc = { workspace = true }
diff --git a/crates/radicle/src/git/canonical.rs b/crates/radicle/src/git/canonical.rs
index 08417f3ed..2f5e92826 100644
--- a/crates/radicle/src/git/canonical.rs
+++ b/crates/radicle/src/git/canonical.rs
@@ -1,3 +1,6 @@
+pub mod rules;
+pub use rules::{MatchedRule, RawRule, Rules, ValidRule};
+
use std::collections::BTreeMap;
use std::fmt;
diff --git a/crates/radicle/src/git/canonical/rules.rs b/crates/radicle/src/git/canonical/rules.rs
new file mode 100644
index 000000000..2b3c6161c
--- /dev/null
+++ b/crates/radicle/src/git/canonical/rules.rs
@@ -0,0 +1,1206 @@
+//! Implementation of RIP-0004 Canonical References
+//!
+//! [`RawRules`] is intended to be deserialized and then validated into a set of
+//! [`Rules`]. These can then be used to see if a [`Qualified`] reference
+//! matches any of the rules, using [`Rules::matches`]. Using [`Canonical`] with
+//! the first matched rule, and this can be used to calculate the
+//! [`Canonical::quorum`].
+
+use core::fmt;
+use std::cmp::Ordering;
+use std::collections::BTreeMap;
+use std::sync::LazyLock;
+
+use nonempty::NonEmpty;
+use serde::{Deserialize, Serialize};
+use serde_json as json;
+use thiserror::Error;
+
+use crate::git;
+use crate::git::canonical::Canonical;
+use crate::git::fmt::{refname, RefString};
+use crate::git::refspec::QualifiedPattern;
+use crate::git::Qualified;
+use crate::identity::{doc, Did};
+use crate::storage::git::Repository;
+
+const ASTERISK: char = '*';
+
+static REFS_RAD: LazyLock<RefString> = LazyLock::new(|| refname!("refs/rad"));
+
+/// Private trait to ensure that not any `Rule` can be deserialized.
+/// Implementations are provided for `Allowed` and `usize` so that `RawRule`s
+/// can be deserialized, while `ValidRule`s cannot – preventing deserialization
+/// bugs for that type.
+trait Sealed {}
+impl Sealed for Allowed {}
+impl Sealed for usize {}
+
+/// A `Pattern` is a `QualifiedPattern` reference, however, it disallows any
+/// references under the `refs/rad` hierarchy.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(into = "QualifiedPattern", try_from = "QualifiedPattern")]
+pub struct Pattern(QualifiedPattern<'static>);
+
+impl fmt::Display for Pattern {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.write_str(self.0.as_str())
+ }
+}
+
+impl From<Pattern> for QualifiedPattern<'static> {
+ fn from(Pattern(pattern): Pattern) -> Self {
+ pattern
+ }
+}
+
+impl<'a> TryFrom<QualifiedPattern<'a>> for Pattern {
+ type Error = PatternError;
+
+ fn try_from(pattern: QualifiedPattern<'a>) -> Result<Self, Self::Error> {
+ if pattern.starts_with(REFS_RAD.as_str()) {
+ Err(PatternError::ProtectedRef {
+ prefix: (*REFS_RAD).clone(),
+ pattern: pattern.to_owned(),
+ })
+ } else {
+ Ok(Self(pattern.to_owned()))
+ }
+ }
+}
+
+impl<'a> TryFrom<Qualified<'a>> for Pattern {
+ type Error = PatternError;
+
+ fn try_from(name: Qualified<'a>) -> Result<Self, Self::Error> {
+ Self::try_from(QualifiedPattern::from(name))
+ }
+}
+
+impl Pattern {
+ /// Check if the `refname` matches the rule's `refspec`.
+ pub fn matches(&self, refname: &Qualified) -> bool {
+ // N.b. Git's refspecs do not quite match with glob-star semantics. A
+ // single `*` in a refspec is expected to match all references under
+ // that namespace, even if they are further down the hierarchy.
+ // Thus, the following rules are applied:
+ //
+ // - a trailing `*` changes to `**/*`
+ // - a `*` in between path components changes to `**`
+ let spec = match self.0.as_str().split_once(ASTERISK) {
+ None => self.0.to_string(),
+ // Expand `refs/tags/*` to `refs/tags/**/*`
+ Some((prefix, "")) => {
+ let mut spec = prefix.to_string();
+ spec.push_str("**/*");
+ spec
+ }
+ // Expand `refs/tags/*/v1.0` to `refs/tags/**/v1.0`
+ Some((prefix, suffix)) => {
+ let mut spec = prefix.to_string();
+ spec.push_str("**");
+ spec.push_str(suffix);
+ spec
+ }
+ };
+ fast_glob::glob_match(&spec, refname.as_str())
+ }
+}
+
+impl AsRef<QualifiedPattern<'static>> for Pattern {
+ fn as_ref(&self) -> &QualifiedPattern<'static> {
+ &self.0
+ }
+}
+
+impl PartialOrd for Pattern {
+ fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+ Some(self.cmp(other))
+ }
+}
+
+/// Patterns are ordered by their specificity.
+///
+/// This is heavily influenced by the evaluation priority of Rules. For a
+/// candidate reference name, we want the rule associated with the most specific
+/// pattern to apply, i.e. to take priority over all other rules with less
+/// specific patterns.
+///
+/// For two patterns `φ` and `ψ`, we say that "`φ` is more specific than `ψ`", denoted
+/// `φ < ψ` if:
+///
+/// 1. The number of components in `φ` is larger than the number of components
+/// in `ψ`. (Note that the number of components is equal to the number of
+/// occurrences of the symbol '/' in the pattern, plus 1).
+/// The justification is, that refnames might be interpreted as a hierarchy
+/// where a match on more components would mean a match at a lower level in
+/// the hierarchy, thus being more specific.
+/// Imagine a refname hierarchy that maps to a corporate hierarchy.
+/// The pattern "department-1" matches all refnames that are administered
+/// by a particular department, and thus is not very specific.
+/// To contrast, the pattern "department-1/team-a/project-i/nice-feature"
+/// is very specific as it matches all refnames that relate to the
+/// development of a particular feature for a particular project by a
+/// particular team.
+/// Note that this would also apply when the connection between the `φ` and `ψ`
+/// is not as obvious, e.g. also `a/b/c/d/* < */x`.
+///
+/// (Note that for the following items, one may assume that `φ` and `ψ` have the
+/// same number of components.)
+///
+/// 2. If path component i of `φ`, denoted `φ[i]`, is more specific than path
+/// component i of `ψ`, denoted `ψ[i]`. This is the case if:
+/// a. `φ[i]` does not contain an asterisk and `ψ[i]` contains an asterisk,
+/// i.e. the symbol `*`, e.g. `a < * and abc < a*`.
+/// Note that this is important to capture specificity accross
+/// components, i.e. to conclude that `a/b/* < a/*/c`.
+/// b. Both `φ[i]` and `ψ[i]` contain an asterisk.
+/// A. The asterisk in `φ[i]` is further right than the asterisk in `φ[i]`,
+/// e.g. `aa* < a*`.
+/// B. The asterisk in `φ[i]` and `ψ[i]` is equally far to the right,
+/// and `φ[i]` is longer than `ψ[i]`, e.g. `a*b < a*`.
+///
+/// 3. Otherwise, fall back to a lexicographic ordering.
+///
+/// Some examples (justification in parentheses):
+///
+/// ```text, no_run
+/// refs/tags/release/candidates/* <(1.) refs/tags/release/* <(1.) refs/tags/*
+/// refs/tags/v1.0 <(2.a.) refs/tags/*
+/// refs/heads/* <(3.) refs/tags/*
+/// refs/heads/main <(3.) refs/tags/v1.0
+/// ```
+impl Ord for Pattern {
+ fn cmp(&self, other: &Self) -> Ordering {
+ #[derive(Debug, Clone, Copy)]
+ #[repr(i8)]
+ enum ComponentOrdering {
+ MatchLength(Ordering),
+ Lexicographic(Ordering),
+ }
+
+ impl ComponentOrdering {
+ fn merge(&mut self, other: Self) {
+ *self = match (*self, other) {
+ (Self::Lexicographic(Ordering::Equal), Self::Lexicographic(other)) => {
+ Self::Lexicographic(other)
+ }
+ (Self::Lexicographic(_), Self::MatchLength(other)) => Self::MatchLength(other),
+ (Self::MatchLength(Ordering::Equal), Self::MatchLength(other)) => {
+ Self::MatchLength(other)
+ }
+ (clone, _) => clone,
+ }
+ }
+ }
+
+ impl From<ComponentOrdering> for Ordering {
+ fn from(value: ComponentOrdering) -> Self {
+ match value {
+ ComponentOrdering::MatchLength(ordering) => ordering,
+ ComponentOrdering::Lexicographic(ordering) => ordering,
+ }
+ }
+ }
+
+ impl Default for ComponentOrdering {
+ /// The weakest value of Self, which will be absorbed by any
+ /// other in [`ComponentOrdering::merge`].
+ fn default() -> Self {
+ Self::Lexicographic(Ordering::Equal)
+ }
+ }
+
+ use git::refspec::Component;
+
+ fn cmp_component(lhs: Component<'_>, rhs: Component<'_>) -> ComponentOrdering {
+ let (l, r) = (lhs.as_str(), rhs.as_str());
+ match (l.find(ASTERISK), r.find(ASTERISK)) {
+ // (2.a.)
+ (Some(_), None) => ComponentOrdering::MatchLength(Ordering::Greater),
+ // (2.a.)
+ (None, Some(_)) => ComponentOrdering::MatchLength(Ordering::Less),
+ (Some(li), Some(ri)) => {
+ if li != ri {
+ // (2.b.A)
+ ComponentOrdering::MatchLength(li.cmp(&ri).reverse())
+ } else if l.len() != r.len() {
+ // (2.b.B)
+ ComponentOrdering::MatchLength(l.len().cmp(&r.len()).reverse())
+ } else {
+ // (3.)
+ ComponentOrdering::Lexicographic(l.cmp(r))
+ }
+ }
+ // (3.)
+ (None, None) => ComponentOrdering::Lexicographic(l.cmp(r)),
+ }
+ }
+
+ let mut result = ComponentOrdering::default();
+ let mut lhs = self.0.components();
+ let mut rhs = other.0.components();
+ loop {
+ match (lhs.next(), rhs.next()) {
+ (None, Some(_)) => return Ordering::Greater, // (1.)
+ (Some(_), None) => return Ordering::Less, // (1.)
+ (Some(lhs), Some(rhs)) => {
+ result.merge(cmp_component(lhs, rhs));
+ }
+ (None, None) => return result.into(),
+ }
+ }
+ }
+}
+
+/// A [`Rule`] that can be serialized and deserialized safely.
+///
+/// Should be converted to a [`ValidRule`] via [`Rule::validate`].
+pub type RawRule = Rule<Allowed, usize>;
+
+impl RawRule {
+ /// Validate the `Rule` into a form that can be used for calculating
+ /// canonical references.
+ ///
+ /// The `resolve` callback is to allow the caller to specify the DIDs of the
+ /// identity document, in the case that the allowed value is
+ /// [`Allowed::Delegates`].
+ pub fn validate<R>(self, resolve: &mut R) -> Result<ValidRule, ValidationError>
+ where
+ R: Fn() -> doc::Delegates,
+ {
+ let Self {
+ allow: delegates,
+ threshold,
+ ..
+ } = self;
+ let allow = match &delegates {
+ Allowed::Delegates => ResolvedDelegates::Delegates(resolve()),
+ Allowed::Set(delegates) => {
+ let valid =
+ doc::Delegates::new(delegates.clone()).map_err(ValidationError::from)?;
+ ResolvedDelegates::Set(valid)
+ }
+ };
+ let threshold = doc::Threshold::new(threshold, &allow)?;
+ Ok(Rule {
+ allow,
+ threshold,
+ extensions: self.extensions,
+ })
+ }
+}
+
+/// A set of `RawRule`s that can be serialized and deserialized.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+pub struct RawRules {
+ /// The reference pattern that this rule applies to.
+ ///
+ /// Note that this can be a fully-qualified pattern, e.g. `refs/heads/qa`,
+ /// as well as a wild-card pattern, e.g. `refs/tags/*`.
+ #[serde(flatten)]
+ pub rules: BTreeMap<Pattern, RawRule>,
+}
+
+impl RawRules {
+ /// Returns an iterator over the [`Pattern`] and [`RawRule`] in the set of
+ /// rules.
+ pub fn iter(&self) -> impl Iterator<Item = (&Pattern, &RawRule)> {
+ self.rules.iter()
+ }
+
+ /// Add a new [`RawRule`] to the set of rules.
+ ///
+ /// Returns the replaced rule, if it existed.
+ pub fn insert(&mut self, pattern: Pattern, rule: RawRule) -> Option<RawRule> {
+ self.rules.insert(pattern, rule)
+ }
+
+ /// Remove the rule that matches the `pattern` parameter.
+ ///
+ /// Returns the rule if it existed.
+ pub fn remove(&mut self, pattern: &Pattern) -> Option<RawRule> {
+ self.rules.remove(pattern)
+ }
+
+ /// Check to see if there is an exact match for `refname` in the rules.
+ pub fn exact_match(&self, refname: &Qualified) -> bool {
+ let refname = refname.as_str();
+ self.rules
+ .iter()
+ .any(|(pattern, _)| pattern.0.as_str() == refname)
+ }
+
+ /// Check if the `refname` matches any existing rules, including glob
+ /// matches.
+ pub fn matches<'a, 'b>(
+ &self,
+ refname: &Qualified<'b>,
+ ) -> impl Iterator<Item = (&Pattern, &RawRule)> + use<'a, '_, 'b> {
+ let refname = refname.clone();
+ self.rules
+ .iter()
+ .filter(move |(pattern, _)| pattern.matches(&refname))
+ }
+}
+
+impl Extend<(Pattern, RawRule)> for RawRules {
+ fn extend<T: IntoIterator<Item = (Pattern, RawRule)>>(&mut self, iter: T) {
+ self.rules.extend(iter)
+ }
+}
+
+impl From<BTreeMap<Pattern, RawRule>> for RawRules {
+ fn from(rules: BTreeMap<Pattern, RawRule>) -> Self {
+ RawRules { rules }
+ }
+}
+
+impl FromIterator<(Pattern, RawRule)> for RawRules {
+ fn from_iter<T: IntoIterator<Item = (Pattern, RawRule)>>(iter: T) -> Self {
+ iter.into_iter().collect::<BTreeMap<_, _>>().into()
+ }
+}
+
+impl IntoIterator for RawRules {
+ type Item = (Pattern, RawRule);
+ type IntoIter = std::collections::btree_map::IntoIter<Pattern, RawRule>;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.rules.into_iter()
+ }
+}
+
+/// A [`Rule`] that has been validated. See [`Rules`] and [`Rules::matches`] for
+/// its main usage.
+///
+/// N.b. a `ValidRule` can be serialized, however, it cannot be deserialized.
+/// This is due to the fact that the `allow` field may have a value of
+/// `delegates`. In those cases the value needs to be looked up via the identity
+/// document and validated.
+pub type ValidRule = Rule<ResolvedDelegates, doc::Threshold>;
+
+impl ValidRule {
+ /// Initialize a `ValidRule` for the default branch, given by `name`. The
+ /// rule will contain the single `did` as the allowed DID, and use a
+ /// threshold of `1`.
+ ///
+ /// Note that the serialization of the rule will use the `delegates` token
+ /// for the rule. E.g.
+ /// ```json
+ /// {
+ /// "pattern": "refs/heads/main",
+ /// "allow": ["did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"],
+ /// "threshold": 1
+ /// }
+ /// ```
+ ///
+ /// # Errors
+ ///
+ /// If the `name` reference begins with `refs/rad`.
+ pub fn default_branch(did: Did, name: &git::RefStr) -> Result<(Pattern, Self), PatternError> {
+ let pattern = Pattern::try_from(git::refs::branch(name).to_owned())?;
+ let rule = Self {
+ allow: ResolvedDelegates::Delegates(doc::Delegates::from(did)),
+ // N.B. this needs to be the minimum since we only have one
+ // delegate.
+ threshold: doc::Threshold::MIN,
+ extensions: json::Map::new(),
+ };
+ Ok((pattern, rule))
+ }
+}
+
+impl From<ValidRule> for RawRule {
+ fn from(rule: ValidRule) -> Self {
+ let Rule {
+ allow,
+ threshold,
+ extensions,
+ } = rule;
+ Self {
+ allow: allow.into(),
+ threshold: threshold.into(),
+ extensions,
+ }
+ }
+}
+
+/// A representation of a set of allowed DIDs.
+///
+/// `Allowed` is used in a `RawRule`.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+pub enum Allowed {
+ /// Pointer to the identity document's set of delegates.
+ #[serde(rename = "delegates")]
+ #[default]
+ Delegates,
+ /// Explicit list of allowed DIDs.
+ ///
+ /// The elements of the list of allowed DIDs will be made unique, i.e.
+ /// duplicate DIDs will be discarded.
+ ///
+ /// # Validation
+ ///
+ /// The list of allowed DIDs, `allowed`, must satisfy:
+ /// ```text
+ /// 1 <= allowed.len() <= 255
+ /// ```
+ #[serde(untagged)]
+ Set(NonEmpty<Did>),
+}
+
+impl From<NonEmpty<Did>> for Allowed {
+ fn from(dids: NonEmpty<Did>) -> Self {
+ Self::Set(dids)
+ }
+}
+
+impl From<Did> for Allowed {
+ fn from(did: Did) -> Self {
+ Self::Set(NonEmpty::new(did))
+ }
+}
+
+/// A marker `enum` that is used in a [`ValidRule`].
+///
+/// It ensures that a rule that has been deserialized, resolving the `delegates`
+/// token to a set of DIDs, is still serialized back to the `delegates` token –
+/// as opposed to serializing it to the set of DIDs.
+///
+/// The variants mirror the [`Allowed::Delegates`] and [`Allowed::Set`]
+/// variants.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
+#[serde(into = "Allowed")]
+pub enum ResolvedDelegates {
+ Delegates(doc::Delegates),
+ Set(doc::Delegates),
+}
+
+impl From<ResolvedDelegates> for Allowed {
+ fn from(ds: ResolvedDelegates) -> Self {
+ match ds {
+ ResolvedDelegates::Delegates(_) => Self::Delegates,
+ ResolvedDelegates::Set(ds) => Self::Set(ds.into()),
+ }
+ }
+}
+
+impl std::ops::Deref for ResolvedDelegates {
+ type Target = doc::Delegates;
+
+ fn deref(&self) -> &Self::Target {
+ match self {
+ ResolvedDelegates::Delegates(ds) => ds,
+ ResolvedDelegates::Set(ds) => ds,
+ }
+ }
+}
+
+/// A reference that has been matched against a [`ValidRule`].
+///
+/// Can be constructed by using [`Rules::matches`].
+#[derive(Debug)]
+pub struct MatchedRule<'a> {
+ refname: Qualified<'a>,
+ rule: ValidRule,
+}
+
+impl MatchedRule<'_> {
+ /// Return the reference name that was used for checking if it was a match.
+ pub fn refname(&self) -> &Qualified {
+ &self.refname
+ }
+
+ /// Return the rule that was matched.
+ pub fn rule(&self) -> &ValidRule {
+ &self.rule
+ }
+
+ /// Return the allowed DIDs for the matched rule.
+ pub fn allowed(&self) -> &doc::Delegates {
+ self.rule().allowed()
+ }
+
+ /// Return the [`doc::Threshold`] for the matched rule.
+ pub fn threshold(&self) -> &doc::Threshold {
+ self.rule().threshold()
+ }
+
+ /// Return the [`Canonical`] representation for the matched rule.
+ pub fn canonical(&self, repo: &Repository) -> Result<Canonical, git::raw::Error> {
+ Canonical::reference(
+ repo,
+ &self.refname,
+ self.rule.allow.as_ref(),
+ self.rule.threshold.into(),
+ )
+ }
+}
+
+/// A set of valid [`Rule`]s, where the set of DIDs and threshold are fully
+/// resolved and valid. Since the rules are constructed via a `BTreeMap`, they
+/// cannot be duplicated.
+///
+/// To construct the set of rules, use [`Rules::from_raw`], which validates a
+/// set of [`RawRule`]s, and their [`Pattern`] references, into a set of
+/// [`ValidRule`]s.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize)]
+pub struct Rules {
+ #[serde(flatten)]
+ rules: BTreeMap<Pattern, ValidRule>,
+}
+
+impl FromIterator<(Pattern, ValidRule)> for Rules {
+ fn from_iter<T: IntoIterator<Item = (Pattern, ValidRule)>>(iter: T) -> Self {
+ Self {
+ rules: iter.into_iter().collect(),
+ }
+ }
+}
+
+impl<'a> IntoIterator for &'a Rules {
+ type Item = (&'a Pattern, &'a ValidRule);
+ type IntoIter = std::collections::btree_map::Iter<'a, Pattern, ValidRule>;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.rules.iter()
+ }
+}
+
+impl IntoIterator for Rules {
+ type Item = (Pattern, ValidRule);
+ type IntoIter = std::collections::btree_map::IntoIter<Pattern, ValidRule>;
+
+ fn into_iter(self) -> Self::IntoIter {
+ self.rules.into_iter()
+ }
+}
+
+impl From<Rules> for RawRules {
+ fn from(Rules { rules }: Rules) -> Self {
+ Self {
+ rules: rules
+ .into_iter()
+ .map(|(pattern, rule)| (pattern, rule.into()))
+ .collect(),
+ }
+ }
+}
+
+impl Rules {
+ /// Returns an iterator over the [`Pattern`] and [`ValidRule`] in the set of
+ /// rules.
+ pub fn iter(&self) -> impl Iterator<Item = (&Pattern, &ValidRule)> {
+ self.rules.iter()
+ }
+
+ /// Returns `true` is the set of rules is empty.
+ pub fn is_empty(&self) -> bool {
+ self.rules.is_empty()
+ }
+
+ /// Construct a set of `Rules` given a set of `RawRule`s.
+ pub fn from_raw<R>(
+ rules: impl IntoIterator<Item = (Pattern, RawRule)>,
+ resolve: &mut R,
+ ) -> Result<Self, ValidationError>
+ where
+ R: Fn() -> doc::Delegates,
+ {
+ let valid = rules
+ .into_iter()
+ .map(|(pattern, rule)| rule.validate(resolve).map(|rule| (pattern, rule)))
+ .collect::<Result<_, _>>()?;
+ Ok(Self { rules: valid })
+ }
+
+ /// Return the first matching rule for the given `refname`, if there is any.
+ ///
+ /// N.b. it will find the first rule that is most specific for the given
+ /// `refname`.
+ pub fn matches<'a>(&self, refname: Qualified<'a>) -> Option<MatchedRule<'a>> {
+ self.rules
+ .iter()
+ .find(|(pattern, _)| pattern.matches(&refname))
+ .map(|(_, rule)| MatchedRule {
+ refname,
+ rule: rule.clone(),
+ })
+ }
+}
+
+/// A `Rule` defines how a reference or set of references can be made canonical,
+/// i.e. have a top-level `refs/*` entry – see [`Pattern`].
+///
+/// The [`Rule::allowed`] type is generic to allow for [`Allowed`] to be used
+/// for serialization and deserialization, however, the use of
+/// [`Rule::validate`] should be used to get a valid rule.
+///
+/// The [`Rule::threshold`], similarly, allows for [`doc::Threshold`] to be used, and
+/// [`Rule::validate`] should be used to get a valid rule.
+// N.b. it's safe to derive `Serialize` since we only allow constructing a
+// `Rule` via `Rule::validate`, and we seal `Deserialize` by ensuring that only
+// `RawRule` can be deserialized.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(bound(deserialize = "D: Sealed + Deserialize<'de>, T: Sealed + Deserialize<'de>"))]
+pub struct Rule<D, T> {
+ /// The set of allowed DIDs that are considered for voting for this rule.
+ allow: D,
+ /// The threshold the votes must pass for the reference(s) to be considered
+ /// canonical.
+ threshold: T,
+
+ /// Optional extensions in rules. This is intended to preserve backwards and
+ /// forward-compatibility
+ #[serde(skip_serializing_if = "json::Map::is_empty")]
+ #[serde(flatten)]
+ extensions: json::Map<String, json::Value>,
+}
+
+impl<D, T> Rule<D, T> {
+ /// Construct a new `Rule` with the given `allow` and `threshold`.
+ pub fn new(allow: D, threshold: T) -> Self {
+ Self {
+ allow,
+ threshold,
+ extensions: json::Map::new(),
+ }
+ }
+
+ /// Get the set of DIDs this `Rule` was created with.
+ pub fn allowed(&self) -> &D {
+ &self.allow
+ }
+
+ /// Get the set of threshold this `Rule` was created with.
+ pub fn threshold(&self) -> &T {
+ &self.threshold
+ }
+
+ /// Get the extensions that may have been added to this `Rule`.
+ pub fn extensions(&self) -> &json::Map<String, json::Value> {
+ &self.extensions
+ }
+
+ /// If the [`Rule::extensions`] is not set, the provided `extensions` will
+ /// be used.
+ ///
+ /// Otherwise, it expects that the JSON value is a `Map` and the
+ /// `extensions` are merged. If the existing value is any other kind of JSON
+ /// value, this is a no-op.
+ pub fn add_extensions(&mut self, extensions: impl Into<json::Map<String, json::Value>>) {
+ self.extensions.extend(extensions.into());
+ }
+}
+
+#[derive(Debug, Error)]
+pub enum PatternError {
+ #[error("cannot create rule for '{pattern}' since references under '{prefix}' are protected")]
+ ProtectedRef {
+ prefix: RefString,
+ pattern: QualifiedPattern<'static>,
+ },
+}
+
+#[derive(Debug, Error)]
+pub enum ValidationError {
+ #[error(transparent)]
+ Threshold(#[from] doc::ThresholdError),
+ #[error(transparent)]
+ Delegates(#[from] doc::DelegatesError),
+ #[error("cannot create rule for reserved `rad` references '{pattern}'")]
+ RadRef { pattern: QualifiedPattern<'static> },
+}
+
+#[derive(Debug, Error)]
+pub enum CanonicalError {
+ #[error(transparent)]
+ Git(#[from] git::raw::Error),
+ #[error(transparent)]
+ References(#[from] git::ext::Error),
+}
+
+#[cfg(test)]
+#[allow(clippy::unwrap_used)]
+mod tests {
+ use std::collections::BTreeMap;
+
+ use nonempty::nonempty;
+
+ use crate::crypto::{test::signer::MockSigner, Signer};
+ use crate::git;
+ use crate::git::refspec::qualified_pattern;
+ use crate::git::RefString;
+ use crate::identity::doc::Doc;
+ use crate::identity::Visibility;
+ use crate::node::device::Device;
+ use crate::rad;
+ use crate::storage::refs::{IDENTITY_BRANCH, IDENTITY_ROOT, SIGREFS_BRANCH};
+ use crate::storage::{git::transport, ReadStorage};
+ use crate::test::{arbitrary, fixtures};
+ use crate::Storage;
+
+ use super::*;
+
+ fn roundtrip(rule: &Rule<Allowed, usize>) {
+ let json = serde_json::to_string(rule).unwrap();
+ assert_eq!(
+ *rule,
+ serde_json::from_str(&json).unwrap(),
+ "failed to roundtrip: {json}"
+ )
+ }
+
+ fn did(s: &str) -> Did {
+ s.parse().unwrap()
+ }
+
+ fn pattern(qp: QualifiedPattern<'static>) -> Pattern {
+ Pattern::try_from(qp).unwrap()
+ }
+
+ fn resolve_from_doc(doc: &Doc) -> doc::Delegates {
+ doc.delegates().clone()
+ }
+
+ fn tag(name: RefString, head: git2::Oid, repo: &git2::Repository) -> git::Oid {
+ let commit = fixtures::commit(name.as_str(), &[head], repo);
+ let target = repo.find_object(*commit, None).unwrap();
+ let tagger = repo.signature().unwrap();
+ repo.tag(name.as_str(), &target, &tagger, name.as_str(), false)
+ .unwrap()
+ .into()
+ }
+
+ #[test]
+ fn test_roundtrip() {
+ let rule1 = Rule::new(Allowed::Delegates, 1);
+ let rule2 = Rule::new(Allowed::Delegates, 1);
+ let rule3 = Rule::new(Allowed::Delegates, 1);
+ let mut rule4 = Rule::new(
+ Allowed::Set(nonempty![
+ did("did:key:z6MkpQTLwr8QyADGmBGAMsGttvWzP4PojUMs4hREZW5T5E3K"),
+ did("did:key:z6MknG1nYDftMYUQ7eTBSGgqB2PL1xK5Pif33J3sRym3e8ye"),
+ ]),
+ 2,
+ );
+ rule4.add_extensions(
+ serde_json::json!({
+ "foo": "bar",
+ "quux": 5,
+ })
+ .as_object()
+ .cloned()
+ .unwrap(),
+ );
+ roundtrip(&rule1);
+ roundtrip(&rule2);
+ roundtrip(&rule3);
+ roundtrip(&rule4);
+ }
+
+ #[test]
+ fn test_deserialization() {
+ let examples = r#"
+{
+ "refs/heads/main": {
+ "threshold": 2,
+ "allow": [
+ "did:key:z6MkpQTLwr8QyADGmBGAMsGttvWzP4PojUMs4hREZW5T5E3K",
+ "did:key:z6MknG1nYDftMYUQ7eTBSGgqB2PL1xK5Pif33J3sRym3e8ye"
+ ]
+ },
+ "refs/tags/releases/*": {
+ "threshold": 2,
+ "allow": [
+ "did:key:z6MknLWe8A7UJxvTfY36JcB8XrP1KTLb5HFTX38hEmdY3b56",
+ "did:key:z6Mkq2E5Se5H9gk1DsL1EMwR2t4CqSg3GFkNN2UeG4FNqXoP",
+ "did:key:z6MkqRmXW5fbP9hJ1Y8j2N4CgVdJ2XJ6TsyXYf3FQ2NJgXax"
+ ]
+ },
+ "refs/heads/development": {
+ "threshold": 1,
+ "allow": [
+ "did:key:z6MkhH7ENYE62JAjTiRZPU71MGZ6xCwnbyHHWfrBu3fr6PVG"
+ ]
+ },
+ "refs/heads/release/*": {
+ "threshold": 1,
+ "allow": "delegates"
+ }
+}
+ "#;
+ let expected = [
+ (
+ pattern(qualified_pattern!("refs/heads/main")),
+ Rule::new(
+ Allowed::Set(nonempty![
+ did("did:key:z6MkpQTLwr8QyADGmBGAMsGttvWzP4PojUMs4hREZW5T5E3K"),
+ did("did:key:z6MknG1nYDftMYUQ7eTBSGgqB2PL1xK5Pif33J3sRym3e8ye"),
+ ]),
+ 2,
+ ),
+ ),
+ (
+ pattern(qualified_pattern!("refs/tags/releases/*")),
+ Rule::new(
+ Allowed::Set(nonempty![
+ did("did:key:z6MknLWe8A7UJxvTfY36JcB8XrP1KTLb5HFTX38hEmdY3b56"),
+ did("did:key:z6Mkq2E5Se5H9gk1DsL1EMwR2t4CqSg3GFkNN2UeG4FNqXoP"),
+ did("did:key:z6MkqRmXW5fbP9hJ1Y8j2N4CgVdJ2XJ6TsyXYf3FQ2NJgXax")
+ ]),
+ 2,
+ ),
+ ),
+ (
+ pattern(qualified_pattern!("refs/heads/development")),
+ Rule::new(
+ Allowed::Set(nonempty![did(
+ "did:key:z6MkhH7ENYE62JAjTiRZPU71MGZ6xCwnbyHHWfrBu3fr6PVG"
+ )]),
+ 1,
+ ),
+ ),
+ (
+ pattern(qualified_pattern!("refs/heads/release/*")),
+ Rule::new(Allowed::Delegates, 1),
+ ),
+ ]
+ .into_iter()
+ .collect::<RawRules>();
+ let rules = serde_json::from_str::<BTreeMap<Pattern, RawRule>>(examples)
+ .unwrap()
+ .into();
+ assert_eq!(expected, rules)
+ }
+
+ #[test]
+ fn test_order() {
+ assert!(
+ pattern(qualified_pattern!("a/b/c/d/*")) < pattern(qualified_pattern!("*/x")),
+ "example 1"
+ );
+ assert!(
+ pattern(qualified_pattern!("a")) < pattern(qualified_pattern!("*")),
+ "example 2.a"
+ );
+ assert!(
+ pattern(qualified_pattern!("abc")) < pattern(qualified_pattern!("a*")),
+ "example 2.a"
+ );
+ assert!(
+ pattern(qualified_pattern!("a/b/*")) < pattern(qualified_pattern!("a/*/c")),
+ "example 2.a"
+ );
+ assert!(
+ pattern(qualified_pattern!("aa*")) < pattern(qualified_pattern!("a*")),
+ "example 2.b.A"
+ );
+ assert!(
+ pattern(qualified_pattern!("a*b")) < pattern(qualified_pattern!("a*")),
+ "example 2.b.B"
+ );
+
+ let pattern01 = pattern(qualified_pattern!("refs/tags/*"));
+ let pattern02 = pattern(qualified_pattern!("refs/tags/v1"));
+ let pattern04 = pattern(qualified_pattern!("refs/tags/v1.0.0"));
+ let pattern05 = pattern(qualified_pattern!("refs/tags/release/v1.0.0"));
+ let pattern03 = pattern(qualified_pattern!("refs/heads/main"));
+ let pattern06 = pattern(qualified_pattern!("refs/tags/*/v1.0.0"));
+
+ let pattern07 = pattern(qualified_pattern!("refs/tags/x*"));
+ let pattern08 = pattern(qualified_pattern!("refs/tags/xx*"));
+
+ let pattern09 = pattern(qualified_pattern!("refs/foos/*"));
+
+ let pattern10 = pattern(qualified_pattern!("a"));
+ let pattern11 = pattern(qualified_pattern!("b"));
+
+ let pattern12 = pattern(qualified_pattern!("a/*"));
+ let pattern13 = pattern(qualified_pattern!("b/*"));
+
+ let pattern14 = pattern(qualified_pattern!("a/*/ab"));
+ let pattern15 = pattern(qualified_pattern!("a/*/a"));
+
+ let pattern16 = pattern(qualified_pattern!("a/*/b"));
+ let pattern17 = pattern(qualified_pattern!("a/*/a"));
+
+ // Test priority for path specificity
+ assert!(
+ pattern06 < pattern02,
+ "match for 06 is always more specific since it has more components"
+ );
+ assert!(pattern02 < pattern01, "match for 02 is also match for 01");
+ assert!(pattern08 < pattern07, "match for 08 is also match for 07");
+ // Test equality
+ assert!(pattern02 == pattern02);
+ // Test lexicographical fallback when paths are equally specific
+ assert!(pattern02 < pattern04);
+ assert!(pattern03 < pattern01);
+ assert!(pattern09 < pattern01);
+ assert!(pattern10 < pattern11);
+ assert!(pattern12 < pattern13);
+ assert!(pattern15 < pattern14);
+ assert!(
+ pattern17 < pattern16,
+ "matches have same length, but lexicographically, 'a' < 'b'"
+ );
+
+ // Test example from docs
+ let pattern18 = pattern(qualified_pattern!("refs/tags/release/candidates/*"));
+ let pattern19 = pattern(qualified_pattern!("refs/tags/release/*"));
+ let pattern20 = pattern(qualified_pattern!("refs/tags/*"));
+
+ assert!(pattern18 < pattern19);
+ assert!(pattern19 < pattern20);
+
+ let pattern21 = pattern(qualified_pattern!("refs/heads/dev"));
+
+ assert!(pattern21 < pattern03);
+
+ let mut patterns = [
+ pattern01.clone(),
+ pattern02.clone(),
+ pattern03.clone(),
+ pattern04.clone(),
+ pattern05.clone(),
+ pattern06.clone(),
+ ];
+ patterns.sort();
+
+ assert_eq!(
+ patterns,
+ [pattern05, pattern06, pattern03, pattern02, pattern04, pattern01]
+ );
+ }
+
+ #[test]
+ fn test_deserialize_extensions() {
+ let example = r#"
+{
+ "threshold": 2,
+ "allow": [
+ "did:key:z6MkpQTLwr8QyADGmBGAMsGttvWzP4PojUMs4hREZW5T5E3K",
+ "did:key:z6MknG1nYDftMYUQ7eTBSGgqB2PL1xK5Pif33J3sRym3e8ye"
+ ],
+ "foo": "bar",
+ "quux": 5
+}
+"#;
+ let rule = serde_json::from_str::<Rule<Allowed, usize>>(example).unwrap();
+ assert!(!rule.extensions().is_empty());
+ let extensions = rule.extensions();
+ assert_eq!(
+ extensions.get("foo"),
+ Some(serde_json::Value::String("bar".to_string())).as_ref()
+ );
+ assert_eq!(
+ extensions.get("quux"),
+ Some(serde_json::Value::Number(5.into())).as_ref()
+ );
+ }
+
+ #[test]
+ fn test_rule_validate_success() {
+ let doc = arbitrary::gen::<Doc>(1);
+ let delegates = Allowed::Set(doc.delegates().as_ref().clone());
+ let threshold = doc.majority();
+
+ let rule = Rule::new(delegates, threshold);
+ let result = rule.validate(&mut || resolve_from_doc(&doc));
+ assert!(result.is_ok(), "failed to validate doc: {result:?}");
+
+ let rule = Rule::new(Allowed::Delegates, 1);
+ let result = rule.validate(&mut || resolve_from_doc(&doc));
+ assert!(result.is_ok(), "failed to validate doc: {result:?}");
+ }
+
+ #[test]
+ fn test_rule_validate_failures() {
+ let doc = arbitrary::gen::<Doc>(1);
+ let pattern = pattern(qualified_pattern!("refs/heads/main"));
+
+ assert!(matches!(
+ Rule::new(Allowed::Delegates, 256).validate(&mut || resolve_from_doc(&doc)),
+ Err(ValidationError::Threshold(_))
+ ));
+
+ let threshold = doc.delegates().len().saturating_add(1);
+ assert!(matches!(
+ Rule::new(Allowed::Delegates, threshold).validate(&mut || resolve_from_doc(&doc)),
+ Err(ValidationError::Threshold(_))
+ ));
+
+ let delegates = NonEmpty::from_vec(arbitrary::vec::<Did>(256)).unwrap();
+ assert!(matches!(
+ Rule::new(delegates.into(), 1).validate(&mut || resolve_from_doc(&doc)),
+ Err(ValidationError::Delegates(_))
+ ));
+
+ let delegates = nonempty![
+ did("did:key:z6MknLWe8A7UJxvTfY36JcB8XrP1KTLb5HFTX38hEmdY3b56"),
+ did("did:key:z6MknLWe8A7UJxvTfY36JcB8XrP1KTLb5HFTX38hEmdY3b56")
+ ];
+ let expected = Rule {
+ allow: ResolvedDelegates::Set(
+ doc::Delegates::new(nonempty![did(
+ "did:key:z6MknLWe8A7UJxvTfY36JcB8XrP1KTLb5HFTX38hEmdY3b56"
+ )])
+ .unwrap(),
+ ),
+ threshold: doc::Threshold::MIN,
+ extensions: json::Map::new(),
+ };
+ assert_eq!(
+ Rule::new(delegates.into(), 1)
+ .validate(&mut || resolve_from_doc(&doc))
+ .unwrap(),
+ expected,
+ );
+
+ // Duplicate rules are overwritten
+ let rules = vec![
+ (pattern.clone(), Rule::new(Allowed::Delegates, 1)),
+ (
+ pattern.clone(),
+ Rule::new(doc.delegates().as_ref().clone().into(), 1),
+ ),
+ ];
+ let expected = [(
+ pattern,
+ Rule::new(
+ ResolvedDelegates::Set(doc.delegates().clone()),
+ doc::Threshold::MIN,
+ ),
+ )]
+ .into_iter()
+ .collect::<Rules>();
+ assert_eq!(
+ Rules::from_raw(rules, &mut || resolve_from_doc(&doc)).unwrap(),
+ expected
+ );
+ }
+
+ #[test]
+ fn test_canonical() {
+ let tempdir = tempfile::tempdir().unwrap();
+ let storage = Storage::open(tempdir.path().join("storage"), fixtures::user()).unwrap();
+
+ transport::local::register(storage.clone());
+
+ let delegate = Device::mock_from_seed([0xff; 32]);
+ let contributor = MockSigner::from_seed([0xfe; 32]);
+ let (repo, head) = fixtures::repository(tempdir.path().join("working"));
+ let (rid, doc, _) = rad::init(
+ &repo,
+ "heartwood".try_into().unwrap(),
+ "Radicle Heartwood Protocol & Stack",
+ git::refname!("master"),
+ Visibility::default(),
+ &delegate,
+ &storage,
+ )
+ .unwrap();
+
+ let mut doc = doc.edit();
+ // Ensure there is a second delegate for testing overlapping rules
+ doc.delegate(contributor.public_key().into());
+
+ // Create tags and keep track of their OIDs
+ //
+ // follows the `refs/tags/release/candidates/*` rule
+ let failing_tag = git::refname!("release/candidates/v1.0");
+ let tags = [
+ // follows the `refs/tags/*` rule
+ git::refname!("v1.0"),
+ // follows the `refs/tags/release/*` rule
+ git::refname!("release/v1.0"),
+ failing_tag.clone(),
+ // follows the `refs/tags/*` rule
+ git::refname!("qa/v1.0"),
+ ]
+ .into_iter()
+ .map(|name| {
+ (
+ git::lit::refs_tags(name.clone()).into(),
+ tag(name, head, &repo),
+ )
+ })
+ .collect::<BTreeMap<Qualified, _>>();
+
+ git::push(
+ &repo,
+ &rad::REMOTE_NAME,
+ [
+ (
+ &git::qualified!("refs/tags/v1.0"),
+ &git::qualified!("refs/tags/v1.0"),
+ ),
+ (
+ &git::qualified!("refs/tags/release/v1.0"),
+ &git::qualified!("refs/tags/release/v1.0"),
+ ),
+ (
+ &git::qualified!("refs/tags/release/candidates/v1.0"),
+ &git::qualified!("refs/tags/release/candidates/v1.0"),
+ ),
+ (
+ &git::qualified!("refs/tags/qa/v1.0"),
+ &git::qualified!("refs/tags/qa/v1.0"),
+ ),
+ ],
+ )
+ .unwrap();
+
+ let rules = Rules::from_raw(
+ [
+ (
+ pattern(qualified_pattern!("refs/tags/*")),
+ Rule::new(Allowed::Delegates, 1),
+ ),
+ (
+ pattern(qualified_pattern!("refs/tags/release/*")),
+ Rule::new(Allowed::Delegates, 1),
+ ),
+ // Ensure that none of the other rules apply by ensuring we need
+ // both delegates to get the quorum of the
+ // `refs/tags/release/candidates/v1.0` reference
+ (
+ pattern(qualified_pattern!("refs/tags/release/candidates/*")),
+ Rule::new(Allowed::Delegates, 2),
+ ),
+ ],
+ &mut || resolve_from_doc(&doc.clone().verified().unwrap()),
+ )
+ .unwrap();
+
+ // All tags should succeed at getting their canonical commit other than the
+ // candidates tag.
+ let stored = storage.repository(rid).unwrap();
+ let failing = git::Qualified::from(git::lit::refs_tags(failing_tag));
+ for (refname, oid) in tags.iter() {
+ let matched = rules.matches(refname.clone()).unwrap_or_else(|| {
+ panic!("there should be a matching rule for {refname}, rules: {rules:#?}")
+ });
+ let canonical = matched.canonical(&stored).unwrap();
+ if *refname == failing {
+ assert!(canonical.quorum(&repo).is_err());
+ } else {
+ assert_eq!(
+ canonical
+ .quorum(&repo)
+ .unwrap_or_else(|e| panic!("quorum error for {refname}: {e}")),
+ *oid,
+ )
+ }
+ }
+ }
+
+ #[test]
+ fn test_special_branches() {
+ assert!(Pattern::try_from((*IDENTITY_BRANCH).clone()).is_err());
+ assert!(Pattern::try_from((*SIGREFS_BRANCH).clone()).is_err());
+ assert!(Pattern::try_from((*IDENTITY_ROOT).clone()).is_err());
+ }
+}
diff --git a/crates/radicle/src/identity/doc.rs b/crates/radicle/src/identity/doc.rs
index a3b072745..f9da46d6e 100644
--- a/crates/radicle/src/identity/doc.rs
+++ b/crates/radicle/src/identity/doc.rs
@@ -477,6 +477,12 @@ impl AsRef<NonEmpty<Did>> for Delegates {
}
}
+impl From<Did> for Delegates {
+ fn from(did: Did) -> Self {
+ Self(NonEmpty::new(did))
+ }
+}
+
impl TryFrom<Vec<Did>> for Delegates {
type Error = DelegatesError;
Exit code: 0
shell: 'cargo --version rustc --version cargo fmt --check cargo clippy --all-targets --workspace -- --deny warnings cargo build --all-targets --workspace cargo doc --workspace --no-deps cargo test --workspace --no-fail-fast '
Commands:
$ podman run --name 500dc881-7831-42c0-b3ab-36f51233656f -v /opt/radcis/ci.rad.levitte.org/cci/state/500dc881-7831-42c0-b3ab-36f51233656f/s:/500dc881-7831-42c0-b3ab-36f51233656f/s:ro -v /opt/radcis/ci.rad.levitte.org/cci/state/500dc881-7831-42c0-b3ab-36f51233656f/w:/500dc881-7831-42c0-b3ab-36f51233656f/w -w /500dc881-7831-42c0-b3ab-36f51233656f/w -v /opt/radcis/ci.rad.levitte.org/.radicle:/${id}/.radicle:ro -e RAD_HOME=/${id}/.radicle rust:trixie bash /500dc881-7831-42c0-b3ab-36f51233656f/s/script.sh
+ cargo --version
info: syncing channel updates for '1.85-x86_64-unknown-linux-gnu'
info: latest update on 2025-03-18, rust version 1.85.1 (4eb161250 2025-03-15)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-src'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-src'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
cargo 1.85.1 (d73d2caf9 2024-12-31)
+ rustc --version
rustc 1.85.1 (4eb161250 2025-03-15)
+ cargo fmt --check
+ cargo clippy --all-targets --workspace -- --deny warnings
Updating crates.io index
Downloading crates ...
Downloaded cypheraddr v0.4.0
Downloaded ppv-lite86 v0.2.17
Downloaded gix-commitgraph v0.25.1
Downloaded poly1305 v0.8.0
Downloaded pkg-config v0.3.30
Downloaded sec1 v0.7.3
Downloaded siphasher v0.3.11
Downloaded diff v0.1.13
Downloaded regex-syntax v0.8.5
Downloaded tree-sitter-language v0.1.2
Downloaded tree-sitter-json v0.24.8
Downloaded thiserror-impl v1.0.69
Downloaded termion v2.0.3
Downloaded xattr v1.3.1
Downloaded gix-trace v0.1.12
Downloaded thiserror-impl v2.0.12
Downloaded nonempty v0.9.0
Downloaded yansi v0.5.1
Downloaded writeable v0.5.5
Downloaded sha2 v0.10.8
Downloaded gix-validate v0.9.4
Downloaded smallvec v1.13.2
Downloaded gix-traverse v0.43.1
Downloaded filetime v0.2.23
Downloaded utf16_iter v1.0.5
Downloaded itoa v1.0.11
Downloaded gix-sec v0.10.12
Downloaded home v0.5.9
Downloaded unicode-width v0.1.11
Downloaded io-reactor v0.5.2
Downloaded unicode-ident v1.0.12
Downloaded zerofrom v0.1.6
Downloaded gix-hash v0.15.1
Downloaded gix-fs v0.12.1
Downloaded num-rational v0.4.2
Downloaded gix-quote v0.4.15
Downloaded percent-encoding v2.3.1
Downloaded num-cmp v0.1.0
Downloaded gix-revwalk v0.17.0
Downloaded gix-packetline v0.18.4
Downloaded digest v0.10.7
Downloaded maybe-async v0.2.10
Downloaded lock_api v0.4.11
Downloaded gix-protocol v0.47.0
Downloaded icu_locid_transform v1.5.0
Downloaded gix-hashtable v0.6.0
Downloaded winnow v0.6.26
Downloaded icu_locid v1.5.0
Downloaded icu_collections v1.5.0
Downloaded litemap v0.7.5
Downloaded libm v0.2.8
Downloaded icu_locid_transform_data v1.5.1
Downloaded p521 v0.13.3
Downloaded icu_normalizer_data v1.5.1
Downloaded fancy-regex v0.14.0
Downloaded vcpkg v0.2.15
Downloaded tree-sitter-rust v0.23.2
Downloaded cc v1.2.2
Downloaded zerovec v0.10.4
Downloaded cyphernet v0.5.2
Downloaded aes-gcm v0.10.3
Downloaded git2 v0.19.0
Downloaded chrono v0.4.38
Downloaded icu_properties_data v1.5.1
Downloaded tree-sitter-bash v0.23.3
Downloaded regex-automata v0.4.9
Downloaded aho-corasick v1.1.3
Downloaded aes v0.8.4
Downloaded bloomy v1.2.0
Downloaded tree-sitter-ruby v0.23.1
Downloaded bstr v1.9.1
Downloaded p384 v0.13.0
Downloaded tree-sitter-md v0.3.2
Downloaded emojis v0.6.4
Downloaded crypto-bigint v0.5.5
Downloaded base64 v0.21.7
Downloaded icu_normalizer v1.5.0
Downloaded log v0.4.21
Downloaded jiff v0.2.1
Downloaded syn v1.0.109
Downloaded tree-sitter-typescript v0.23.2
Downloaded der v0.7.9
Downloaded crossbeam-channel v0.5.15
Downloaded base64 v0.22.1
Downloaded num-bigint-dig v0.8.4
Downloaded sha3 v0.10.8
Downloaded jsonschema v0.30.0
Downloaded zerocopy v0.7.35
Downloaded hashbrown v0.14.3
Downloaded icu_properties v1.5.1
Downloaded num-traits v0.2.19
Downloaded libc v0.2.155
Downloaded tree-sitter-c v0.23.2
Downloaded syn v2.0.89
Downloaded flate2 v1.1.1
Downloaded chacha20poly1305 v0.10.1
Downloaded arc-swap v1.7.1
Downloaded idna v1.0.3
Downloaded ctr v0.9.2
Downloaded base64 v0.13.1
Downloaded anyhow v1.0.82
Downloaded memchr v2.7.2
Downloaded gix-pack v0.56.0
Downloaded parking_lot v0.12.3
Downloaded getrandom v0.2.15
Downloaded fluent-uri v0.3.2
Downloaded ff v0.13.0
Downloaded elliptic-curve v0.13.8
Downloaded amplify_derive v4.0.0
Downloaded ahash v0.8.11
Downloaded miniz_oxide v0.8.8
Downloaded unicode-normalization v0.1.23
Downloaded pkcs1 v0.7.5
Downloaded email_address v0.2.9
Downloaded crc32fast v1.4.0
Downloaded const-oid v0.9.6
Downloaded bytesize v2.0.1
Downloaded bitflags v2.5.0
Downloaded ascii v1.1.0
Downloaded tree-sitter v0.24.4
Downloaded jobserver v0.1.31
Downloaded zerovec-derive v0.10.3
Downloaded inquire v0.7.5
Downloaded unicode-segmentation v1.11.0
Downloaded phf v0.11.3
Downloaded pem-rfc7468 v0.7.0
Downloaded netservices v0.8.0
Downloaded lexopt v0.3.0
Downloaded gix-shallow v0.1.0
Downloaded serde_json v1.0.140
Downloaded gix-revision v0.31.1
Downloaded gix-lock v15.0.1
Downloaded num-complex v0.4.6
Downloaded localtime v1.3.1
Downloaded gix-ref v0.49.1
Downloaded linux-raw-sys v0.4.13
Downloaded gix-odb v0.66.0
Downloaded p256 v0.13.2
Downloaded indexmap v2.2.6
Downloaded vsimd v0.8.0
Downloaded tree-sitter-python v0.23.4
Downloaded libgit2-sys v0.17.0+1.8.1
Downloaded rustix v0.38.34
Downloaded crossbeam-utils v0.8.19
Downloaded uuid v1.16.0
Downloaded pkcs8 v0.10.2
Downloaded anstyle-parse v0.2.3
Downloaded memmap2 v0.9.4
Downloaded gix-prompt v0.9.1
Downloaded radicle-surf v0.22.0
Downloaded git-ref-format-core v0.3.1
Downloaded ecdsa v0.16.9
Downloaded amplify_num v0.5.2
Downloaded gix-refspec v0.27.0
Downloaded gix-path v0.10.15
Downloaded gix-object v0.46.1
Downloaded zeroize v1.7.0
Downloaded gix-actor v0.33.2
Downloaded ed25519 v1.5.3
Downloaded data-encoding v2.5.0
Downloaded cipher v0.4.4
Downloaded chacha20 v0.9.1
Downloaded cbc v0.1.2
Downloaded byteorder v1.5.0
Downloaded anstream v0.6.13
Downloaded block-padding v0.3.3
Downloaded base64ct v1.6.0
Downloaded gix-negotiate v0.17.0
Downloaded once_cell v1.21.3
Downloaded hmac v0.12.1
Downloaded num-bigint v0.4.6
Downloaded displaydoc v0.2.5
Downloaded url v2.5.4
Downloaded normalize-line-endings v0.3.0
Downloaded multibase v0.9.1
Downloaded num-integer v0.1.46
Downloaded pbkdf2 v0.12.2
Downloaded keccak v0.1.5
Downloaded lazy_static v1.5.0
Downloaded sqlite3-src v0.5.1
Downloaded fraction v0.15.3
Downloaded zerofrom-derive v0.1.6
Downloaded uuid-simd v0.8.0
Downloaded gix-diff v0.49.0
Downloaded icu_provider v1.5.0
Downloaded escargot v0.5.10
Downloaded colored v2.1.0
Downloaded bit-vec v0.8.0
Downloaded amplify_syn v2.0.1
Downloaded yoke-derive v0.7.5
Downloaded utf8parse v0.2.1
Downloaded outref v0.5.2
Downloaded opaque-debug v0.3.1
Downloaded num-iter v0.1.45
Downloaded iana-time-zone v0.1.60
Downloaded group v0.13.0
Downloaded gix-features v0.39.1
Downloaded version_check v0.9.4
Downloaded gix-command v0.4.1
Downloaded crypto-common v0.1.6
Downloaded blowfish v0.9.1
Downloaded phf_shared v0.11.3
Downloaded numtoa v0.1.0
Downloaded tree-sitter-go v0.23.4
Downloaded ssh-key v0.6.6
Downloaded adler2 v2.0.0
Downloaded gix-date v0.9.4
Downloaded idna_adapter v1.2.0
Downloaded data-encoding-macro v0.1.14
Downloaded cpufeatures v0.2.12
Downloaded bcrypt-pbkdf v0.10.0
Downloaded inout v0.1.3
Downloaded icu_provider_macros v1.5.0
Downloaded utf8_iter v1.0.4
Downloaded unicode-display-width v0.3.0
Downloaded newline-converter v0.3.0
Downloaded socket2 v0.5.7
Downloaded prodash v29.0.2
Downloaded proc-macro2 v1.0.92
Downloaded gix-config-value v0.14.12
Downloaded block-buffer v0.10.4
Downloaded anstyle-query v1.0.2
Downloaded universal-hash v0.5.1
Downloaded gix-transport v0.44.0
Downloaded typenum v1.17.0
Downloaded tinyvec v1.6.0
Downloaded similar v2.5.0
Downloaded dyn-clone v1.0.17
Downloaded anstyle v1.0.6
Downloaded borrow-or-share v0.2.2
Downloaded gix-tempfile v15.0.0
Downloaded yoke v0.7.5
Downloaded walkdir v2.5.0
Downloaded snapbox v0.4.17
Downloaded gix-chunk v0.4.11
Downloaded generic-array v0.14.7
Downloaded cfg-if v1.0.0
Downloaded referencing v0.30.0
Downloaded fast-glob v0.3.3
Downloaded parking_lot_core v0.9.9
Downloaded timeago v0.4.2
Downloaded nonempty v0.5.0
Downloaded noise-framework v0.4.0
Downloaded gix-utils v0.1.14
Downloaded gix-url v0.28.2
Downloaded write16 v1.0.0
Downloaded sqlite3-sys v0.15.2
Downloaded base16ct v0.2.0
Downloaded synstructure v0.13.1
Downloaded spin v0.9.8
Downloaded shlex v1.3.0
Downloaded faster-hex v0.9.0
Downloaded sqlite v0.32.0
Downloaded shell-words v1.1.0
Downloaded ref-cast-impl v1.0.24
Downloaded radicle-std-ext v0.1.0
Downloaded qcheck v1.0.0
Downloaded num v0.4.3
Downloaded tree-sitter-toml-ng v0.6.0
Downloaded libz-sys v1.1.16
Downloaded tree-sitter-html v0.23.2
Downloaded tree-sitter-highlight v0.24.4
Downloaded thiserror v1.0.69
Downloaded ssh-cipher v0.2.0
Downloaded snapbox-macros v0.3.8
Downloaded siphasher v1.0.1
Downloaded signature v2.2.0
Downloaded ref-cast v1.0.24
Downloaded rand_chacha v0.3.1
Downloaded proc-macro-error-attr v1.0.4
Downloaded proc-macro-error v1.0.4
Downloaded tempfile v3.10.1
Downloaded spki v0.7.3
Downloaded signature v1.6.4
Downloaded signals_receipts v0.2.0
Downloaded sem_safe v0.2.0
Downloaded rand_core v0.6.4
Downloaded bytecount v0.6.8
Downloaded subtle v2.5.0
Downloaded stable_deref_trait v1.2.0
Downloaded git-ref-format v0.3.1
Downloaded ghash v0.5.1
Downloaded tinyvec_macros v0.1.1
Downloaded ssh-encoding v0.2.0
Downloaded socks5-client v0.4.1
Downloaded sha1_smol v1.0.0
Downloaded serde_derive v1.0.219
Downloaded scrypt v0.11.0
Downloaded same-file v1.0.6
Downloaded radicle-git-ext v0.8.1
Downloaded quote v1.0.36
Downloaded git-ref-format-macro v0.3.1
Downloaded base-x v0.2.11
Downloaded tree-sitter-css v0.23.1
Downloaded tinystr v0.7.6
Downloaded thiserror v2.0.12
Downloaded termion v3.0.0
Downloaded tar v0.4.40
Downloaded streaming-iterator v0.1.9
Downloaded schemars_derive v1.0.0-alpha.17
Downloaded regex v1.11.1
Downloaded form_urlencoded v1.2.1
Downloaded equivalent v1.0.1
Downloaded ec25519 v0.1.0
Downloaded data-encoding-macro-internal v0.1.12
Downloaded ct-codecs v1.1.1
Downloaded rand v0.8.5
Downloaded qcheck-macros v1.0.0
Downloaded fastrand v2.1.0
Downloaded cyphergraphy v0.3.0
Downloaded base32 v0.4.0
Downloaded aead v0.5.2
Downloaded serde_derive_internals v0.29.1
Downloaded serde v1.0.219
Downloaded schemars v1.0.0-alpha.17
Downloaded pretty_assertions v1.4.0
Downloaded polyval v0.6.2
Downloaded gix-credentials v0.26.0
Downloaded autocfg v1.2.0
Downloaded scopeguard v1.2.0
Downloaded salsa20 v0.10.2
Downloaded ryu v1.0.17
Downloaded rsa v0.9.6
Downloaded rfc6979 v0.4.0
Downloaded primeorder v0.13.6
Downloaded fxhash v0.2.1
Downloaded colorchoice v1.0.0
Downloaded errno v0.3.9
Downloaded bit-set v0.8.0
Downloaded amplify v4.6.0
Downloaded either v1.11.0
Downloaded popol v3.0.0
Compiling libc v0.2.155
Compiling proc-macro2 v1.0.92
Compiling unicode-ident v1.0.12
Checking cfg-if v1.0.0
Compiling shlex v1.3.0
Compiling version_check v0.9.4
Checking memchr v2.7.2
Compiling serde v1.0.219
Compiling quote v1.0.36
Compiling syn v2.0.89
Checking getrandom v0.2.15
Checking aho-corasick v1.1.3
Checking regex-syntax v0.8.5
Compiling jobserver v0.1.31
Compiling typenum v1.17.0
Compiling cc v1.2.2
Compiling generic-array v0.14.7
Checking smallvec v1.13.2
Compiling autocfg v1.2.0
Checking regex-automata v0.4.9
Checking rand_core v0.6.4
Checking log v0.4.21
Checking fastrand v2.1.0
Checking crypto-common v0.1.6
Checking stable_deref_trait v1.2.0
Checking bitflags v2.5.0
Checking subtle v2.5.0
Compiling syn v1.0.109
Compiling synstructure v0.13.1
Checking zeroize v1.7.0
Checking once_cell v1.21.3
Checking cpufeatures v0.2.12
Checking tinyvec_macros v0.1.1
Checking tinyvec v1.6.0
Compiling serde_derive v1.0.219
Checking bstr v1.9.1
Compiling zerofrom-derive v0.1.6
Compiling yoke-derive v0.7.5
Compiling zerovec-derive v0.10.3
Checking zerofrom v0.1.6
Checking yoke v0.7.5
Compiling displaydoc v0.2.5
Checking writeable v0.5.5
Checking litemap v0.7.5
Compiling icu_locid_transform_data v1.5.1
Checking zerovec v0.10.4
Checking unicode-normalization v0.1.23
Compiling icu_provider_macros v1.5.0
Checking block-padding v0.3.3
Compiling icu_properties_data v1.5.1
Checking tinystr v0.7.6
Checking inout v0.1.3
Checking icu_locid v1.5.0
Checking block-buffer v0.10.4
Compiling icu_normalizer_data v1.5.1
Compiling crc32fast v1.4.0
Checking icu_provider v1.5.0
Compiling pkg-config v0.3.30
Checking digest v0.10.7
Checking icu_locid_transform v1.5.0
Checking cipher v0.4.4
Checking icu_collections v1.5.0
Checking write16 v1.0.0
Compiling thiserror v1.0.69
Checking itoa v1.0.11
Checking icu_properties v1.5.1
Checking utf8_iter v1.0.4
Checking utf16_iter v1.0.5
Checking hashbrown v0.14.3
Compiling thiserror-impl v1.0.69
Checking percent-encoding v2.3.1
Compiling rustix v0.38.34
Checking sha2 v0.10.8
Checking linux-raw-sys v0.4.13
Checking form_urlencoded v1.2.1
Checking universal-hash v0.5.1
Compiling vcpkg v0.2.15
Checking opaque-debug v0.3.1
Checking icu_normalizer v1.5.0
Compiling amplify_syn v2.0.1
Compiling libz-sys v1.1.16
Checking idna_adapter v1.2.0
Checking idna v1.0.3
Compiling data-encoding v2.5.0
Checking url v2.5.4
Checking byteorder v1.5.0
Compiling amplify_derive v4.0.0
Compiling data-encoding-macro-internal v0.1.12
Checking amplify_num v0.5.2
Checking ascii v1.1.0
Checking signature v1.6.4
Checking data-encoding-macro v0.1.14
Checking ed25519 v1.5.3
Checking tempfile v3.10.1
Compiling libgit2-sys v0.17.0+1.8.1
Checking aead v0.5.2
Compiling num-traits v0.2.19
Compiling proc-macro-error-attr v1.0.4
Checking ct-codecs v1.1.1
Checking base-x v0.2.11
Checking multibase v0.9.1
Checking ec25519 v0.1.0
Checking poly1305 v0.8.0
Checking chacha20 v0.9.1
Compiling proc-macro-error v1.0.4
Checking amplify v4.6.0
Checking cyphergraphy v0.3.0
Checking keccak v0.1.5
Checking sha3 v0.10.8
Compiling git-ref-format-core v0.3.1
Checking polyval v0.6.2
Compiling sqlite3-src v0.5.1
Checking hmac v0.12.1
Checking base32 v0.4.0
Checking base64ct v1.6.0
Checking ppv-lite86 v0.2.17
Checking pem-rfc7468 v0.7.0
Checking rand_chacha v0.3.1
Checking cypheraddr v0.4.0
Compiling git-ref-format-macro v0.3.1
Checking pbkdf2 v0.12.2
Checking ghash v0.5.1
Checking chacha20poly1305 v0.10.1
Checking aes v0.8.4
Checking ctr v0.9.2
Compiling crossbeam-utils v0.8.19
Checking aes-gcm v0.10.3
Checking git-ref-format v0.3.1
Checking noise-framework v0.4.0
Checking socks5-client v0.4.1
Checking rand v0.8.5
Checking ssh-encoding v0.2.0
Checking blowfish v0.9.1
Checking cbc v0.1.2
Compiling thiserror v2.0.12
Checking equivalent v1.0.1
Compiling serde_json v1.0.140
Checking radicle-std-ext v0.1.0
Checking indexmap v2.2.6
Checking ssh-cipher v0.2.0
Checking bcrypt-pbkdf v0.10.0
Checking cyphernet v0.5.2
Compiling thiserror-impl v2.0.12
Checking ryu v1.0.17
Checking signature v2.2.0
Checking ssh-key v0.6.6
Checking crossbeam-channel v0.5.15
Checking qcheck v1.0.0
Checking radicle-ssh v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-ssh)
Compiling ref-cast v1.0.24
Compiling ref-cast-impl v1.0.24
Checking lazy_static v1.5.0
Checking dyn-clone v1.0.17
Compiling lock_api v0.4.11
Compiling parking_lot_core v0.9.9
Checking siphasher v1.0.1
Checking nonempty v0.9.0
Compiling serde_derive_internals v0.29.1
Checking radicle-dag v0.10.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-dag)
Checking tree-sitter-language v0.1.2
Checking scopeguard v1.2.0
Compiling schemars_derive v1.0.0-alpha.17
Checking iana-time-zone v0.1.60
Checking chrono v0.4.38
Checking parking_lot v0.12.3
Checking colored v2.1.0
Checking schemars v1.0.0-alpha.17
Checking bytesize v2.0.1
Checking localtime v1.3.1
Compiling anyhow v1.0.82
Checking fast-glob v0.3.3
Checking base64 v0.21.7
Checking gix-trace v0.1.12
Checking anstyle-query v1.0.2
Checking faster-hex v0.9.0
Checking errno v0.3.9
Checking sem_safe v0.2.0
Checking gix-utils v0.1.14
Checking signals_receipts v0.2.0
Checking adler2 v2.0.0
Checking gix-hash v0.15.1
Checking miniz_oxide v0.8.8
Checking same-file v1.0.6
Checking walkdir v2.5.0
Checking flate2 v1.1.1
Checking radicle-signals v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-signals)
Checking prodash v29.0.2
Compiling tree-sitter v0.24.4
Checking sha1_smol v1.0.0
Checking gix-features v0.39.1
Checking regex v1.11.1
Checking numtoa v0.1.0
Checking unicode-segmentation v1.11.0
Compiling xattr v1.3.1
Compiling filetime v0.2.23
Checking home v0.5.9
Checking lexopt v0.3.0
Checking gix-path v0.10.15
Compiling tar v0.4.40
Checking newline-converter v0.3.0
Checking termion v2.0.3
Checking fxhash v0.2.1
Checking unicode-width v0.1.11
Checking streaming-iterator v0.1.9
Compiling radicle-surf v0.22.0
Checking inquire v0.7.5
Checking unicode-display-width v0.3.0
Checking termion v3.0.0
Compiling tree-sitter-rust v0.23.2
Compiling tree-sitter-bash v0.23.3
Compiling tree-sitter-python v0.23.4
Compiling tree-sitter-toml-ng v0.6.0
Compiling tree-sitter-c v0.23.2
Compiling tree-sitter-md v0.3.2
Compiling tree-sitter-ruby v0.23.1
Compiling tree-sitter-go v0.23.4
Compiling tree-sitter-json v0.24.8
Compiling tree-sitter-html v0.23.2
Compiling tree-sitter-typescript v0.23.2
Compiling tree-sitter-css v0.23.1
Checking sqlite3-sys v0.15.2
Checking sqlite v0.32.0
Checking nonempty v0.5.0
Compiling radicle-cli v0.13.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cli)
Checking base64 v0.13.1
Checking tree-sitter-highlight v0.24.4
Checking timeago v0.4.2
Checking jiff v0.2.1
Checking winnow v0.6.26
Checking gix-hashtable v0.6.0
Checking gix-validate v0.9.4
Checking memmap2 v0.9.4
Checking gix-chunk v0.4.11
Checking gix-commitgraph v0.25.1
Checking gix-fs v0.12.1
Checking gix-tempfile v15.0.0
Checking shell-words v1.1.0
Checking utf8parse v0.2.1
Checking anstyle-parse v0.2.3
Checking gix-command v0.4.1
Checking gix-lock v15.0.1
Checking gix-url v0.28.2
Checking gix-config-value v0.14.12
Checking gix-quote v0.4.15
Checking gix-sec v0.10.12
Checking colorchoice v1.0.0
Checking anstyle v1.0.6
Checking gix-prompt v0.9.1
Checking gix-packetline v0.18.4
Checking anstream v0.6.13
Checking gix-transport v0.44.0
Checking snapbox-macros v0.3.8
Checking gix-credentials v0.26.0
Checking gix-shallow v0.1.0
Compiling maybe-async v0.2.10
Checking arc-swap v1.7.1
Checking similar v2.5.0
Checking gix-date v0.9.4
Checking gix-actor v0.33.2
Checking gix-object v0.46.1
Checking normalize-line-endings v0.3.0
Checking snapbox v0.4.17
Checking popol v3.0.0
Checking either v1.11.0
Checking io-reactor v0.5.2
Checking salsa20 v0.10.2
Checking socket2 v0.5.7
Checking yansi v0.5.1
Checking diff v0.1.13
Checking gix-revwalk v0.17.0
Checking gix-diff v0.49.0
Checking gix-ref v0.49.1
Checking gix-revision v0.31.1
Checking gix-traverse v0.43.1
Checking gix-refspec v0.27.0
Checking gix-pack v0.56.0
Checking gix-negotiate v0.17.0
Checking siphasher v0.3.11
Checking gix-protocol v0.47.0
Compiling radicle-node v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-node)
Checking bloomy v1.2.0
Checking netservices v0.8.0
Checking pretty_assertions v1.4.0
Checking scrypt v0.11.0
Checking num-integer v0.1.46
Compiling escargot v0.5.10
Checking gix-odb v0.66.0
Checking radicle-systemd v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-systemd)
Compiling qcheck-macros v1.0.0
Checking num-bigint v0.4.6
Compiling ahash v0.8.11
Compiling radicle-remote-helper v0.10.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-remote-helper)
Checking num-iter v0.1.45
Checking num-complex v0.4.6
Checking bit-vec v0.8.0
Checking zerocopy v0.7.35
Checking borrow-or-share v0.2.2
Checking num-rational v0.4.2
Checking fluent-uri v0.3.2
Checking bit-set v0.8.0
Checking num v0.4.3
Checking phf_shared v0.11.3
Checking uuid v1.16.0
Checking vsimd v0.8.0
Checking outref v0.5.2
Checking phf v0.11.3
Checking referencing v0.30.0
Checking fancy-regex v0.14.0
Checking uuid-simd v0.8.0
Checking fraction v0.15.3
Checking email_address v0.2.9
Checking bytecount v0.6.8
Checking base64 v0.22.1
Checking num-cmp v0.1.0
Checking emojis v0.6.4
Checking jsonschema v0.30.0
Checking git2 v0.19.0
Checking radicle-git-ext v0.8.1
Checking radicle-term v0.12.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-term)
Checking radicle-crypto v0.12.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-crypto)
Checking radicle-cob v0.14.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cob)
Checking radicle-crdt v0.1.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-crdt)
Checking radicle v0.15.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle)
Checking radicle-fetch v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-fetch)
Checking radicle-cli-test v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cli-test)
Checking radicle-schemars v0.1.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-schemars)
Checking radicle-tools v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-tools)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 47.03s
+ cargo build --all-targets --workspace
Compiling cfg-if v1.0.0
Compiling libc v0.2.155
Compiling shlex v1.3.0
Compiling memchr v2.7.2
Compiling serde v1.0.219
Compiling regex-syntax v0.8.5
Compiling jobserver v0.1.31
Compiling getrandom v0.2.15
Compiling cc v1.2.2
Compiling aho-corasick v1.1.3
Compiling regex-automata v0.4.9
Compiling smallvec v1.13.2
Compiling typenum v1.17.0
Compiling generic-array v0.14.7
Compiling rand_core v0.6.4
Compiling fastrand v2.1.0
Compiling crypto-common v0.1.6
Compiling log v0.4.21
Compiling bitflags v2.5.0
Compiling zerofrom v0.1.6
Compiling stable_deref_trait v1.2.0
Compiling subtle v2.5.0
Compiling yoke v0.7.5
Compiling zeroize v1.7.0
Compiling zerovec v0.10.4
Compiling once_cell v1.21.3
Compiling tinyvec_macros v0.1.1
Compiling cpufeatures v0.2.12
Compiling tinyvec v1.6.0
Compiling litemap v0.7.5
Compiling writeable v0.5.5
Compiling block-padding v0.3.3
Compiling tinystr v0.7.6
Compiling unicode-normalization v0.1.23
Compiling inout v0.1.3
Compiling icu_locid v1.5.0
Compiling bstr v1.9.1
Compiling icu_provider v1.5.0
Compiling icu_locid_transform_data v1.5.1
Compiling block-buffer v0.10.4
Compiling icu_locid_transform v1.5.0
Compiling digest v0.10.7
Compiling cipher v0.4.4
Compiling icu_properties_data v1.5.1
Compiling icu_collections v1.5.0
Compiling icu_normalizer_data v1.5.1
Compiling utf8_iter v1.0.4
Compiling itoa v1.0.11
Compiling icu_properties v1.5.1
Compiling adler2 v2.0.0
Compiling write16 v1.0.0
Compiling hashbrown v0.14.3
Compiling utf16_iter v1.0.5
Compiling miniz_oxide v0.8.8
Compiling crc32fast v1.4.0
Compiling percent-encoding v2.3.1
Compiling thiserror v1.0.69
Compiling sha2 v0.10.8
Compiling linux-raw-sys v0.4.13
Compiling icu_normalizer v1.5.0
Compiling form_urlencoded v1.2.1
Compiling rustix v0.38.34
Compiling universal-hash v0.5.1
Compiling idna_adapter v1.2.0
Compiling opaque-debug v0.3.1
Compiling idna v1.0.3
Compiling libz-sys v1.1.16
Compiling url v2.5.4
Compiling byteorder v1.5.0
Compiling data-encoding v2.5.0
Compiling ascii v1.1.0
Compiling signature v1.6.4
Compiling amplify_num v0.5.2
Compiling tempfile v3.10.1
Compiling ed25519 v1.5.3
Compiling data-encoding-macro v0.1.14
Compiling libgit2-sys v0.17.0+1.8.1
Compiling aead v0.5.2
Compiling base-x v0.2.11
Compiling ct-codecs v1.1.1
Compiling ec25519 v0.1.0
Compiling multibase v0.9.1
Compiling amplify v4.6.0
Compiling poly1305 v0.8.0
Compiling chacha20 v0.9.1
Compiling num-traits v0.2.19
Compiling cyphergraphy v0.3.0
Compiling keccak v0.1.5
Compiling sha3 v0.10.8
Compiling polyval v0.6.2
Compiling git-ref-format-core v0.3.1
Compiling hmac v0.12.1
Compiling sqlite3-src v0.5.1
Compiling ppv-lite86 v0.2.17
Compiling base64ct v1.6.0
Compiling base32 v0.4.0
Compiling cypheraddr v0.4.0
Compiling rand_chacha v0.3.1
Compiling pem-rfc7468 v0.7.0
Compiling git-ref-format-macro v0.3.1
Compiling pbkdf2 v0.12.2
Compiling ghash v0.5.1
Compiling chacha20poly1305 v0.10.1
Compiling aes v0.8.4
Compiling ctr v0.9.2
Compiling git-ref-format v0.3.1
Compiling noise-framework v0.4.0
Compiling aes-gcm v0.10.3
Compiling ssh-encoding v0.2.0
Compiling rand v0.8.5
Compiling socks5-client v0.4.1
Compiling blowfish v0.9.1
Compiling cbc v0.1.2
Compiling equivalent v1.0.1
Compiling radicle-std-ext v0.1.0
Compiling indexmap v2.2.6
Compiling ssh-cipher v0.2.0
Compiling bcrypt-pbkdf v0.10.0
Compiling cyphernet v0.5.2
Compiling crossbeam-utils v0.8.19
Compiling signature v2.2.0
Compiling ryu v1.0.17
Compiling crossbeam-channel v0.5.15
Compiling serde_json v1.0.140
Compiling ssh-key v0.6.6
Compiling thiserror v2.0.12
Compiling qcheck v1.0.0
Compiling radicle-ssh v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-ssh)
Compiling ref-cast v1.0.24
Compiling dyn-clone v1.0.17
Compiling lazy_static v1.5.0
Compiling siphasher v1.0.1
Compiling radicle-dag v0.10.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-dag)
Compiling nonempty v0.9.0
Compiling scopeguard v1.2.0
Compiling tree-sitter-language v0.1.2
Compiling lock_api v0.4.11
Compiling parking_lot_core v0.9.9
Compiling iana-time-zone v0.1.60
Compiling chrono v0.4.38
Compiling parking_lot v0.12.3
Compiling schemars v1.0.0-alpha.17
Compiling colored v2.1.0
Compiling bytesize v2.0.1
Compiling localtime v1.3.1
Compiling base64 v0.21.7
Compiling fast-glob v0.3.3
Compiling gix-trace v0.1.12
Compiling anstyle-query v1.0.2
Compiling anyhow v1.0.82
Compiling faster-hex v0.9.0
Compiling errno v0.3.9
Compiling sem_safe v0.2.0
Compiling signals_receipts v0.2.0
Compiling gix-utils v0.1.14
Compiling gix-hash v0.15.1
Compiling same-file v1.0.6
Compiling walkdir v2.5.0
Compiling radicle-signals v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-signals)
Compiling prodash v29.0.2
Compiling flate2 v1.1.1
Compiling tree-sitter v0.24.4
Compiling sha1_smol v1.0.0
Compiling gix-features v0.39.1
Compiling regex v1.11.1
Compiling unicode-segmentation v1.11.0
Compiling numtoa v0.1.0
Compiling xattr v1.3.1
Compiling filetime v0.2.23
Compiling lexopt v0.3.0
Compiling home v0.5.9
Compiling gix-path v0.10.15
Compiling tar v0.4.40
Compiling termion v2.0.3
Compiling newline-converter v0.3.0
Compiling fxhash v0.2.1
Compiling unicode-width v0.1.11
Compiling streaming-iterator v0.1.9
Compiling radicle-surf v0.22.0
Compiling inquire v0.7.5
Compiling termion v3.0.0
Compiling unicode-display-width v0.3.0
Compiling tree-sitter-ruby v0.23.1
Compiling tree-sitter-json v0.24.8
Compiling tree-sitter-python v0.23.4
Compiling tree-sitter-md v0.3.2
Compiling tree-sitter-css v0.23.1
Compiling tree-sitter-html v0.23.2
Compiling tree-sitter-bash v0.23.3
Compiling tree-sitter-rust v0.23.2
Compiling tree-sitter-go v0.23.4
Compiling tree-sitter-c v0.23.2
Compiling tree-sitter-toml-ng v0.6.0
Compiling tree-sitter-typescript v0.23.2
Compiling sqlite3-sys v0.15.2
Compiling sqlite v0.32.0
Compiling nonempty v0.5.0
Compiling base64 v0.13.1
Compiling radicle-cli v0.13.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cli)
Compiling tree-sitter-highlight v0.24.4
Compiling timeago v0.4.2
Compiling jiff v0.2.1
Compiling winnow v0.6.26
Compiling gix-hashtable v0.6.0
Compiling gix-validate v0.9.4
Compiling memmap2 v0.9.4
Compiling gix-chunk v0.4.11
Compiling gix-commitgraph v0.25.1
Compiling gix-fs v0.12.1
Compiling gix-tempfile v15.0.0
Compiling shell-words v1.1.0
Compiling gix-command v0.4.1
Compiling utf8parse v0.2.1
Compiling anstyle-parse v0.2.3
Compiling gix-lock v15.0.1
Compiling gix-config-value v0.14.12
Compiling gix-url v0.28.2
Compiling gix-quote v0.4.15
Compiling gix-sec v0.10.12
Compiling colorchoice v1.0.0
Compiling anstyle v1.0.6
Compiling gix-prompt v0.9.1
Compiling anstream v0.6.13
Compiling gix-packetline v0.18.4
Compiling gix-transport v0.44.0
Compiling snapbox-macros v0.3.8
Compiling gix-credentials v0.26.0
Compiling gix-date v0.9.4
Compiling gix-actor v0.33.2
Compiling gix-shallow v0.1.0
Compiling gix-object v0.46.1
Compiling similar v2.5.0
Compiling gix-revwalk v0.17.0
Compiling gix-revision v0.31.1
Compiling gix-traverse v0.43.1
Compiling gix-diff v0.49.0
Compiling gix-refspec v0.27.0
Compiling gix-negotiate v0.17.0
Compiling gix-pack v0.56.0
Compiling gix-ref v0.49.1
Compiling normalize-line-endings v0.3.0
Compiling arc-swap v1.7.1
Compiling snapbox v0.4.17
Compiling gix-odb v0.66.0
Compiling gix-protocol v0.47.0
Compiling popol v3.0.0
Compiling either v1.11.0
Compiling io-reactor v0.5.2
Compiling salsa20 v0.10.2
Compiling socket2 v0.5.7
Compiling diff v0.1.13
Compiling radicle-node v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-node)
Compiling yansi v0.5.1
Compiling siphasher v0.3.11
Compiling pretty_assertions v1.4.0
Compiling netservices v0.8.0
Compiling bloomy v1.2.0
Compiling scrypt v0.11.0
Compiling num-integer v0.1.46
Compiling radicle-systemd v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-systemd)
Compiling escargot v0.5.10
Compiling num-bigint v0.4.6
Compiling radicle-remote-helper v0.10.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-remote-helper)
Compiling num-iter v0.1.45
Compiling num-complex v0.4.6
Compiling bit-vec v0.8.0
Compiling num-rational v0.4.2
Compiling borrow-or-share v0.2.2
Compiling zerocopy v0.7.35
Compiling fluent-uri v0.3.2
Compiling ahash v0.8.11
Compiling num v0.4.3
Compiling bit-set v0.8.0
Compiling phf_shared v0.11.3
Compiling outref v0.5.2
Compiling uuid v1.16.0
Compiling vsimd v0.8.0
Compiling phf v0.11.3
Compiling referencing v0.30.0
Compiling fancy-regex v0.14.0
Compiling uuid-simd v0.8.0
Compiling fraction v0.15.3
Compiling email_address v0.2.9
Compiling bytecount v0.6.8
Compiling base64 v0.22.1
Compiling num-cmp v0.1.0
Compiling emojis v0.6.4
Compiling jsonschema v0.30.0
Compiling git2 v0.19.0
Compiling radicle-git-ext v0.8.1
Compiling radicle-term v0.12.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-term)
Compiling radicle-crypto v0.12.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-crypto)
Compiling radicle-cob v0.14.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cob)
Compiling radicle-crdt v0.1.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-crdt)
Compiling radicle v0.15.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle)
Compiling radicle-fetch v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-fetch)
Compiling radicle-cli-test v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cli-test)
Compiling radicle-tools v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-tools)
Compiling radicle-schemars v0.1.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-schemars)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 11s
+ cargo doc --workspace --no-deps
Checking regex-automata v0.4.9
Compiling syn v1.0.109
Checking idna v1.0.3
Checking radicle-ssh v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-ssh)
Compiling num-traits v0.2.19
Checking url v2.5.4
Checking git2 v0.19.0
Checking radicle-dag v0.10.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-dag)
Checking chrono v0.4.38
Checking bstr v1.9.1
Compiling amplify_syn v2.0.1
Compiling proc-macro-error v1.0.4
Checking git-ref-format-core v0.3.1
Checking gix-path v0.10.15
Checking radicle-signals v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-signals)
Checking regex v1.11.1
Checking gix-date v0.9.4
Compiling data-encoding-macro-internal v0.1.12
Compiling amplify_derive v4.0.0
Compiling git-ref-format-macro v0.3.1
Checking tree-sitter v0.24.4
Checking gix-actor v0.33.2
Checking data-encoding-macro v0.1.14
Checking multibase v0.9.1
Checking gix-validate v0.9.4
Compiling radicle-cli v0.13.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cli)
Checking tree-sitter-toml-ng v0.6.0
Checking git-ref-format v0.3.1
Checking gix-object v0.46.1
Checking radicle-git-ext v0.8.1
Checking radicle-term v0.12.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-term)
Checking radicle-surf v0.22.0
Checking tree-sitter-highlight v0.24.4
Checking gix-commitgraph v0.25.1
Checking gix-command v0.4.1
Checking gix-config-value v0.14.12
Checking gix-url v0.28.2
Checking gix-revwalk v0.17.0
Checking gix-quote v0.4.15
Checking gix-diff v0.49.0
Checking gix-prompt v0.9.1
Checking gix-traverse v0.43.1
Checking gix-revision v0.31.1
Checking gix-packetline v0.18.4
Checking gix-pack v0.56.0
Checking gix-transport v0.44.0
Checking gix-refspec v0.27.0
Checking gix-credentials v0.26.0
Checking amplify v4.6.0
Checking gix-negotiate v0.17.0
Checking gix-shallow v0.1.0
Checking gix-ref v0.49.1
Compiling radicle-node v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-node)
Checking cyphergraphy v0.3.0
Checking io-reactor v0.5.2
Checking cypheraddr v0.4.0
Checking noise-framework v0.4.0
Checking socks5-client v0.4.1
Checking gix-protocol v0.47.0
Checking radicle-systemd v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-systemd)
Documenting radicle-term v0.12.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-term)
Checking cyphernet v0.5.2
Checking radicle-crypto v0.12.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-crypto)
Checking gix-odb v0.66.0
Checking netservices v0.8.0
Checking radicle-cob v0.14.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cob)
Documenting radicle-crdt v0.1.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-crdt)
Documenting radicle-cob v0.14.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cob)
Checking radicle v0.15.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle)
Documenting radicle v0.15.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle)
Documenting radicle-crypto v0.12.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-crypto)
Documenting radicle-signals v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-signals)
Documenting radicle-ssh v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-ssh)
Documenting radicle-dag v0.10.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-dag)
Documenting radicle-systemd v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-systemd)
Documenting radicle-cli v0.13.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cli)
Checking radicle-fetch v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-fetch)
Documenting radicle-cli-test v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-cli-test)
Documenting radicle-node v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-node)
Documenting radicle-fetch v0.11.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-fetch)
Documenting radicle-schemars v0.1.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-schemars)
Documenting radicle-remote-helper v0.10.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-remote-helper)
Checking radicle-remote-helper v0.10.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-remote-helper)
Documenting radicle-tools v0.9.0 (/500dc881-7831-42c0-b3ab-36f51233656f/w/crates/radicle-tools)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 11.88s
Generated /500dc881-7831-42c0-b3ab-36f51233656f/w/target/doc/radicle/index.html and 23 other files
+ cargo test --workspace --no-fail-fast
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.16s
Running unittests src/lib.rs (target/debug/deps/radicle-b493f8f660682f64)
running 199 tests
test canonical::formatter::test::ascii_control_characters ... ok
test canonical::formatter::test::ordered_nested_object ... ok
test canonical::formatter::test::securesystemslib_asserts ... ok
test cob::cache::migrations::_2::tests::test_patch_json_deserialization ... ok
test cob::common::test::test_color ... ok
test cob::cache::tests::test_migrate_to ... ok
test cob::common::test::test_emojis ... ok
test cob::cache::tests::test_check_version ... ok
test cob::cache::migrations::_2::tests::test_migration_2 ... ok
test cob::identity::test::prop_json_eq_str ... ok
test cob::identity::test::test_identity_redact_revision ... ok
test cob::identity::test::test_identity_remove_delegate_concurrent ... ok
test cob::identity::test::test_identity_update_rejected ... ok
test cob::identity::test::test_identity_reject_concurrent ... ok
test cob::identity::test::test_identity_updates ... ok
test cob::issue::cache::tests::test_counts ... ok
test cob::issue::cache::tests::test_get ... ok
test cob::issue::cache::tests::test_is_empty ... ok
test cob::issue::cache::tests::test_list ... ok
test cob::issue::cache::tests::test_list_by_status ... ok
test cob::issue::cache::tests::test_remove ... ok
test cob::identity::test::test_valid_identity ... ok
test cob::identity::test::test_identity_updates_concurrent ... ok
test cob::issue::test::test_embeds ... ok
test cob::issue::test::test_embeds_edit ... ok
test cob::identity::test::test_identity_updates_concurrent_outdated ... ok
test cob::issue::test::test_invalid_actions ... ok
test cob::issue::test::test_invalid_tx ... ok
test cob::issue::test::test_invalid_tx_reference ... ok
test cob::issue::test::test_invalid_cob ... ok
test cob::issue::test::test_concurrency ... ok
test cob::issue::test::test_issue_all ... ok
test cob::issue::test::test_issue_comment ... ok
test cob::issue::test::test_issue_comment_redact ... ok
test cob::issue::test::test_issue_create_and_change_state ... ok
test cob::issue::test::test_issue_create_and_get ... ok
test cob::issue::test::test_issue_create_and_assign ... ok
test cob::issue::test::test_issue_create_and_unassign ... ok
test cob::issue::test::test_issue_create_and_reassign ... ok
test cob::issue::test::test_issue_edit_description ... ok
test cob::issue::test::test_issue_edit ... ok
test cob::issue::test::test_issue_label ... ok
test cob::issue::test::test_issue_state_serde ... ok
test cob::issue::test::test_ordering ... ok
test cob::issue::test::test_issue_multilines ... ok
test cob::issue::test::test_issue_react ... ok
test cob::patch::cache::tests::test_get ... ok
test cob::patch::cache::tests::test_is_empty ... ok
test cob::patch::cache::tests::test_list ... ok
test cob::issue::test::test_issue_reply ... ok
test cob::patch::cache::tests::test_counts ... ok
test cob::patch::test::test_json ... ok
test cob::patch::test::test_json_serialization ... ok
test cob::patch::cache::tests::test_remove ... ok
test cob::patch::cache::tests::test_find_by_revision ... ok
test cob::patch::test::test_patch_create_and_get ... ok
test cob::patch::test::test_patch_discussion ... ok
test cob::patch::cache::tests::test_list_by_status ... ok
test cob::patch::test::test_patch_merge ... ok
test cob::patch::test::test_patch_review ... ok
test cob::patch::test::test_patch_redact ... ok
test cob::patch::test::test_patch_review_comment ... ok
test cob::patch::test::test_patch_review_duplicate ... ok
test cob::patch::test::test_patch_review_edit ... ok
test cob::patch::test::test_patch_review_edit_comment ... ok
test cob::patch::test::test_patch_review_remove_summary ... ok
test cob::patch::test::test_reactions_json_serialization ... ok
test cob::patch::test::test_revision_reaction ... ok
test cob::patch::test::test_revision_review_merge_redacted ... ok
test cob::patch::test::test_revision_edit_redact ... ok
test cob::thread::tests::test_comment_edit_missing ... ok
test cob::thread::tests::test_comment_edit_redacted ... ok
test cob::thread::tests::test_comment_redact_missing ... ok
test cob::thread::tests::test_duplicate_comments ... ok
test cob::thread::tests::test_edit_comment ... ok
test cob::thread::tests::test_redact_comment ... ok
test cob::patch::test::test_patch_review_revision_redact ... ok
test cob::thread::tests::test_timeline ... ok
test git::canonical::rules::tests::test_deserialization ... ok
test git::canonical::rules::tests::test_deserialize_extensions ... ok
test git::canonical::rules::tests::test_order ... ok
test git::canonical::rules::tests::test_roundtrip ... ok
test git::canonical::rules::tests::test_canonical ... ok
test git::canonical::rules::tests::test_rule_validate_success ... ok
test git::canonical::rules::tests::test_special_branches ... ok
test cob::patch::test::test_patch_update ... ok
test git::canonical::tests::test_quorum_merges ... ok
test git::canonical::rules::tests::test_rule_validate_failures ... ok
test git::test::test_version_from_str ... ok
test git::test::test_version_ord ... ok
test identity::did::test::test_did_encode_decode ... ok
test identity::did::test::test_did_vectors ... ok
test identity::doc::id::test::prop_from_str ... ok
test git::canonical::tests::test_quorum ... ok
test identity::doc::test::test_canonical_doc ... ok
test identity::doc::test::test_canonical_example ... ok
test identity::doc::test::test_duplicate_dids ... ok
test identity::doc::test::test_future_version_error ... ok
test identity::doc::test::test_is_valid_version ... ok
test git::canonical::tests::test_quorum_properties ... ok
test identity::doc::test::test_not_found ... ok
test identity::doc::test::test_parse_version ... ok
test cob::thread::tests::prop_ordering ... ok
test identity::doc::test::test_visibility_json ... ok
test identity::doc::update::test::test_can_update_crefs ... ok
test identity::doc::update::test::test_cannot_include_default_branch_rule ... ok
test identity::doc::update::test::test_default_branch_rule_exists_after_verification ... ok
test identity::project::test::test_project_name ... ok
test node::address::store::test::test_alias ... ok
test node::address::store::test::test_disconnected ... ok
test node::address::store::test::test_disconnected_ban ... ok
test node::address::store::test::test_entries ... ok
test node::address::store::test::test_get_none ... ok
test identity::doc::test::test_max_delegates ... ok
test node::address::store::test::test_insert_and_get ... ok
test node::address::store::test::test_insert_and_remove ... ok
test node::address::store::test::test_insert_and_update ... ok
test node::address::store::test::test_insert_duplicate ... ok
test node::address::store::test::test_remove_nothing ... ok
test node::db::test::test_version ... ok
test node::features::test::test_operations ... ok
test node::notifications::store::test::test_branch_notifications ... ok
test node::address::store::test::test_node_aliases ... ok
test node::notifications::store::test::test_cob_notifications ... ok
test node::notifications::store::test::test_clear ... ok
test node::notifications::store::test::test_counts_by_repo ... ok
test node::notifications::store::test::test_duplicate_notifications ... ok
test node::notifications::store::test::test_notification_status ... ok
test node::policy::store::test::test_follow_and_unfollow_node ... ok
test node::policy::store::test::test_node_policies ... ok
test node::policy::store::test::test_node_aliases ... ok
test node::policy::store::test::test_node_policy ... ok
test node::policy::store::test::test_repo_policies ... ok
test node::policy::store::test::test_repo_policy ... ok
test node::policy::store::test::test_seed_and_unseed_repo ... ok
test node::policy::store::test::test_update_alias ... ok
test node::policy::store::test::test_update_scope ... ok
test node::refs::store::test::test_count ... ok
test node::refs::store::test::test_set_and_delete ... ok
test node::refs::store::test::test_set_and_get ... ok
test node::routing::test::test_count ... ok
test node::routing::test::test_entries ... ok
test node::routing::test::test_insert_and_get ... ok
test node::routing::test::test_insert_and_get_resources ... ok
test node::address::store::test::test_empty ... ok
test node::routing::test::test_insert_duplicate ... ok
test node::routing::test::test_insert_existing_updated_time ... ok
test node::routing::test::test_len ... ok
test node::routing::test::test_insert_and_remove ... ok
test node::routing::test::test_remove_many ... ok
test node::routing::test::test_update_existing_multi ... ok
test node::routing::test::test_remove_redundant ... ok
test node::sync::announce::test::announcer_reached_max_replication_target ... ok
test node::sync::announce::test::announcer_must_reach_preferred_seeds ... ok
test node::sync::announce::test::announcer_timed_out ... ok
test node::routing::test::test_prune ... ok
test node::sync::announce::test::announcer_reached_min_replication_target ... ok
test node::sync::announce::test::announcer_will_minimise_replication_factor ... ok
test node::sync::fetch::test::all_nodes_are_fetchable ... ok
test node::sync::fetch::test::all_nodes_are_candidates ... ok
test node::sync::announce::test::cannot_construct_announcer ... ok
test node::sync::fetch::test::could_not_reach_target ... ok
test node::sync::fetch::test::ignores_duplicates_and_local_node ... ok
test node::sync::fetch::test::preferred_seeds_target_returned_over_replicas ... ok
test node::sync::fetch::test::reaches_target_of_preferred_seeds ... ok
test node::sync::fetch::test::reaches_target_of_max_replicas ... ok
test node::sync::test::replicas_constrain_to ... ok
test node::test::test_alias ... ok
test node::test::test_command_result ... ok
test node::test::test_user_agent ... ok
test node::timestamp::tests::test_timestamp_max ... ok
test node::sync::test::ensure_replicas_construction ... ok
test node::sync::fetch::test::reaches_target_of_replicas ... ok
test profile::test::test_config ... ok
test profile::test::canonicalize_home ... ok
test rad::tests::test_checkout ... ok
test rad::tests::test_fork ... ok
test serde_ext::test::test_localtime ... ok
test serde_ext::test::test_localtime_ext ... ok
test rad::tests::test_init ... ok
test profile::config::test::schema ... ok
test storage::git::tests::test_references_of ... ok
test storage::git::transport::local::url::test::test_url_parse ... ok
test storage::git::transport::local::url::test::test_url_to_string ... ok
test storage::git::tests::test_sign_refs ... ok
test storage::git::transport::remote::url::test::test_url_parse ... ok
test storage::refs::tests::prop_canonical_roundtrip ... ok
test storage::tests::test_storage ... ok
test test::assert::test::assert_with_message ... ok
test test::assert::test::test_assert_no_move ... ok
test test::assert::test::test_assert_panic_0 - should panic ... ok
test test::assert::test::test_assert_panic_1 - should panic ... ok
test test::assert::test::test_assert_panic_2 - should panic ... ok
test test::assert::test::test_assert_succeed ... ok
test test::assert::test::test_panic_message ... ok
test version::test::test_version ... ok
test storage::git::tests::test_remote_refs ... ok
test storage::refs::tests::test_rid_verification ... ok
test identity::doc::test::prop_encode_decode ... ok
test result: ok. 199 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.15s
Running unittests src/lib.rs (target/debug/deps/radicle_cli-25a8a4e2e0781b4b)
running 14 tests
test commands::rad_patch::review::builder::tests::test_review_comments_basic ... ok
test commands::rad_patch::review::builder::tests::test_review_comments_before ... ok
test commands::rad_inspect::test::test_tree ... ok
test commands::rad_patch::review::builder::tests::test_review_comments_multiline ... ok
test git::pretty_diff::test::test_pretty ... ignored
test git::ddiff::tests::diff_encode_decode_ddiff_hunk ... ok
test git::unified_diff::test::test_diff_content_encode_decode_content ... ok
test commands::rad_patch::review::builder::tests::test_review_comments_split_hunk ... ok
test terminal::format::test::test_bytes ... ok
test terminal::format::test::test_strip_comments ... ok
test git::unified_diff::test::test_diff_encode_decode_diff ... ok
test terminal::patch::test::test_edit_display_message ... ok
test terminal::patch::test::test_update_display_message ... ok
test terminal::patch::test::test_create_display_message ... ok
test result: ok. 13 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.01s
Running unittests src/main.rs (target/debug/deps/rad-21e059cd1d5e91eb)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/commands.rs (target/debug/deps/commands-58224fef6dde650d)
running 96 tests
test framework_home ... ok
test git_push_and_fetch ... ok
test git_push_amend ... ok
test git_push_canonical_tags ... ok
test git_push_diverge ... ok
test git_push_rollback ... ok
test rad_auth_errors ... ok
test rad_block ... ok
test rad_auth ... ok
test git_push_converge ... ok
test rad_checkout ... ok
test git_tag ... ok
test rad_clone ... ok
test rad_clone_connect ... ok
test rad_clean ... ok
test rad_clone_unknown ... ok
test rad_clone_directory ... ok
test rad_clone_all ... ok
test rad_cob_multiset ... ok
test rad_cob_log ... ok
test rad_cob_migrate ... ok
test rad_clone_partial_fail ... ok
test rad_cob_show ... ok
test rad_config ... ok
test rad_cob_update_identity ... ok
test rad_cob_update ... ok
test rad_diff ... ok
test rad_id_collaboration ... ignored, slow
test rad_id ... ok
test rad_id_conflict ... ok
test rad_id_private ... ok
test rad_id_threshold ... ok
test rad_id_multi_delegate ... ok
test rad_id_unknown_field ... ok
test rad_id_update_delete_field ... ok
test rad_id_threshold_soft_fork ... ok
test rad_init ... ok
test rad_init_existing ... ok
test rad_init_no_git ... ok
test rad_init_no_seed ... ok
test rad_init_private ... ok
test rad_init_private_clone ... ok
test rad_inbox ... ok
test rad_init_private_no_seed ... ok
test rad_init_private_clone_seed ... ok
test rad_init_private_seed ... ok
test rad_init_sync_not_connected ... ok
test rad_fetch ... ok
test rad_fork ... ok
test rad_init_with_existing_remote ... ok
test rad_init_sync_preferred ... ok
test rad_inspect ... ok
test rad_issue ... ok
test rad_merge_after_update ... ok
test rad_merge_no_ff ... ok
test rad_merge_via_push ... ok
test rad_node_connect ... ok
test rad_patch ... ok
test rad_node ... ok
test rad_patch_ahead_behind ... ok
test rad_patch_change_base ... ok
test rad_patch_checkout ... ok
test rad_patch_checkout_revision ... ok
test rad_patch_checkout_force ... ok
test rad_patch_detached_head ... ok
test rad_patch_diff ... ok
test rad_patch_draft ... ok
test rad_init_sync_and_clone ... ok
test rad_patch_edit ... ok
test rad_init_sync_timeout ... ok
test rad_patch_fetch_2 ... ok
test rad_patch_merge_draft ... ok
test rad_patch_delete ... ok
test rad_patch_revert_merge ... ok
test rad_patch_fetch_1 ... ok
test rad_patch_update ... ok
test rad_patch_via_push ... ok
test rad_patch_open_explore ... ok
test rad_publish ... ok
test rad_review_by_hunk ... ok
test rad_seed_and_follow ... ok
test rad_remote ... ok
test rad_self ... ok
test rad_seed_many ... ok
test rad_sync_without_node ... ok
test rad_unseed ... ok
test rad_push_and_pull_patches ... ok
test rad_unseed_many ... ok
test rad_watch ... ok
test rad_sync ... ok
test test_clone_without_seeds ... ok
test test_cob_deletion ... ok
test test_cob_replication ... ok
test rad_workflow ... ok
test rad_patch_pull_update ... ok
test test_replication_via_seed ... ok
test result: ok. 95 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 71.92s
Running unittests src/lib.rs (target/debug/deps/radicle_cli_test-29cf51daa2847130)
running 3 tests
test tests::test_parse ... ok
test tests::test_run ... ok
test tests::test_example_spaced_brackets ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
Running unittests src/lib.rs (target/debug/deps/radicle_cob-e85912e820568959)
running 8 tests
test object::tests::test_serde ... ok
test tests::parse_refstr ... ok
test tests::invalid_parse_refstr ... ok
test tests::list_cobs ... ok
test type_name::test::valid_typenames ... ok
test tests::roundtrip ... ok
test tests::traverse_cobs ... ok
test tests::update_cob ... ok
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
Running unittests src/lib.rs (target/debug/deps/radicle_crdt-930be78070bafbbb)
running 24 tests
test immutable::test::test_merge_equal ... ok
test immutable::test::test_merge_inequal - should panic ... ok
test lwwmap::tests::test_insert ... ok
test lwwmap::tests::test_insert_remove ... ok
test lwwmap::tests::test_is_empty ... ok
test lwwmap::tests::test_remove_insert ... ok
test lwwreg::tests::prop_semilattice ... ok
test lwwreg::tests::test_merge ... ok
test lwwreg::tests::test_set_get ... ok
test gset::tests::prop_semilattice ... ok
test lwwset::tests::test_insert ... ok
test lwwset::tests::test_insert_remove ... ok
test lwwset::tests::test_remove_insert ... ok
test redactable::test::prop_invariants ... ok
test redactable::test::test_both_present ... ok
test redactable::test::test_redacted ... ok
test gmap::tests::prop_semilattice ... ok
test tests::prop_bool_laws ... ok
test test::test_generator ... ok
test tests::prop_option_laws ... ok
test tests::test_bool ... ok
test tests::test_option ... ok
test lwwmap::tests::prop_semilattice ... ok
test lwwset::tests::prop_semilattice ... ok
test result: ok. 24 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.07s
Running unittests src/lib.rs (target/debug/deps/radicle_crypto-5617725847bbf5b6)
running 12 tests
test ssh::fmt::test::test_key ... ok
test ssh::keystore::tests::test_init_no_passphrase ... ok
test ssh::test::prop_encode_decode_sk ... ok
test ssh::test::test_agent_encoding_remove ... ok
test ssh::test::test_agent_encoding_sign ... ok
test ssh::fmt::test::test_fingerprint ... ok
test tests::prop_encode_decode ... ok
test tests::test_e25519_dh ... ok
test tests::test_encode_decode ... ok
test tests::prop_key_equality ... ok
test ssh::keystore::tests::test_signer ... ok
test ssh::keystore::tests::test_init_passphrase ... ok
test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.79s
Running unittests src/lib.rs (target/debug/deps/radicle_dag-20ca1aca3d76c348)
running 20 tests
test tests::test_dependencies ... ok
test tests::test_cycle ... ok
test tests::test_complex ... ok
test tests::test_contains ... ok
test tests::test_diamond ... ok
test tests::test_fold_diamond ... ok
test tests::test_fold_multiple_roots ... ok
test tests::test_fold_reject ... ok
test tests::test_fold_sorting_1 ... ok
test tests::test_fold_sorting_2 ... ok
test tests::test_get ... ok
test tests::test_is_empty ... ok
test tests::test_len ... ok
test tests::test_merge_2 ... ok
test tests::test_merge_1 ... ok
test tests::test_prune_1 ... ok
test tests::test_prune_2 ... ok
test tests::test_prune_by_sorting ... ok
test tests::test_siblings ... ok
test tests::test_remove ... ok
test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_fetch-3af3f2044db5ec52)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_node-9598e9a2f8a26ffc)
running 113 tests
test deserializer::test::prop_decode_next ... ok
test deserializer::test::test_decode_next ... ok
test service::filter::test::test_parameters ... ok
test deserializer::test::test_unparsed ... ok
test control::tests::test_control_socket ... ok
test service::limiter::test::test_limitter_different_rates ... ok
test service::limiter::test::test_limitter_multi ... ok
test service::limiter::test::test_limitter_refill ... ok
test service::gossip::store::test::test_announced ... ok
test service::filter::test::test_sizes ... ok
test control::tests::test_seed_unseed ... ok
test service::message::tests::test_ref_remote_limit ... ok
test service::message::tests::test_inventory_limit ... ok
test service::message::tests::prop_refs_announcement_signing ... ok
test tests::e2e::missing_default_branch ... ok
test tests::e2e::missing_delegate_default_branch ... ok
test tests::e2e::test_background_foreground_fetch ... ok
test tests::e2e::test_channel_reader_limit ... ok
test tests::e2e::test_catchup_on_refs_announcements ... ok
test tests::e2e::test_clone ... ok
test service::message::tests::test_node_announcement_validate ... ok
test tests::e2e::test_dont_fetch_owned_refs ... ok
test tests::e2e::test_fetch_followed_remotes ... ok
test tests::e2e::test_fetch_preserve_owned_refs ... ok
test tests::e2e::test_connection_crossing ... ok
test tests::e2e::test_fetch_unseeded ... ok
test tests::e2e::test_concurrent_fetches ... ok
test tests::e2e::test_fetch_up_to_date ... ok
test tests::e2e::test_inventory_sync_basic ... ok
test tests::e2e::test_large_fetch ... ok
test tests::e2e::test_migrated_clone ... ok
test tests::e2e::test_missing_remote ... ok
test tests::e2e::test_multiple_offline_inits ... ok
test tests::e2e::test_non_fastforward_sigrefs ... ok
test tests::e2e::test_outdated_delegate_sigrefs ... ok
test tests::e2e::test_outdated_sigrefs ... ok
test tests::e2e::test_replication ... ok
test tests::e2e::test_replication_invalid ... ok
test tests::e2e::test_replication_ref_in_sigrefs ... ok
test tests::e2e::test_inventory_sync_bridge ... ok
test tests::e2e::test_inventory_sync_ring ... ok
test tests::e2e::test_inventory_sync_star ... ok
test tests::test_announcement_rebroadcast ... ok
test tests::test_announcement_rebroadcast_duplicates ... ok
test tests::test_announcement_rebroadcast_timestamp_filtered ... ok
test tests::test_announcement_relay ... ok
test tests::test_connection_kept_alive ... ok
test tests::test_disconnecting_unresponsive_peer ... ok
test tests::test_fetch_missing_inventory_on_gossip ... ok
test tests::test_fetch_missing_inventory_on_schedule ... ok
test tests::test_inbound_connection ... ok
test tests::test_inventory_decode ... ok
test tests::test_init_and_seed ... ok
test tests::test_inventory_relay ... ok
test tests::test_inventory_relay_bad_timestamp ... ok
test tests::test_inventory_sync ... ok
test tests::test_maintain_connections ... ok
test tests::test_maintain_connections_failed_attempt ... ok
test tests::test_maintain_connections_transient ... ok
test tests::test_outbound_connection ... ok
test tests::test_persistent_peer_connect ... ok
test tests::test_inventory_pruning ... ok
test tests::test_persistent_peer_reconnect_success ... ok
test tests::test_persistent_peer_reconnect_attempt ... ok
test tests::test_ping_response ... ok
test tests::test_queued_fetch_from_ann_same_rid ... ok
test tests::test_queued_fetch_from_command_same_rid ... ok
test tests::test_queued_fetch_max_capacity ... ok
test tests::test_redundant_connect ... ok
test tests::test_refs_announcement_followed ... ok
test tests::test_refs_announcement_fetch_trusted_no_inventory ... ok
test tests::test_refs_announcement_no_subscribe ... ok
test tests::test_refs_announcement_offline ... ok
test tests::test_refs_announcement_relay_private ... ok
test tests::test_refs_announcement_relay_public ... ok
test tests::test_seed_repo_subscribe ... ok
test tests::test_refs_synced_event ... ok
test wire::frame::test::test_stream_id ... ok
test wire::message::tests::prop_addr ... ok
test tests::test_seeding ... ok
test tests::prop_inventory_exchange_dense ... ok
test wire::message::tests::prop_message_encode_decode ... ok
test wire::message::tests::test_inv_ann_max_size ... ok
test wire::message::tests::test_node_ann_max_size ... ok
test wire::message::tests::test_pingpong_encode_max_size ... ok
test wire::message::tests::test_pingpong_encode_size_overflow ... ok
test wire::message::tests::prop_zero_bytes_encode_decode ... ok
test wire::protocol::test::test_inventory_ann_with_extension ... ok
test wire::protocol::test::test_pong_message_with_extension ... ok
test wire::tests::prop_filter ... ok
test wire::tests::prop_id ... ok
test wire::tests::prop_oid ... ok
test wire::tests::prop_pubkey ... ok
test wire::tests::prop_refs ... ok
test wire::tests::prop_signature ... ok
test wire::tests::prop_signed_refs ... ok
test wire::tests::prop_string ... ok
test wire::tests::prop_tuple ... ok
test wire::tests::prop_u16 ... ok
test wire::tests::prop_u32 ... ok
test wire::tests::prop_u64 ... ok
test wire::tests::prop_u8 ... ok
test wire::tests::prop_vec ... ok
test wire::tests::test_alias ... ok
test wire::tests::test_bounded_vec_limit ... ok
test wire::tests::test_filter_invalid ... ok
test wire::tests::test_string ... ok
test wire::varint::test::prop_encode_decode ... ok
test wire::varint::test::test_encode_overflow - should panic ... ok
test wire::varint::test::test_encoding ... ok
test wire::message::tests::test_refs_ann_max_size ... ok
test wire::message::tests::prop_message_decoder ... ok
test tests::test_announcement_message_amplification ... ok
test result: ok. 113 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 16.53s
Running unittests src/main.rs (target/debug/deps/radicle_node-b0a51ab367a92718)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_remote_helper-1b88daa2d384d734)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/git-remote-rad.rs (target/debug/deps/git_remote_rad-f218e881abea4a5d)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/main.rs (target/debug/deps/radicle_schemars-b8ddeab1e84c7210)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_signals-0c183d7d8cb1e457)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_ssh-02e22359ef9bf046)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_systemd-28e02dc067eac38d)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/lib.rs (target/debug/deps/radicle_term-98d660e1537ffc71)
running 20 tests
test ansi::tests::colors_enabled ... ok
test cell::test::test_width ... ok
test ansi::tests::wrapping ... ok
test ansi::tests::colors_disabled ... ok
test element::test::test_width ... ok
test element::test::test_truncate ... ok
test table::test::test_table ... ok
test table::test::test_table_border_maximized ... ok
test table::test::test_table_border ... ok
test table::test::test_table_truncate ... ok
test table::test::test_table_border_truncated ... ok
test table::test::test_table_unicode ... ok
test table::test::test_table_unicode_truncate ... ok
test table::test::test_truncate ... ok
test textarea::test::test_wrapping_code_block ... ok
test textarea::test::test_wrapping ... ok
test textarea::test::test_wrapping_fenced_block ... ok
test textarea::test::test_wrapping_paragraphs ... ok
test vstack::test::test_vstack ... ok
test vstack::test::test_vstack_maximize ... ok
test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/rad-agent.rs (target/debug/deps/rad_agent-f3e5802027c7a355)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/rad-cli-demo.rs (target/debug/deps/rad_cli_demo-ad04a83729fc3514)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/rad-init.rs (target/debug/deps/rad_init-6318fa3d2522f8ed)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/rad-merge.rs (target/debug/deps/rad_merge-589ff38dc5e8539f)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/rad-push.rs (target/debug/deps/rad_push-75748695fdb02469)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/rad-self.rs (target/debug/deps/rad_self-4df1f230f8467bdd)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running unittests src/rad-set-canonical-refs.rs (target/debug/deps/rad_set_canonical_refs-f84a6757015d4915)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_cli
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_cli_test
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_cob
running 1 test
test crates/radicle-cob/src/backend/git/stable.rs - backend::git::stable::with_advanced_timestamp (line 56) ... ignored
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_crdt
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_crypto
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_dag
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_fetch
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_node
running 6 tests
test crates/radicle-node/src/bounded.rs - bounded::BoundedVec<T,N>::max (line 96) ... ok
test crates/radicle-node/src/bounded.rs - bounded::BoundedVec<T,N>::truncate (line 50) ... ok
test crates/radicle-node/src/bounded.rs - bounded::BoundedVec<T,N>::push (line 122) ... ok
test crates/radicle-node/src/bounded.rs - bounded::BoundedVec<T,N>::collect_from (line 30) ... ok
test crates/radicle-node/src/bounded.rs - bounded::BoundedVec<T,N>::with_capacity (line 66) ... ok
test crates/radicle-node/src/bounded.rs - bounded::BoundedVec<T,N>::unbound (line 149) ... ok
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.48s
Doc-tests radicle_remote_helper
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_signals
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_ssh
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_systemd
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests radicle_term
running 1 test
test crates/radicle-term/src/table.rs - table (line 4) ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.41s
Exit code: 0
{
"response": "finished",
"result": "success"
}