88//! timestamp, packs into a `BTreeMap`, then calls [`build_zip`].
99//!
1010//! Public entry point is [`build_bundle`], which dispatches on the scope. Capping is in
11- //! the sibling [`super::bundle_capper`] module — Flow A enforces the cap inline, Flow B
11+ //! the sibling [`super::bundle_capper`] module. Flow A enforces the cap inline; Flow B
1212//! relies on a post-build trim from the auto-dispatcher.
1313
1414use super :: tail_walker;
@@ -36,7 +36,7 @@ const SAMPLE_LAST_LINES: usize = 20;
3636const FLOW_B_PRE_ERROR_WINDOW : chrono:: Duration = chrono:: Duration :: minutes ( 30 ) ;
3737
3838/// One log file selected for inclusion: redacted lines plus the source file's mtime
39- /// (used to date the zip entry — without an explicit mtime, `zip` writes 1980-01-01).
39+ /// (used to date the zip entry; without an explicit mtime, `zip` writes 1980-01-01).
4040#[ derive( Debug , Clone ) ]
4141pub ( super ) struct PreparedFile {
4242 pub ( super ) lines : Vec < String > ,
@@ -46,7 +46,7 @@ pub(super) struct PreparedFile {
4646/// Build an error report bundle in memory. No network. No disk writes (except reading logs).
4747///
4848/// `user_note` is trimmed and dropped if empty. Callers are expected to cap its length
49- /// (the commands layer enforces 100 000 chars) — we store it verbatim.
49+ /// (the commands layer enforces 100 000 chars); we store it verbatim.
5050///
5151/// `scope` controls which log content makes it into the bundle. See [`BundleScope`].
5252///
@@ -202,7 +202,7 @@ pub(super) fn build_bundle_streaming(
202202
203203 if walk. lines . is_empty ( ) {
204204 // If we bailed at the cutoff with no lines, older rotations would be
205- // older still — stop walking entirely.
205+ // older still. Stop walking entirely.
206206 if walk. hit_cutoff {
207207 break ;
208208 }
@@ -241,7 +241,7 @@ pub(super) fn build_bundle_streaming(
241241
242242 // Mid-file cap check. The deflater holds an internal buffer of up to ~64 KB
243243 // that hasn't been flushed to the cursor yet, so the counter is a lower
244- // bound on the eventual on-disk size — there 's a small overshoot risk on
244+ // bound on the eventual on-disk size. There 's a small overshoot risk on
245245 // the order of one chunk + the central directory tail (~few hundred bytes
246246 // per entry). Both are well inside the cap's headroom.
247247 let bytes_so_far = counter. load ( std:: sync:: atomic:: Ordering :: Relaxed ) as usize ;
@@ -279,7 +279,7 @@ pub(super) fn build_bundle_streaming(
279279/// `Write::write` call. Lets the streaming zip pipeline poll the running compressed
280280/// byte count without taking an unsafe `get_mut()` borrow on the `ZipWriter`.
281281///
282- /// The counter measures bytes the `zip` crate emitted to the cursor — i.e. compressed
282+ /// The counter measures bytes the `zip` crate emitted to the cursor, i.e. compressed
283283/// payload + per-entry headers up to the last deflate flush. The crate's internal
284284/// deflate buffer (up to ~64 KB) lags behind, so callers should treat the counter as a
285285/// lower bound on the final size and budget conservatively.
@@ -331,7 +331,7 @@ fn build_bundle_legacy_window(
331331 now_system : SystemTime ,
332332 salt : & [ u8 ] ,
333333) -> Result < BuiltBundle , String > {
334- // BTreeMap so zip order is deterministic — same inputs, same bytes out. Matters for
334+ // BTreeMap so zip order is deterministic: same inputs, same bytes out. Matters for
335335 // the preview hash and for byte-level tests.
336336 let mut prepared: BTreeMap < String , PreparedFile > = BTreeMap :: new ( ) ;
337337 let mut total_redacted_lines: usize = 0 ;
@@ -386,7 +386,7 @@ fn build_bundle_legacy_window(
386386///
387387/// Returns `None` if the file can't be opened or its mtime can't be read; returns
388388/// `Some((lines, mtime))` otherwise. `lines` may be empty if the entire file was
389- /// outside the scope window — callers drop empty results so the bundle doesn't ship
389+ /// outside the scope window. Callers drop empty results so the bundle doesn't ship
390390/// empty `logs/<name>` entries.
391391pub ( super ) fn load_and_filter_log_file (
392392 path : & Path ,
@@ -409,7 +409,7 @@ pub(super) fn load_and_filter_log_file(
409409 let mtime = metadata. modified ( ) . unwrap_or ( now_system) ;
410410
411411 // File-level filter. If a file's mtime is older than the lower bound of the scope's
412- // window, skip it entirely — its newest line is older than what we want.
412+ // window, skip it entirely: its newest line is older than what we want.
413413 let lower_bound = match scope {
414414 BundleScope :: Recent { window } => {
415415 now_utc - chrono:: Duration :: from_std ( window) . unwrap_or ( chrono:: Duration :: hours ( 1 ) )
@@ -436,7 +436,7 @@ pub(super) fn load_and_filter_log_file(
436436
437437 // Per-line filter for the Flow B window: drop lines whose leading ISO-8601 stamp
438438 // is older than `lower_bound`. Lines without a parseable stamp pass through (the
439- // log line wasn't written by us — we keep it as-is rather than risk dropping
439+ // log line wasn't written by us, so we keep it as-is rather than risk dropping
440440 // something useful).
441441 let mut lines: Vec < String > = Vec :: new ( ) ;
442442 for line in reader. lines ( ) . map_while ( Result :: ok) {
@@ -454,7 +454,7 @@ pub(super) fn load_and_filter_log_file(
454454
455455/// Convert a [`SystemTime`] into a [`zip::DateTime`] (the format the zip crate stores
456456/// per entry). On parse failure (system clock before 1980, post-2107) returns the zip
457- /// crate's default — not a hard error; the bundle still ships, just with a placeholder
457+ /// crate's default ( not a hard error). The bundle still ships, just with a placeholder
458458/// mtime on that one entry.
459459pub ( super ) fn zip_dt ( time : SystemTime ) -> ZipDateTime {
460460 let local: DateTime < chrono:: Local > = time. into ( ) ;
@@ -473,8 +473,8 @@ pub(super) fn zip_dt(time: SystemTime) -> ZipDateTime {
473473///
474474/// Each entry's mtime is set explicitly: `manifest.json` uses `now`, log entries use
475475/// the source file's mtime. Without this, the `zip` crate writes 1980-01-01 00:00 for
476- /// every entry (DOS epoch), which makes downstream tooling — and humans inspecting the
477- /// archive — unable to tell when anything was actually captured.
476+ /// every entry (DOS epoch), which makes downstream tooling and humans inspecting the
477+ /// archive unable to tell when anything was actually captured.
478478///
479479/// Split out from [`build_bundle`] so tests can feed synthetic inputs without needing
480480/// a Tauri app handle or a real log directory.
0 commit comments