rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 heartwood120ebfeb83c7a8d3ce3f8db5af1d02413fade857
{
"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": "4818ce70b318350cc5e0c335a646edf463566275",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"title": "node: handle removal of cob from cache",
"state": {
"status": "merged",
"conflicts": []
},
"before": "bc247dff2400ed4f454f1d76e6a95bd82f05b792",
"after": "120ebfeb83c7a8d3ce3f8db5af1d02413fade857",
"commits": [
"120ebfeb83c7a8d3ce3f8db5af1d02413fade857"
],
"target": "d285eccb23f3986bfa88fc1af033e6dcb0dc3a65",
"labels": [],
"assignees": [],
"revisions": [
{
"id": "4818ce70b318350cc5e0c335a646edf463566275",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "When a `Patch` or `Issue` is entirely removed from the Git repository,\nthen there is no update to be made -- instead it should also be\nremoved from the cache.\n\nThis covers the case where the original author of the COB deletes the\nCOB.",
"base": "bc247dff2400ed4f454f1d76e6a95bd82f05b792",
"oid": "120ebfeb83c7a8d3ce3f8db5af1d02413fade857",
"timestamp": 1712322035
},
{
"id": "a666af8cad6f43b4549f155053633316474f5572",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Rebase.",
"base": "53ecc88437534ebed1a23e213c1c84d39e673534",
"oid": "8bf871903a79c3492ccdece14b8957eeecbe4650",
"timestamp": 1712671614
}
]
}
}
{
"response": "triggered",
"run_id": {
"id": "33a76fe4-7810-42f0-926f-1d0ce8c5241d"
},
"info_url": "https://cci.rad.levitte.org//33a76fe4-7810-42f0-926f-1d0ce8c5241d.html"
}
Started at: 2026-09-07 21:13:21.757104+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/33a76fe4-7810-42f0-926f-1d0ce8c5241d/w/
╭────────────────────────────────────╮
│ heartwood │
│ Radicle Heartwood Protocol & Stack │
│ 189 issues · 38 patches │
╰────────────────────────────────────╯
Run `cd ./.` to go to the repository directory.
Exit code: 0
$ rad patch checkout 4818ce70b318350cc5e0c335a646edf463566275
✓ Switched to branch patch/4818ce7 at revision 4818ce7
✓ Branch patch/4818ce7 setup to track rad/patches/4818ce70b318350cc5e0c335a646edf463566275
Exit code: 0
$ git config advice.detachedHead false
Exit code: 0
$ git checkout 120ebfeb83c7a8d3ce3f8db5af1d02413fade857
HEAD is now at 120ebfeb node: handle removal of cob from cache
Exit code: 0
$ rad patch show 4818ce70b318350cc5e0c335a646edf463566275 -p
╭────────────────────────────────────────────────────────────────────────────────╮
│ Title node: handle removal of cob from cache │
│ Patch 4818ce70b318350cc5e0c335a646edf463566275 │
│ Author fintohaps z6Mkire…SQZ3voM │
│ Head 120ebfeb83c7a8d3ce3f8db5af1d02413fade857 │
│ Base bc247dff2400ed4f454f1d76e6a95bd82f05b792 │
│ Target master │
│ Branches patch/4818ce7 │
│ Commits ahead 1, behind 1453 │
│ Status merged │
│ │
│ When a `Patch` or `Issue` is entirely removed from the Git repository, │
│ then there is no update to be made -- instead it should also be │
│ removed from the cache. │
│ │
│ This covers the case where the original author of the COB deletes the │
│ COB. │
├────────────────────────────────────────────────────────────────────────────────┤
│ 120ebfe node: handle removal of cob from cache │
├────────────────────────────────────────────────────────────────────────────────┤
│ ● Revision 4818ce7 @ bc247df..120ebfe by fintohaps z6Mkire…SQZ3voM 2 years ago │
│ ↑ Revision a666af8 @ 53ecc88..8bf8719 by cloudhead z6MksFq…bS9wzpT 2 years ago │
│ └─ ✓ merged by cloudhead z6MksFq…bS9wzpT │
╰────────────────────────────────────────────────────────────────────────────────╯
commit 120ebfeb83c7a8d3ce3f8db5af1d02413fade857
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Fri Apr 5 13:58:57 2024 +0100
node: handle removal of cob from cache
When a `Patch` or `Issue` is entirely removed from the Git repository,
then there is no update to be made -- instead it should also be
removed from the cache.
This covers the case where the original author of the COB deletes the
COB.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
diff --git a/radicle-cli/examples/rad-patch-delete.md b/radicle-cli/examples/rad-patch-delete.md
index d58562167..200124cb4 100644
--- a/radicle-cli/examples/rad-patch-delete.md
+++ b/radicle-cli/examples/rad-patch-delete.md
@@ -11,7 +11,7 @@ $ git commit -m "Introduce license"
``` ~alice (stderr)
$ git push rad -o patch.draft -o patch.message="Define LICENSE for project" HEAD:refs/patches
✓ Patch 6c61ef1716ad8a5c11e04dd7a3fec51e01fba70b drafted
-✓ Synced with 1 node(s)
+✓ Synced with 2 node(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
* [new reference] HEAD -> refs/patches
```
@@ -26,7 +26,7 @@ $ rad patch comment 6c61ef1 -m "I think we should use MIT"
│ bob (you) now 833db19 │
│ I think we should use MIT │
╰───────────────────────────╯
-✓ Synced with 1 node(s)
+✓ Synced with 2 node(s)
```
``` ~alice
@@ -53,7 +53,7 @@ $ rad patch comment 6c61ef1 --reply-to 833db19 -m "Thanks, I'll add it!"
│ alice (you) now 1803a38 │
│ Thanks, I'll add it! │
╰─────────────────────────╯
-✓ Synced with 1 node(s)
+✓ Synced with 2 node(s)
```
``` ~alice
@@ -69,7 +69,7 @@ $ git commit -am "Add MIT License"
``` ~alice (stderr)
$ git push -f
✓ Patch 6c61ef1 updated to revision 93915b9afa94a9dc4f52f12cdf077d4613ea3eb3
-✓ Synced with 1 node(s)
+✓ Synced with 2 node(s)
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
717c900..1cc8cd9 prepare-license -> patches/6c61ef1716ad8a5c11e04dd7a3fec51e01fba70b
```
@@ -77,7 +77,7 @@ To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkE
``` ~bob
$ rad patch review 6c61ef1 --accept -m "LGTM!"
✓ Patch 6c61ef1 accepted
-✓ Synced with 1 node(s)
+✓ Synced with 2 node(s)
$ rad patch show 6c61ef1 -v
╭─────────────────────────────────────────────────────────────────────╮
│ Title Define LICENSE for project │
@@ -99,7 +99,7 @@ $ rad patch show 6c61ef1 -v
``` ~bob
$ rad patch delete 6c61ef1
-✓ Synced with 1 node(s)
+✓ Synced with 2 node(s)
```
``` ~alice
@@ -121,3 +121,16 @@ $ rad patch show 6c61ef1 -v
│ ↑ updated to 93915b9afa94a9dc4f52f12cdf077d4613ea3eb3 (1cc8cd9) now │
╰─────────────────────────────────────────────────────────────────────╯
```
+
+If Alice also decides to delete the patch, then any seeds that have synced with
+Alice should no longer have the patch:
+
+``` ~alice
+$ rad patch delete 6c61ef1
+✓ Synced with 2 node(s)
+```
+
+``` ~seed (fails)
+$ rad patch show --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji 6c61ef1 -v
+✗ Error: Patch `6c61ef1716ad8a5c11e04dd7a3fec51e01fba70b` not found
+```
diff --git a/radicle-cli/tests/commands.rs b/radicle-cli/tests/commands.rs
index 600bd0813..24833f68b 100644
--- a/radicle-cli/tests/commands.rs
+++ b/radicle-cli/tests/commands.rs
@@ -967,6 +967,7 @@ fn rad_patch_delete() {
let mut environment = Environment::new();
let alice = environment.node(Config::test(Alias::new("alice")));
let bob = environment.node(Config::test(Alias::new("bob")));
+ let seed = environment.node(Config::test(Alias::new("seed")));
let working = environment.tmp().join("working");
let acme = RepoId::from_str("z42hL2jL4XNk6K8oHQaSWfMgCL7ji").unwrap();
@@ -983,9 +984,11 @@ fn rad_patch_delete() {
let mut alice = alice.spawn();
let mut bob = bob.spawn();
+ let mut seed = seed.spawn();
bob.handle.seed(acme, Scope::All).unwrap();
- alice.connect(&bob).converge([&bob]);
+ seed.handle.seed(acme, Scope::All).unwrap();
+ alice.connect(&bob).connect(&seed).converge([&bob, &seed]);
test(
"examples/rad-clone.md",
@@ -1007,6 +1010,11 @@ fn rad_patch_delete() {
working.join("bob"),
[("RAD_HOME", bob.home.path().display())],
)
+ .home(
+ "seed",
+ working.join("seed"),
+ [("RAD_HOME", seed.home.path().display())],
+ )
.run()
.unwrap();
}
diff --git a/radicle-node/src/worker/fetch.rs b/radicle-node/src/worker/fetch.rs
index f3def99b3..bed41ab81 100644
--- a/radicle-node/src/worker/fetch.rs
+++ b/radicle-node/src/worker/fetch.rs
@@ -302,6 +302,16 @@ where
type_name: identifier.type_name,
err: e.into(),
})?;
+ } else {
+ // N.b. the issue has been removed entirely from the
+ // repository so we also remove it from the cache
+ cob::cache::Remove::<cob::issue::Issue>::remove(cache, &identifier.id)
+ .map(|_| ())
+ .map_err(|e| error::Cache::Remove {
+ id: identifier.id,
+ type_name: identifier.type_name,
+ err: Box::new(e),
+ })?;
}
} else if identifier.is_patch() {
if let Some(patch) = patches.get(&identifier.id)? {
@@ -313,6 +323,16 @@ where
type_name: identifier.type_name,
err: e.into(),
})?;
+ } else {
+ // N.b. the patch has been removed entirely from the
+ // repository so we also remove it from the cache
+ cob::cache::Remove::<cob::patch::Patch>::remove(cache, &identifier.id)
+ .map(|_| ())
+ .map_err(|e| error::Cache::Remove {
+ id: identifier.id,
+ type_name: identifier.type_name,
+ err: Box::new(e),
+ })?;
}
}
}
Exit code: 0
shell: 'cargo --version rustc --version cargo fmt --check cargo clippy --all-targets --workspace -- --deny clippy::all cargo build --all-targets --workspace cargo doc --workspace cargo test --workspace --no-fail-fast '
Commands:
$ podman run --name 33a76fe4-7810-42f0-926f-1d0ce8c5241d -v /opt/radcis/ci.rad.levitte.org/cci/state/33a76fe4-7810-42f0-926f-1d0ce8c5241d/s:/33a76fe4-7810-42f0-926f-1d0ce8c5241d/s:ro -v /opt/radcis/ci.rad.levitte.org/cci/state/33a76fe4-7810-42f0-926f-1d0ce8c5241d/w:/33a76fe4-7810-42f0-926f-1d0ce8c5241d/w -w /33a76fe4-7810-42f0-926f-1d0ce8c5241d/w -v /opt/radcis/ci.rad.levitte.org/.radicle:/${id}/.radicle:ro -e RAD_HOME=/${id}/.radicle rust:trixie bash /33a76fe4-7810-42f0-926f-1d0ce8c5241d/s/script.sh
+ cargo --version
info: syncing channel updates for '1.77-x86_64-unknown-linux-gnu'
info: latest update on 2024-04-09, rust version 1.77.2 (25ef9e3d8 2024-04-09)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: installing component 'rust-std'
info: installing component 'rustc'
cargo 1.77.2 (e52e36006 2024-03-26)
+ rustc --version
rustc 1.77.2 (25ef9e3d8 2024-04-09)
+ cargo fmt --check
error: 'cargo-fmt' is not installed for the toolchain '1.77-x86_64-unknown-linux-gnu'.
To install, run `rustup component add --toolchain 1.77-x86_64-unknown-linux-gnu rustfmt`
Exit code: 1
{
"response": "finished",
"result": "failure"
}