From d59bfb899f301bdc9053a5376357978a85807335 Mon Sep 17 00:00:00 2001 From: damocles Date: Sun, 31 May 2026 16:19:25 +0200 Subject: [PATCH] hive-forge: drop boilerplate # Errors from pure-GET verbs (mara on #827, option A) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mara: 'those comments seem very redundant'. true — the 16 pure-GET verbs all got the same 'transport error + stdout I/O' boilerplate, which just restates the Result<()> contract that's trivially derivable from the type. dropped # Errors from: assign, branches, close, comment_show, comments, diff, issue, labels, lint, list, milestone, pr, pr_reviews, subscription, timeline, tree_sha, view (17 files). kept on the 7 verbs that have a non-Forgejo failure surface worth documenting: - comment, comment_edit, issue_create, issue_edit — body input I/O via --body-file / stdin - pr_create — body input + --push shellout to git - attach::run_issue, attach::run_comment — explicit bail! on missing file net: 23 verbs touched in the original PR → 17 trimmed back to no-doc, 6 kept (with the 7th call being attach::run_comment in the same file). 38 tests still pass. --- hive-forge/src/verbs/assign.rs | 5 ----- hive-forge/src/verbs/branches.rs | 5 ----- hive-forge/src/verbs/close.rs | 5 ----- hive-forge/src/verbs/comment_show.rs | 5 ----- hive-forge/src/verbs/comments.rs | 5 ----- hive-forge/src/verbs/diff.rs | 5 ----- hive-forge/src/verbs/issue.rs | 5 ----- hive-forge/src/verbs/labels.rs | 5 ----- hive-forge/src/verbs/lint.rs | 7 ------- hive-forge/src/verbs/list.rs | 5 ----- hive-forge/src/verbs/milestone.rs | 5 ----- hive-forge/src/verbs/pr.rs | 5 ----- hive-forge/src/verbs/pr_reviews.rs | 5 ----- hive-forge/src/verbs/subscription.rs | 5 ----- hive-forge/src/verbs/timeline.rs | 5 ----- hive-forge/src/verbs/tree_sha.rs | 5 ----- hive-forge/src/verbs/view.rs | 5 ----- 17 files changed, 87 deletions(-) diff --git a/hive-forge/src/verbs/assign.rs b/hive-forge/src/verbs/assign.rs index 8b7044db..5c9ed713 100644 --- a/hive-forge/src/verbs/assign.rs +++ b/hive-forge/src/verbs/assign.rs @@ -21,11 +21,6 @@ pub struct Args { remove: bool, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let current = client.get_json(&format!("/repos/{repo}/issues/{}", args.number))?; diff --git a/hive-forge/src/verbs/branches.rs b/hive-forge/src/verbs/branches.rs index 8f590fae..287f5024 100644 --- a/hive-forge/src/verbs/branches.rs +++ b/hive-forge/src/verbs/branches.rs @@ -12,11 +12,6 @@ pub struct Args { pattern: Option, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let v = client.get_json(&format!("/repos/{repo}/branches?limit=100"))?; diff --git a/hive-forge/src/verbs/close.rs b/hive-forge/src/verbs/close.rs index 58fb2037..0d01ce27 100644 --- a/hive-forge/src/verbs/close.rs +++ b/hive-forge/src/verbs/close.rs @@ -13,11 +13,6 @@ pub struct Args { number: u64, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let resp = client.patch_json( diff --git a/hive-forge/src/verbs/comment_show.rs b/hive-forge/src/verbs/comment_show.rs index a45ea2e4..65e6e8bb 100644 --- a/hive-forge/src/verbs/comment_show.rs +++ b/hive-forge/src/verbs/comment_show.rs @@ -14,11 +14,6 @@ pub struct Args { id: u64, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let v = client.get_json(&format!("/repos/{repo}/issues/comments/{}", args.id))?; diff --git a/hive-forge/src/verbs/comments.rs b/hive-forge/src/verbs/comments.rs index 24eff13d..f27e3047 100644 --- a/hive-forge/src/verbs/comments.rs +++ b/hive-forge/src/verbs/comments.rs @@ -45,11 +45,6 @@ pub struct Args { tail: Option, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let comments = match args.tail { diff --git a/hive-forge/src/verbs/diff.rs b/hive-forge/src/verbs/diff.rs index 8b72ffe0..066e0dfc 100644 --- a/hive-forge/src/verbs/diff.rs +++ b/hive-forge/src/verbs/diff.rs @@ -30,11 +30,6 @@ pub struct Args { full: bool, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let diff = client.get_text(&format!("/repos/{repo}/pulls/{}.diff", args.number), "text/plain")?; diff --git a/hive-forge/src/verbs/issue.rs b/hive-forge/src/verbs/issue.rs index 905ab817..fdca71db 100644 --- a/hive-forge/src/verbs/issue.rs +++ b/hive-forge/src/verbs/issue.rs @@ -13,11 +13,6 @@ pub struct Args { number: u64, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let v = client.get_json(&format!("/repos/{repo}/issues/{}", args.number))?; diff --git a/hive-forge/src/verbs/labels.rs b/hive-forge/src/verbs/labels.rs index da03212d..a0346750 100644 --- a/hive-forge/src/verbs/labels.rs +++ b/hive-forge/src/verbs/labels.rs @@ -32,11 +32,6 @@ enum Action { }, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); match args.action.unwrap_or(Action::List) { diff --git a/hive-forge/src/verbs/lint.rs b/hive-forge/src/verbs/lint.rs index b2ed399c..af24ffac 100644 --- a/hive-forge/src/verbs/lint.rs +++ b/hive-forge/src/verbs/lint.rs @@ -116,13 +116,6 @@ struct AssignmentsArgs { user: Option, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. Subcommand -/// dispatches go through the same per-query helpers and inherit -/// the same surfaces. pub fn run(client: &Client, args: Args) -> Result<()> { match args.sub { Sub::Unassigned(a) => run_unassigned(client, a), diff --git a/hive-forge/src/verbs/list.rs b/hive-forge/src/verbs/list.rs index 0f96053b..605858f9 100644 --- a/hive-forge/src/verbs/list.rs +++ b/hive-forge/src/verbs/list.rs @@ -86,11 +86,6 @@ pub struct Args { limit: u64, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let mut path = format!( diff --git a/hive-forge/src/verbs/milestone.rs b/hive-forge/src/verbs/milestone.rs index b476b711..5ce9000a 100644 --- a/hive-forge/src/verbs/milestone.rs +++ b/hive-forge/src/verbs/milestone.rs @@ -37,11 +37,6 @@ enum Action { }, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); match args.action.unwrap_or(Action::List) { diff --git a/hive-forge/src/verbs/pr.rs b/hive-forge/src/verbs/pr.rs index 282041f6..a3e101af 100644 --- a/hive-forge/src/verbs/pr.rs +++ b/hive-forge/src/verbs/pr.rs @@ -13,11 +13,6 @@ pub struct Args { number: u64, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let v = client.get_json(&format!("/repos/{repo}/pulls/{}", args.number))?; diff --git a/hive-forge/src/verbs/pr_reviews.rs b/hive-forge/src/verbs/pr_reviews.rs index cb9f8387..dbf95772 100644 --- a/hive-forge/src/verbs/pr_reviews.rs +++ b/hive-forge/src/verbs/pr_reviews.rs @@ -13,11 +13,6 @@ pub struct Args { number: u64, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let v = client.get_json(&format!("/repos/{repo}/pulls/{}/reviews", args.number))?; diff --git a/hive-forge/src/verbs/subscription.rs b/hive-forge/src/verbs/subscription.rs index 08016d13..8fc16d63 100644 --- a/hive-forge/src/verbs/subscription.rs +++ b/hive-forge/src/verbs/subscription.rs @@ -21,11 +21,6 @@ pub struct Args { unwatch: bool, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); if args.unwatch { diff --git a/hive-forge/src/verbs/timeline.rs b/hive-forge/src/verbs/timeline.rs index d29bed53..52c35f1e 100644 --- a/hive-forge/src/verbs/timeline.rs +++ b/hive-forge/src/verbs/timeline.rs @@ -32,11 +32,6 @@ pub struct Args { limit: u64, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let v = client.get_json(&format!( diff --git a/hive-forge/src/verbs/tree_sha.rs b/hive-forge/src/verbs/tree_sha.rs index 29fd98e6..e2599c9d 100644 --- a/hive-forge/src/verbs/tree_sha.rs +++ b/hive-forge/src/verbs/tree_sha.rs @@ -13,11 +13,6 @@ pub struct Args { reference: String, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); // Try branch first; the bash helper silently treats failure as diff --git a/hive-forge/src/verbs/view.rs b/hive-forge/src/verbs/view.rs index 53e0719c..01494cdc 100644 --- a/hive-forge/src/verbs/view.rs +++ b/hive-forge/src/verbs/view.rs @@ -13,11 +13,6 @@ pub struct Args { number: u64, } -/// # Errors -/// -/// Propagates any transport error from the Forgejo REST call -/// (network unreachable, 4xx/5xx response, token missing/invalid) -/// and any I/O error from writing the response to stdout. pub fn run(client: &Client, args: Args) -> Result<()> { let repo = client.repo(); let issue = client.get_json(&format!("/repos/{repo}/issues/{}", args.number))?;