summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
commite757979f1a2afdbe7146066345bb9acd19d3b151 (patch)
tree30d5f5fbccd25ea7bf01c5202684af463b74e7d3 /src/main.rs
parent94c318f13264bb3c00a9f3057ba2e1aafb57c9e4 (diff)
downloadaur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.tar.gz
aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.zip
comments: say why, not what
Every module-level `//!` header is gone, and the comments that remained either re-explained the line below them or had grown into paragraphs. Density went from one comment line per 6.7 lines of code to one per 10. 827 insertions against 2194 deletions across 86 files. What survived: the invariants (I1-I12), the design cross-references into DESIGN.md, and the notes recording a bug that was found and fixed — those are the comments that carry weight, because they answer a question the code cannot answer about itself. What did not: restating a function signature in prose, and narration of the statement underneath.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/main.rs b/src/main.rs
index ccd20a2..edfcd44 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,11 +1,3 @@
-//! `aur-build` — the operator's command line (§7.2, §12).
-//!
-//! P0 ships the approval path as a CLI subcommand: the same code the web UI
-//! will call in P2, so the invariant "we build exactly what was displayed, or
-//! nothing" is enforced here too. `approve` renders the review, prints it, and
-//! then approves with the hashes it just displayed — it cannot approve a diff it
-//! did not show you.
-
use std::path::PathBuf;
use clap::{Parser, Subcommand};
@@ -119,10 +111,9 @@ enum Cmd {
fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
// `init` is the only command that runs before a config exists. For everything
- // else a missing config is the error it sounds like, not a reason to invent
- // one: the old unconditional fallback turned a typo'd `--root` into a fresh
- // empty server at the wrong path, whose commands then "succeeded" against a
- // database with no subscriptions and no releases in it.
+ // else a missing config is an error, not a reason to invent one: the old
+ // unconditional fallback turned a typo'd `--root` into a fresh empty server
+ // at the wrong path.
let root = cli.root.clone().unwrap_or_else(|| Config::default().root);
let cfg = if matches!(cli.cmd, Cmd::Init { .. }) {
Config::load(&root).unwrap_or_else(|_| Config {
@@ -156,9 +147,8 @@ fn main() -> anyhow::Result<()> {
let stop = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false));
aur_build::watch::scheduler::spawn_scheduler(std::sync::Arc::new(cfg.clone()), db.clone(), stop.clone());
let _server = aur_build::http::spawn(cfg.clone(), db.clone())?;
- // The dispatcher reaps expired leases before its first claim, so a
- // restart recovers whatever a crash left leased without any special
- // startup routine (§8.2).
+ // The dispatcher reaps expired leases before its first claim, so a restart
+ // recovers whatever a crash left leased (§8.2).
let _pool = aur_build::pipeline::dispatch::Pool::spawn(std::sync::Arc::new(cfg.clone()), db.clone());
println!("serving on http://{} — ctrl-c to stop", cfg.bind);
// Single process, thread per connection: the main thread has nothing to
@@ -259,7 +249,7 @@ fn main() -> anyhow::Result<()> {
}
Cmd::Approve { candidate, yes, note, identity, diff: diff_arg } => {
let c = need_candidate(&ctx.db, candidate)?;
- // Render first, always. The hashes we send are the hashes of what we
+ // Render first, always: the hashes we send are the hashes of what we
// just rendered, unless the operator explicitly names older ones.
let (text, digest) = diff::render_current(&ctx.db, &cfg, &c)?;
candidates::set_diff_digest(&ctx.db, c.id, &digest)?;