From 9ba653dc1618a5df367e332943e1b8fcbee36570 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 25 Jun 2026 13:10:29 +0200 Subject: [PATCH] misc: persist Error-message style in CONTRIBUTING.md and AGENTS.md In [0] we agreed on the current format. [0] https://github.com/cloud-hypervisor/cloud-hypervisor/pull/7066 On-behalf-of: SAP philipp.schuster@sap.com Signed-off-by: Philipp Schuster --- AGENTS.md | 5 +++++ CONTRIBUTING.md | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index fc164c081..b5a62a2b3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -31,6 +31,11 @@ reviewable, and compatible with the project's normal engineering constraints. migration implications. - Do not invent APIs, behavior, or requirements. If something is uncertain, state the uncertainty and proceed only with minimal, explicit assumptions. +- For `thiserror`-style errors, start messages with a capital letter and keep + the outer `Display` text short. Put all non-`#[source]` attributes in the + message to improve helpfulness, but do not repeat a `#[source]` value + inline: Cloud Hypervisor prints the full error chain, so only include the + concrete failure text directly when there is no source to report. ### Safety and Domain Notes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88a3627bc..5d3b70b0e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,6 +44,12 @@ state changes that matter in production; use `warn!` or `error!` only for abnormal conditions. Keep `debug!` for focused diagnostics. Please find more information in [`docs/logging.md`](docs/logging.md). +Error messages should be sentence-style: start with a capital letter and stay +concise. For `thiserror`-style errors, put all non-`#[source]` attributes +(if they provide clear value) in the outer `Display` text to improve helpfulness, +but do not repeat a `#[source]` value there because Cloud Hypervisor prints the +full chain elsewhere. + [Rust Style]: https://github.com/rust-lang/rust/tree/HEAD/src/doc/style-guide/src ## Basic Checks