rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 heartwood68590355c8f7d1699802c612d856a5557fda86d9
{
"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": "ce953155d9e8d4cf9adb22019715ed963876a95a",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"title": "cli: add un/resolve for patch review comments",
"state": {
"status": "merged",
"conflicts": []
},
"before": "92c9e21873be1c9107f906f826d4774a8a950d79",
"after": "68590355c8f7d1699802c612d856a5557fda86d9",
"commits": [
"68590355c8f7d1699802c612d856a5557fda86d9"
],
"target": "3fc92f83fe089263c470b328414d923227cf0e4a",
"labels": [],
"assignees": [],
"revisions": [
{
"id": "ce953155d9e8d4cf9adb22019715ed963876a95a",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Patch review comments can be resolved and unresolved as part of the Patch COB\nAPI. This functionality was missing from the `rad patch command`.\n\nAdd a subcommand `rad patch resolve` which can resolve a review comment, and\nunresolve given the `--unresolve` flag.",
"base": "92c9e21873be1c9107f906f826d4774a8a950d79",
"oid": "4773810211f9788979c68e70f892867a69c3f74b",
"timestamp": 1720002913
},
{
"id": "a1b7b20acc2596e943d0b56d31b1b58f7f900d5c",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Changes:\n- Add `resolve` file\n- Rename `--unresolve` to `--undo`",
"base": "92c9e21873be1c9107f906f826d4774a8a950d79",
"oid": "68590355c8f7d1699802c612d856a5557fda86d9",
"timestamp": 1720014021
},
{
"id": "8d0cd76819aa99bddcf5ce6b1f7e26234e361014",
"author": {
"id": "did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"alias": null
},
"description": "Rebase.",
"base": "84aaf9efd08563df2d55ab5f2557badc0522ed23",
"oid": "fa19105f2fddd1b07f79514942eab2976a09d7f1",
"timestamp": 1720030918
}
]
}
}
{
"response": "triggered",
"run_id": {
"id": "ba8d0a90-d6b3-4328-8bd2-e74539022414"
},
"info_url": "https://cci.rad.levitte.org//ba8d0a90-d6b3-4328-8bd2-e74539022414.html"
}
Started at: 2026-09-08 03:48:09.714139+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/ba8d0a90-d6b3-4328-8bd2-e74539022414/w/
╭────────────────────────────────────╮
│ heartwood │
│ Radicle Heartwood Protocol & Stack │
│ 189 issues · 38 patches │
╰────────────────────────────────────╯
Run `cd ./.` to go to the repository directory.
Exit code: 0
$ rad patch checkout ce953155d9e8d4cf9adb22019715ed963876a95a
✓ Switched to branch patch/ce95315 at revision a1b7b20
✓ Branch patch/ce95315 setup to track rad/patches/ce953155d9e8d4cf9adb22019715ed963876a95a
Exit code: 0
$ git config advice.detachedHead false
Exit code: 0
$ git checkout 68590355c8f7d1699802c612d856a5557fda86d9
HEAD is now at 68590355 cli: add un/resolve for patch review comments
Exit code: 0
$ rad patch show ce953155d9e8d4cf9adb22019715ed963876a95a -p
╭────────────────────────────────────────────────────────────────────────────────╮
│ Title cli: add un/resolve for patch review comments │
│ Patch ce953155d9e8d4cf9adb22019715ed963876a95a │
│ Author fintohaps z6Mkire…SQZ3voM │
│ Head 68590355c8f7d1699802c612d856a5557fda86d9 │
│ Base 92c9e21873be1c9107f906f826d4774a8a950d79 │
│ Target master │
│ Branches patch/ce95315 │
│ Commits ahead 1, behind 1272 │
│ Status merged │
│ │
│ Patch review comments can be resolved and unresolved as part of the Patch COB │
│ API. This functionality was missing from the `rad patch command`. │
│ │
│ Add a subcommand `rad patch resolve` which can resolve a review comment, and │
│ unresolve given the `--unresolve` flag. │
├────────────────────────────────────────────────────────────────────────────────┤
│ 6859035 cli: add un/resolve for patch review comments │
├────────────────────────────────────────────────────────────────────────────────┤
│ ● Revision ce95315 @ 92c9e21..4773810 by fintohaps z6Mkire…SQZ3voM 2 years ago │
│ ↑ Revision a1b7b20 @ 92c9e21..6859035 by fintohaps z6Mkire…SQZ3voM 2 years ago │
│ ↑ Revision 8d0cd76 @ 84aaf9e..fa19105 by cloudhead z6MksFq…bS9wzpT 2 years ago │
│ └─ ✓ merged by cloudhead z6MksFq…bS9wzpT │
╰────────────────────────────────────────────────────────────────────────────────╯
commit 68590355c8f7d1699802c612d856a5557fda86d9
Author: Fintan Halpenny <fintan.halpenny@gmail.com>
Date: Wed Jul 3 11:31:16 2024 +0100
cli: add un/resolve for patch review comments
Patch review comments can be resolved and unresolved as part of the Patch COB
API. This functionality was missing from the `rad patch command`.
Add a subcommand `rad patch resolve` which can resolve a review comment, and
unresolve given the `--undo` flag.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
diff --git a/radicle-cli/src/commands/patch.rs b/radicle-cli/src/commands/patch.rs
index 541d9b731..ce38d9218 100644
--- a/radicle-cli/src/commands/patch.rs
+++ b/radicle-cli/src/commands/patch.rs
@@ -22,6 +22,8 @@ mod list;
mod ready;
#[path = "patch/redact.rs"]
mod redact;
+#[path = "patch/resolve.rs"]
+mod resolve;
#[path = "patch/review.rs"]
mod review;
#[path = "patch/show.rs"]
@@ -61,6 +63,7 @@ Usage
rad patch update <patch-id> [<option>...]
rad patch checkout <patch-id> [<option>...]
rad patch review <patch-id> [--accept | --reject] [-m [<string>]] [-d | --delete] [<option>...]
+ rad patch resolve <patch-id> [--review <review-id>] [--comment <comment-id>] [--unresolve] [<option>...]
rad patch delete <patch-id> [<option>...]
rad patch redact <revision-id> [<option>...]
rad patch assign <revision-id> [--add <did>] [--delete <did>] [<option>...]
@@ -101,6 +104,12 @@ Review options
-d, --delete Delete a review draft
-m, --message [<string>] Provide a comment with the review (default: prompt)
+Resolve options
+
+ --review <id> The review id which the comment is under
+ --comment <id> The comment to (un)resolve
+ --undo Unresolve the comment
+
Assign options
-a, --add <did> Add an assignee to the patch (may be specified multiple times).
@@ -169,6 +178,7 @@ pub enum OperationName {
Comment,
Ready,
Review,
+ Resolve,
Label,
#[default]
List,
@@ -232,6 +242,12 @@ pub enum Operation {
revision_id: Option<Rev>,
opts: review::Options,
},
+ Resolve {
+ patch_id: Rev,
+ review_id: Rev,
+ comment_id: Rev,
+ undo: bool,
+ },
Assign {
patch_id: Rev,
opts: AssignOptions,
@@ -268,6 +284,7 @@ impl Operation {
| Operation::Delete { .. }
| Operation::Comment { .. }
| Operation::Review { .. }
+ | Operation::Resolve { .. }
| Operation::Assign { .. }
| Operation::Label { .. }
| Operation::Edit { .. }
@@ -306,6 +323,8 @@ impl Args for Options {
let mut announce = true;
let mut patch_id = None;
let mut revision_id = None;
+ let mut review_id = None;
+ let mut comment_id = None;
let mut message = Message::default();
let mut filter = Some(patch::Status::Open);
let mut diff = false;
@@ -442,6 +461,23 @@ impl Args for Options {
}
}
+ // Resolve options
+ Long("undo") if op == Some(OperationName::Resolve) => {
+ undo = true;
+ }
+ Long("review") if op == Some(OperationName::Resolve) => {
+ let val = parser.value()?;
+ let rev = term::args::rev(&val)?;
+
+ review_id = Some(rev);
+ }
+ Long("comment") if op == Some(OperationName::Resolve) => {
+ let val = parser.value()?;
+ let rev = term::args::rev(&val)?;
+
+ comment_id = Some(rev);
+ }
+
// Checkout options
Long("revision") if op == Some(OperationName::Checkout) => {
let val = parser.value()?;
@@ -545,6 +581,7 @@ impl Args for Options {
"label" => op = Some(OperationName::Label),
"comment" => op = Some(OperationName::Comment),
"review" => op = Some(OperationName::Review),
+ "resolve" => op = Some(OperationName::Resolve),
"set" => op = Some(OperationName::Set),
"cache" => op = Some(OperationName::Cache),
unknown => anyhow::bail!("unknown operation '{}'", unknown),
@@ -565,6 +602,7 @@ impl Args for Options {
Some(OperationName::Checkout),
Some(OperationName::Comment),
Some(OperationName::Review),
+ Some(OperationName::Resolve),
Some(OperationName::Edit),
Some(OperationName::Set),
Some(OperationName::Assign),
@@ -623,6 +661,13 @@ impl Args for Options {
op: review_op,
},
},
+ OperationName::Resolve => Operation::Resolve {
+ patch_id: patch_id
+ .ok_or_else(|| anyhow!("a patch or revision must be provided"))?,
+ review_id: review_id.ok_or_else(|| anyhow!("a review must be provided"))?,
+ comment_id: comment_id.ok_or_else(|| anyhow!("a comment must be provided"))?,
+ undo,
+ },
OperationName::Ready => Operation::Ready {
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
undo,
@@ -804,6 +849,25 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
.map(patch::RevisionId::from);
review::run(patch_id, revision_id, opts, &profile, &repository)?;
}
+ Operation::Resolve {
+ ref patch_id,
+ ref review_id,
+ ref comment_id,
+ undo,
+ } => {
+ let patch = patch_id.resolve(&repository.backend)?;
+ let review = patch::ReviewId::from(
+ review_id.resolve::<radicle::cob::EntryId>(&repository.backend)?,
+ );
+ let comment = comment_id.resolve(&repository.backend)?;
+ if undo {
+ resolve::unresolve(patch, review, comment, &repository, &profile)?;
+ term::success!("Unresolved comment {comment_id}");
+ } else {
+ resolve::resolve(patch, review, comment, &repository, &profile)?;
+ term::success!("Resolved comment {comment_id}");
+ }
+ }
Operation::Edit {
patch_id,
revision_id,
diff --git a/radicle-cli/src/commands/patch/resolve.rs b/radicle-cli/src/commands/patch/resolve.rs
new file mode 100644
index 000000000..da594e7c0
--- /dev/null
+++ b/radicle-cli/src/commands/patch/resolve.rs
@@ -0,0 +1,42 @@
+use anyhow::anyhow;
+use radicle::cob::thread::CommentId;
+use radicle::patch::{self, PatchId};
+use radicle::patch::{cache::Patches as _, ReviewId};
+use radicle::storage::git::Repository;
+use radicle::Profile;
+
+use crate::terminal as term;
+
+pub fn resolve(
+ patch_id: PatchId,
+ review: ReviewId,
+ comment: CommentId,
+ repo: &Repository,
+ profile: &Profile,
+) -> anyhow::Result<()> {
+ let signer = term::signer(profile)?;
+ let mut patches = profile.patches_mut(repo)?;
+ let patch = patches
+ .get(&patch_id)?
+ .ok_or_else(|| anyhow!("Patch `{patch_id}` not found"))?;
+ let mut patch = patch::PatchMut::new(patch_id, patch, &mut patches);
+ patch.resolve_review_comment(review, comment, &signer)?;
+ Ok(())
+}
+
+pub fn unresolve(
+ patch_id: PatchId,
+ review: ReviewId,
+ comment: CommentId,
+ repo: &Repository,
+ profile: &Profile,
+) -> anyhow::Result<()> {
+ let signer = term::signer(profile)?;
+ let mut patches = profile.patches_mut(repo)?;
+ let patch = patches
+ .get(&patch_id)?
+ .ok_or_else(|| anyhow!("Patch `{patch_id}` not found"))?;
+ let mut patch = patch::PatchMut::new(patch_id, patch, &mut patches);
+ patch.unresolve_review_comment(review, comment, &signer)?;
+ Ok(())
+}
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 ba8d0a90-d6b3-4328-8bd2-e74539022414 -v /opt/radcis/ci.rad.levitte.org/cci/state/ba8d0a90-d6b3-4328-8bd2-e74539022414/s:/ba8d0a90-d6b3-4328-8bd2-e74539022414/s:ro -v /opt/radcis/ci.rad.levitte.org/cci/state/ba8d0a90-d6b3-4328-8bd2-e74539022414/w:/ba8d0a90-d6b3-4328-8bd2-e74539022414/w -w /ba8d0a90-d6b3-4328-8bd2-e74539022414/w -v /opt/radcis/ci.rad.levitte.org/.radicle:/${id}/.radicle:ro -e RAD_HOME=/${id}/.radicle rust:trixie bash /ba8d0a90-d6b3-4328-8bd2-e74539022414/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"
}