docs(comments): rewrite comments across all crates to the guidelines

Sweep every first-party crate source (1956 .rs files) to the project comment
guidelines: delete redundant restatements, decorative banners, change
narration, and end-of-line comments; keep and tighten the crucial ones
(invariants, bug rationale, SAFETY blocks, ported-source attribution).

No functional code changed. Every edit is proven comment-only against the
prior tree by a comment-stripping lexer (string/char/raw-string aware) plus a
separate doctest-fence check. Where removing a comment made rustfmt or clippy
want to re-lay-out adjacent code, the minimal triggering comment is restored so
code tokens stay byte-identical.

Gates green: cargo fmt --all --check (0 diffs), cargo check and cargo clippy
--workspace --all-targets (0 warnings).

Adds scripts/check_codegen_comment_guidelines.py — the enforcement gate for
these guidelines (flags banners, end-of-line comments, change narration, and
commented-out code).
This commit is contained in:
2026-07-23 16:55:39 -04:00
parent ff0fb56c67
commit a02b555e66
1458 changed files with 10729 additions and 21750 deletions
@@ -34,7 +34,8 @@ const CANONICAL_FIXTURES: &[&str] = &[
#[derive(Debug, Deserialize)]
struct Fixture {
name: String,
#[allow(dead_code)] // human-readable; surfaced only on assertion failure
// human-readable; surfaced only on assertion failure
#[allow(dead_code)]
description: String,
turns: Vec<Turn>,
}
@@ -42,7 +43,8 @@ struct Fixture {
#[derive(Debug, Deserialize)]
#[serde(tag = "kind", rename_all = "snake_case")]
enum Turn {
#[allow(dead_code)] // user turns are walked but never gate-evaluated
// user turns are walked but never gate-evaluated
#[allow(dead_code)]
User(UserTurn),
Assistant(AssistantTurn),
}
@@ -57,7 +59,8 @@ struct UserTurn {
#[derive(Debug, Deserialize)]
struct AssistantTurn {
turn_index: usize,
#[allow(dead_code)] // present for fixture clarity; the gate does not consult it
// present for fixture clarity; the gate does not consult it
#[allow(dead_code)]
tool_calls_emitted: Vec<serde_json::Value>,
todo_state_after_turn: Vec<TodoSnapshot>,
backing_task_count: usize,
@@ -70,7 +73,8 @@ struct AssistantTurn {
#[derive(Debug, Deserialize)]
struct TodoSnapshot {
#[allow(dead_code)] // id is preserved for fixture readability
// id is preserved for fixture readability
#[allow(dead_code)]
id: String,
status: TodoStatus,
content: String,