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
@@ -70,8 +70,7 @@ pub struct ChunkedCompactionOutput {
|
||||
/// attachment refs). `conversation_id` / `response_id` are threaded
|
||||
/// through for log correlation only.
|
||||
///
|
||||
/// Observer events (the Kigi chat observer maps them to the
|
||||
/// pre-unification metrics):
|
||||
/// Observer events:
|
||||
/// - [`InterCompactionObserver::on_recompaction`] when prior-compaction
|
||||
/// summary items are found.
|
||||
/// - [`InterCompactionObserver::on_chunk_count`] — chunk count after
|
||||
@@ -111,7 +110,6 @@ pub async fn sample_compaction_chunked<T: CompactionItemBuilder + Send + Sync>(
|
||||
"[InterCompaction] starting chunked compaction"
|
||||
);
|
||||
|
||||
// Step 1 — filter.
|
||||
let filtered = filter_turns_for_inter_compaction(turns);
|
||||
info!(
|
||||
conversation_id = %conversation_id,
|
||||
@@ -127,14 +125,13 @@ pub async fn sample_compaction_chunked<T: CompactionItemBuilder + Send + Sync>(
|
||||
)));
|
||||
}
|
||||
|
||||
// Step 2 — split prior `<kigi_user_queries>` out of every prior
|
||||
// compaction summary item. The LLM never sees them (it would re-emit
|
||||
// them verbatim and snowball across rounds); they are reattached to
|
||||
// the final summary via `assemble_user_queries_preamble`. Shared with
|
||||
// intra-compaction's `History` target.
|
||||
// Split prior `<kigi_user_queries>` out of every prior compaction summary.
|
||||
// The LLM never sees them (it would re-emit them and snowball across
|
||||
// rounds); they are reattached via `assemble_user_queries_preamble`.
|
||||
// Shared with intra-compaction's `History` target.
|
||||
let separated = separate_prior_user_queries(&filtered);
|
||||
|
||||
// Step 3 — chunk + flush over the LLM-safe item list.
|
||||
// Chunk + flush over the LLM-safe item list.
|
||||
let mut compactable: Vec<T> = Vec::new();
|
||||
let mut chunk_tokens: u32 = 0;
|
||||
let mut chunk_outputs: Vec<LlmCompactionOutput> = Vec::new();
|
||||
@@ -193,7 +190,7 @@ pub async fn sample_compaction_chunked<T: CompactionItemBuilder + Send + Sync>(
|
||||
);
|
||||
}
|
||||
|
||||
// Step 4a — combine summaries.
|
||||
// Combine summaries.
|
||||
let preamble =
|
||||
assemble_user_queries_preamble(separated.prior_user_queries, current_user_queries);
|
||||
let mut combined = preamble;
|
||||
@@ -203,14 +200,11 @@ pub async fn sample_compaction_chunked<T: CompactionItemBuilder + Send + Sync>(
|
||||
combined.push_str("\n</chunk_summary>\n\n");
|
||||
}
|
||||
|
||||
// Step 4b — combine thinking-channel output.
|
||||
let mut combined_analysis = String::new();
|
||||
for (i, output) in chunk_outputs.iter().enumerate() {
|
||||
combined_analysis.push_str(&wrap_chunk_analysis(i, &output.thinking));
|
||||
}
|
||||
|
||||
// Record chunk count after assembly so dashboards see the same timing
|
||||
// they saw pre-unification (where this lived inside DnC).
|
||||
observer.on_chunk_count(chunk_outputs.len());
|
||||
|
||||
info!(
|
||||
|
||||
@@ -16,13 +16,11 @@ use crate::history::types::CompactionStrategy;
|
||||
pub struct InterCompactionConfig {
|
||||
/// The agent/scheduler name to use for the compaction model.
|
||||
///
|
||||
/// NOTE: model routing is host policy — kept here only because
|
||||
/// service configs deserialize this struct as-is; slated to move to the
|
||||
/// per-harness policy split in a later phase.
|
||||
/// Model routing is host policy — kept here because service configs
|
||||
/// deserialize this struct as-is.
|
||||
pub compaction_model_name: String,
|
||||
/// End-to-end timeout for the compaction sampling in seconds.
|
||||
pub sampling_timeout_secs: u64,
|
||||
/// Which compaction strategy to use.
|
||||
pub compaction_strategy: CompactionStrategy,
|
||||
/// [DivideAndConquer] Max tokens per chunk before sending to the LLM.
|
||||
/// (Basic strategy ignores this and emits a single chunk.)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
/// Receives inter-compaction pipeline events. All methods default to no-ops.
|
||||
pub trait InterCompactionObserver: Send + Sync {
|
||||
/// A prior compaction summary was found in the input (re-compaction).
|
||||
/// `strategy` is the stable label from `CompactionStrategy::label()`.
|
||||
@@ -15,7 +14,6 @@ pub trait InterCompactionObserver: Send + Sync {
|
||||
/// One chunk's LLM call finished (success or error).
|
||||
fn on_chunk_sampled(&self, _success: bool, _elapsed: Duration) {}
|
||||
|
||||
/// The whole pipeline finished assembling `num_chunks` chunk summaries.
|
||||
fn on_chunk_count(&self, _num_chunks: usize) {}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user