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:
1 parent
ff0fb56c67
commit
a02b555e66
1458 files changed
+10729
-21750
No files matched your search
@@ -77,9 +77,7 @@ pub fn check_dream_gates(
|
||||
DreamGate::Open { sessions }
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Dream prompt, response processing, and execution
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
use super::text_utils::{has_markdown_headers, is_no_reply};
|
||||
|
||||
@@ -318,7 +316,7 @@ pub fn process_dream_response(response: &str) -> Option<String> {
|
||||
/// Minimum age (in seconds) a session file must have before cleanup will
|
||||
/// delete it. Protects against removing files that a concurrent session
|
||||
/// may still be actively appending to.
|
||||
const CLEANUP_RECENCY_GUARD_SECS: u64 = 300; // 5 minutes
|
||||
const CLEANUP_RECENCY_GUARD_SECS: u64 = 300;
|
||||
|
||||
/// Delete session log files whose stems were processed during dream.
|
||||
///
|
||||
@@ -701,9 +699,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// build_dream_user_message tests
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
fn write_session_content(dir: &Path, name: &str, content: &str) {
|
||||
fs::create_dir_all(dir).unwrap();
|
||||
@@ -775,9 +771,7 @@ mod tests {
|
||||
assert_eq!(msg.processed_stems, vec!["exists"]);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// process_dream_response tests
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#[test]
|
||||
fn process_empty_response_returns_none() {
|
||||
@@ -835,9 +829,7 @@ mod tests {
|
||||
assert_eq!(result, input);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// execute_dream tests
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
use super::super::storage::MemoryStorage;
|
||||
use std::path::PathBuf;
|
||||
@@ -979,9 +971,7 @@ mod tests {
|
||||
assert_eq!(memory.trim(), response);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// DREAM_SYSTEM_PROMPT sanity checks
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#[test]
|
||||
fn dream_system_prompt_has_required_content() {
|
||||
@@ -1024,9 +1014,7 @@ mod tests {
|
||||
assert_eq!(normalized, input);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Session cleanup tests
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#[test]
|
||||
fn cleanup_deletes_processed_sessions_on_completed() {
|
||||
@@ -1240,7 +1228,8 @@ mod tests {
|
||||
|
||||
// Create 5 session files. The first 2 will fill past the cap;
|
||||
// sessions 3-5 should survive cleanup.
|
||||
let half_cap = MAX_DREAM_INPUT_CHARS / 2 + 500; // slightly over half
|
||||
// slightly over half
|
||||
let half_cap = MAX_DREAM_INPUT_CHARS / 2 + 500;
|
||||
write_old_session_content(&sessions, "aaa-first", &"a".repeat(half_cap));
|
||||
write_old_session_content(&sessions, "bbb-second", &"b".repeat(half_cap));
|
||||
write_old_session_content(&sessions, "ccc-third", "small content 3");
|
||||
@@ -1316,9 +1305,7 @@ mod tests {
|
||||
assert!(!sessions.join("exists.md").exists());
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// is_scaffold_template tests
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#[test]
|
||||
fn scaffold_detects_old_workspace_template() {
|
||||
@@ -1398,9 +1385,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// build_dream_user_message with existing memory tests
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#[test]
|
||||
fn build_message_prepends_existing_memory() {
|
||||
|
||||
Reference in new issue
Block a user