rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 heartwood1c46f19592d041919f18736cb45ec6046d7d3b00
{
"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:z6MktaNvN1KVFMkSRAiN4qK5yvX1zuEEaseeX5sffhzPZRZW",
"did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM",
"did:key:z6MkgFq6z5fkF2hioLLSNu1zP2qEL1aHXHZzGH1FLFGAnBGz",
"did:key:z6MkkPvBfjP4bQmco5Dm7UGsX2ruDBieEHi8n9DVJWX5sTEz"
]
},
"action": "Created",
"patch": {
"id": "ed63069f42ad77960b4c5abdf74bf5fe4875ec9b",
"author": {
"id": "did:key:z6Mko5mivMvNtheBHB67cSJeMG6BbCn7Xk6MKY9VegkAbgMH",
"alias": "Derick"
},
"title": "node: Fix `main` to print early errors",
"state": {
"status": "merged",
"conflicts": []
},
"before": "a04381f4e5fdff04a2f9bfa15a16d2addbcbe8a7",
"after": "1c46f19592d041919f18736cb45ec6046d7d3b00",
"commits": [
"1c46f19592d041919f18736cb45ec6046d7d3b00"
],
"target": "6cfed884bf37cba1e0d8e97fa8b0e94df4a04b1f",
"labels": [],
"assignees": [],
"revisions": [
{
"id": "ed63069f42ad77960b4c5abdf74bf5fe4875ec9b",
"author": {
"id": "did:key:z6Mko5mivMvNtheBHB67cSJeMG6BbCn7Xk6MKY9VegkAbgMH",
"alias": "Derick"
},
"description": "Otherwise, previously, when an error occurred before `logger::init()`\nthen no message about the error would be shown, because `log` ignores\nmessages generated before the logger is initialized. E.g. when\n`$RAD_HOME/config.json` is missing, invoking `radicle-node`\ndirectly (i.e. not via `rad node start`) would fail without any\nexplanation being logged nor printed. There also are some other\npossible errors that can occur before `logger::init()` where no message\nwould've been shown.\n\nThe fix is to detect if the logger is enabled, which it won't be when it\nhasn't been initialized, and if not then fallback to printing directly\nto stderr.\n\nTo show the lower-level source of an error, like previously, and to\navoid now needing more conditionals with more format strings for all\npossibilities of `err.source().is_some()` and `log_enabled!()`, the\n\"alternate\" form (`{:#}`) of formatting `anyhow::Error` is now used.\nThis also introduces a change in behavior such that the entire chain of\nsource errors will now be shown, instead of only the first in the chain,\nwhich seems more desirable for errors that cause fatal exiting of\n`radicle-node`. Note that this form still formats as only a single\nline, like previously.\n\nThe prefix \"Error: \" is used for the new fallback printing, because in\nthis case it's not a log message (though, it might be written to the log\nfile), and because that prefix is consistent with how Rust errors that\ncause immediate termination are usually printed directly. For the\nopposite case, the \"Fatal: \" prefix serves to distinguish it as being\nfatal among the many other various log messages.\n\nWhile it would be possible to instead return `anyhow::Result<()>` from\n`main`, to achieve the printing of early errors (and exiting with\nfailure code), that would cause undesirable duplication, for non-early\nerrors that occur after `logger::init()`, of the error message where it\nwould be written to both the log file and to stderr which often is the\nsame as the log file.\n\nSigned-off-by: Derick Eddington <kcired@pm.me>",
"base": "123f7eb6bbb3cb3f39257b325b2256ecd415fbe4",
"oid": "0c0647b3350920996238cac4cd5c51235d9d3903",
"timestamp": 1721352183
},
{
"id": "4243818dbb984c970a29a2db698f99384d9a30cf",
"author": {
"id": "did:key:z6Mko5mivMvNtheBHB67cSJeMG6BbCn7Xk6MKY9VegkAbgMH",
"alias": "Derick"
},
"description": "",
"base": "a04381f4e5fdff04a2f9bfa15a16d2addbcbe8a7",
"oid": "1c46f19592d041919f18736cb45ec6046d7d3b00",
"timestamp": 1721677411
}
]
}
}
{
"response": "triggered",
"run_id": {
"id": "5d79bf4c-cf58-4b51-ae78-f90f47ee2f51"
},
"info_url": "https://cci.rad.levitte.org//5d79bf4c-cf58-4b51-ae78-f90f47ee2f51.html"
}
Started at: 2025-10-21 19:33:41.110425+02:00
Commands:
$ rad clone rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 .
✓ Creating checkout in ./...
✓ Remote cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT added
✓ Remote-tracking branch cloudhead@z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT/master created for z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT
✓ Remote cloudhead@z6MktaNvN1KVFMkSRAiN4qK5yvX1zuEEaseeX5sffhzPZRZW added
✓ Remote-tracking branch cloudhead@z6MktaNvN1KVFMkSRAiN4qK5yvX1zuEEaseeX5sffhzPZRZW/master created for z6MktaNvN1KVFMkSRAiN4qK5yvX1zuEEaseeX5sffhzPZRZW
✓ Remote fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM added
✓ Remote-tracking branch fintohaps@z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM/master created for z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM
✓ Remote erikli@z6MkgFq6z5fkF2hioLLSNu1zP2qEL1aHXHZzGH1FLFGAnBGz added
✓ Remote-tracking branch erikli@z6MkgFq6z5fkF2hioLLSNu1zP2qEL1aHXHZzGH1FLFGAnBGz/master created for z6MkgFq6z5fkF2hioLLSNu1zP2qEL1aHXHZzGH1FLFGAnBGz
✓ 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/5d79bf4c-cf58-4b51-ae78-f90f47ee2f51/w/
╭────────────────────────────────────╮
│ heartwood │
│ Radicle Heartwood Protocol & Stack │
│ 125 issues · 15 patches │
╰────────────────────────────────────╯
Run `cd ./.` to go to the repository directory.
Exit code: 0
$ rad patch checkout ed63069f42ad77960b4c5abdf74bf5fe4875ec9b
✓ Switched to branch patch/ed63069 at revision 4243818
✓ Branch patch/ed63069 setup to track rad/patches/ed63069f42ad77960b4c5abdf74bf5fe4875ec9b
Exit code: 0
$ git config advice.detachedHead false
Exit code: 0
$ git checkout 1c46f19592d041919f18736cb45ec6046d7d3b00
HEAD is now at 1c46f195 node: Fix `main` to print early errors
Exit code: 0
$ git show 1c46f19592d041919f18736cb45ec6046d7d3b00
commit 1c46f19592d041919f18736cb45ec6046d7d3b00
Author: Derick Eddington <kcired@pm.me>
Date: Thu Jul 18 17:30:36 2024 -0700
node: Fix `main` to print early errors
Otherwise, previously, when an error occurred before `logger::init()`
then no message about the error would be shown, because `log` ignores
messages generated before the logger is initialized. E.g. when
`$RAD_HOME/config.json` is missing, invoking `radicle-node`
directly (i.e. not via `rad node start`) would fail without any
explanation being logged nor printed. There also are some other
possible errors that can occur before `logger::init()` where no message
would've been shown.
The fix is to detect if the logger is enabled, which it won't be when it
hasn't been initialized, and if not then fallback to printing directly
to stderr.
To show the lower-level source of an error, like previously, and to
avoid now needing more conditionals with more format strings for all
possibilities of `err.source().is_some()` and `log_enabled!()`, the
"alternate" form (`{:#}`) of formatting `anyhow::Error` is now used.
This also introduces a change in behavior such that the entire chain of
source errors will now be shown, instead of only the first in the chain,
which seems more desirable for errors that cause fatal exiting of
`radicle-node`. Note that this form still formats as only a single
line, like previously.
The prefix "Error: " is used for the new fallback printing, because in
this case it's not a log message (though, it might be written to the log
file), and because that prefix is consistent with how Rust errors that
cause immediate termination are usually printed directly. For the
opposite case, the "Fatal: " prefix serves to distinguish it as being
fatal among the many other various log messages.
While it would be possible to instead return `anyhow::Result<()>` from
`main`, to achieve the printing of early errors (and exiting with
failure code), that would cause undesirable duplication, for non-early
errors that occur after `logger::init()`, of the error message where it
would be written to both the log file and to stderr which often is the
same as the log file.
Signed-off-by: Derick Eddington <kcired@pm.me>
diff --git a/radicle-node/src/main.rs b/radicle-node/src/main.rs
index ca7b93a1..f62a9988 100644
--- a/radicle-node/src/main.rs
+++ b/radicle-node/src/main.rs
@@ -130,10 +130,10 @@ fn execute() -> anyhow::Result<()> {
fn main() {
if let Err(err) = execute() {
- if let Some(src) = err.source() {
- log::error!(target: "node", "Fatal: {err}: {src}");
+ if log::log_enabled!(target: "node", log::Level::Error) {
+ log::error!(target: "node", "Fatal: {err:#}");
} else {
- log::error!(target: "node", "Fatal: {err}");
+ eprintln!("Error: {err:#}");
}
process::exit(1);
}
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 5d79bf4c-cf58-4b51-ae78-f90f47ee2f51 -v /opt/radcis/ci.rad.levitte.org/cci/state/5d79bf4c-cf58-4b51-ae78-f90f47ee2f51/s:/5d79bf4c-cf58-4b51-ae78-f90f47ee2f51/s:ro -v /opt/radcis/ci.rad.levitte.org/cci/state/5d79bf4c-cf58-4b51-ae78-f90f47ee2f51/w:/5d79bf4c-cf58-4b51-ae78-f90f47ee2f51/w -w /5d79bf4c-cf58-4b51-ae78-f90f47ee2f51/w -v /opt/radcis/ci.rad.levitte.org/.radicle:/${id}/.radicle:ro -e RAD_HOME=/${id}/.radicle rust:bookworm bash /5d79bf4c-cf58-4b51-ae78-f90f47ee2f51/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"
}