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:
ZacharyZhang-NY committed 2026-07-23 16:55:39 -04:00
1 parent ff0fb56c67
commit a02b555e66
1458 files changed
+10729 -21750

No files matched your search

@@ -42,8 +42,8 @@ pub struct BeforeTurnPayload {
/// Whether the session is in YOLO / auto-approve mode.
#[serde(default)]
pub yolo_mode: bool,
// ── Extended fields (workspace mirrors these into `events.jsonl`);
// all `#[serde(default)]` for old-shell / old-workspace interop. ──
// Extended fields (workspace mirrors these into `events.jsonl`);
// all `#[serde(default)]` for old shell / old workspace interop.
/// Mirrors `Event::TurnStarted::conversation_message_count`.
#[serde(default)]
pub conversation_message_count: usize,
@@ -86,7 +86,6 @@ impl Default for BeforeTurnPayload {
pub struct AfterTurnPayload {
/// Same turn counter as the preceding `before_turn`.
pub turn_number: u64,
/// High-level outcome of the turn.
pub outcome: TurnHookOutcome,
/// Wall-clock duration of the turn in milliseconds.
pub duration_ms: u64,
@@ -128,7 +127,6 @@ pub enum TurnHookOutcome {
Completed,
/// Turn was cancelled by the user (Ctrl+C / abort).
Cancelled,
/// Turn ended due to an error.
Error,
}
@@ -152,9 +150,7 @@ pub enum TurnHookRequest {
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum InjectionRole {
/// Append as a system turn.
System,
/// Append as a developer turn.
Developer,
/// Append as a user turn (e.g. a `<system-reminder>`-wrapped message).
User,
@@ -164,9 +160,7 @@ pub enum InjectionRole {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct HookInjection {
/// Role to append the content as.
pub role: InjectionRole,
/// Verbatim turn content.
pub content: String,
}
@@ -188,10 +182,8 @@ pub enum TurnControl {
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct HookReply {
/// Turns to append before the next sampling step, in order.
#[serde(default)]
pub injections: Vec<HookInjection>,
/// Optional loop-control override.
#[serde(default)]
pub control: TurnControl,
/// Artifact-handling ack for a [`TurnHookRequest::After`] request; `None`