fix(source): rename --microseconds flag to --milliseconds#75
Conversation
The flag generates 1000 sub-second variants per timestamp (millisecond granularity), not 1,000,000 (microsecond). The name was misleading.
Review Summary by QodoRename --microseconds flag to --milliseconds for accuracy
WalkthroughsDescription• Rename --microseconds flag to --milliseconds for accuracy • Flag generates 1000 sub-second variants (millisecond granularity), not microsecond • Update all references in code, comments, and error messages • Update test names and assertions to reflect correct terminology Diagramflowchart LR
A["CLI Flag Definition"] -- "rename microseconds to milliseconds" --> B["main.rs"]
C["TimestampSource struct"] -- "rename field and parameter" --> D["timestamps.rs"]
E["Error messages & comments"] -- "update terminology" --> F["Consistency"]
G["Test cases"] -- "rename and update assertions" --> H["Test accuracy"]
File Changes1. src/main.rs
|
Code Review by Qodo
1.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
📝 WalkthroughWalkthroughRenames the timestamps mode from "microseconds" to "milliseconds": CLI flag/field and TimestampSource API/field updated to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
✨ Simplify code
📝 Coding Plan
Comment |
Sequence DiagramThis PR renames the timestamps CLI option from microseconds to milliseconds and propagates the new field name through source creation and processing. The runtime flow is unchanged: when enabled, each second timestamp is expanded into 1000 sub second variants. sequenceDiagram
participant User
participant CLI
participant SourceFactory
participant TimestampSource
User->>CLI: Run timestamps command with milliseconds option
CLI->>SourceFactory: Parse command and pass milliseconds flag
SourceFactory->>TimestampSource: Create source with date range and flag
User->>TimestampSource: Start timestamp processing
alt Milliseconds enabled
TimestampSource->>TimestampSource: Process each second plus 1000 millisecond variants
else Milliseconds disabled
TimestampSource->>TimestampSource: Process each second once
end
TimestampSource-->>User: Return processing statistics
Generated by CodeAnt AI |
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Renaming variables and CLI flags is a breaking change and considered a refactor, which requires human review according to the provided guidelines.
Architecture diagram
sequenceDiagram
participant User
participant CLI as CLI Parser (clap)
participant Main as Main / Factory
participant TS as TimestampSource
User->>CLI: timestamps --milliseconds 2023-01-01 2023-01-02
CLI->>Main: CHANGED: SourceCommand::Timestamps { milliseconds: true, ... }
Main->>TS: CHANGED: from_dates(start, end, milliseconds)
TS-->>Main: Instance (Box<dyn Source>)
Main->>TS: run(transforms, output, stats)
loop For each second in range
TS->>TS: Calculate base unix timestamp (ts)
alt CHANGED: milliseconds flag is true
loop 0 to 999
TS->>TS: Calculate sub-second key (ts * 1000 + ms)
TS->>Main: process_timestamp(ts_ms, ...)
end
else flag is false
TS->>Main: process_timestamp(ts, ...)
end
end
Note over TS,Main: Total keys = (seconds * 1001) if milliseconds else seconds
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/source/timestamps.rs (1)
156-170: This test misses loop off-by-one bugs.
inputs_processedis computed before the parallel loop starts, so this still passes if someone changes0..1000to0..=1000and actually processes 1002 values. A tiny stub transform plus an assertion onkeys_generatedwould catch the real iteration count.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/source/timestamps.rs` around lines 156 - 170, The test process_counts_milliseconds_mode_correctly currently only asserts inputs_processed which is computed before the processing loop and thus won't catch off-by-one in the actual iteration; add a tiny stub Transform implementation (e.g., TestCountingTransform) that increments a shared counter or records each processed key via keys_generated when its transform method is called, include an instance of this stub in the transforms Vec passed to TimestampSource::process, then assert that the stub's keys_generated count equals the expected number (1001) after process returns to detect any off-by-one in TimestampSource::process or its internal loop.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/main.rs`:
- Around line 366-368: The new CLI flag rename removed the old --microseconds
flag and breaks saved commands; restore backward compatibility by adding the old
spelling as a deprecated alias on the struct field that defines the flag (the
milliseconds field) — e.g. add an attribute like #[arg(long, alias =
"microseconds")] (or #[arg(long, aliases = ["microseconds"])] depending on your
clap version) and update the flag help text to mention the alias is deprecated
so callers see a warning; this keeps create_source() behavior unchanged while
accepting old saved commands.
---
Nitpick comments:
In `@src/source/timestamps.rs`:
- Around line 156-170: The test process_counts_milliseconds_mode_correctly
currently only asserts inputs_processed which is computed before the processing
loop and thus won't catch off-by-one in the actual iteration; add a tiny stub
Transform implementation (e.g., TestCountingTransform) that increments a shared
counter or records each processed key via keys_generated when its transform
method is called, include an instance of this stub in the transforms Vec passed
to TimestampSource::process, then assert that the stub's keys_generated count
equals the expected number (1001) after process returns to detect any off-by-one
in TimestampSource::process or its internal loop.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1bb60c60-7203-4bd8-97bd-c08f1efbbb93
📒 Files selected for processing (2)
src/main.rssrc/source/timestamps.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: benchmarks
🧰 Additional context used
📓 Path-based instructions (9)
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Order imports as: external crates → std → blank line →super::→ blank line →crate::
Prefer?operator over.unwrap()in new code
UsePascalCasefor types and structs
Usesnake_casefor function and method names
UseSCREAMING_SNAKE_CASEfor constants
Usesnake_casefor file and module names
Files:
src/main.rssrc/source/timestamps.rs
src/main.rs
📄 CodeRabbit inference engine (AGENTS.md)
src/main.rs: Useanyhow::Result<T>andanyhow::bail!()for CLI and top-level error handling
CLI command and subcommand changes go insrc/main.rsusing clap derive macros
Files:
src/main.rs
src/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.rs: Useindicatif::ProgressBarfor long-running operations
Place inline tests in#[cfg(test)] mod testsat the end of each file, using standardassert!andassert_eq!macros
Usetempfilecrate for file I/O tests
Files:
src/main.rssrc/source/timestamps.rs
src/source/*.rs
📄 CodeRabbit inference engine (src/source/AGENTS.md)
Create new source in
src/source/{name}.rsfile
Files:
src/source/timestamps.rs
src/source/!(mod).rs
📄 CodeRabbit inference engine (src/source/AGENTS.md)
src/source/!(mod).rs: ImplementSourcetrait withprocess()method acceptingtransforms,deriver,matcher, andoutputparameters
Use Rayonpar_chunks()for batch processing and parallelism in source implementations
Report progress via optionalProgressBarusingindicatif::ProgressBarinprocess()method
All sources must implementSend + Synctraits for thread safety
Files:
src/source/timestamps.rs
src/{derive,matcher,network,benchmark,provider,transform,analyze,source,output,gpu,storage}/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
Implement custom error enums with
DisplayandErrortrait implementations for domain modules
Files:
src/source/timestamps.rs
src/{transform,analyze,source}/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
Suffix struct names by role:
{Name}Transform,{Name}Analyzer,{Name}Source
Files:
src/source/timestamps.rs
src/{transform,source}/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
Implement batch processing for transforms and sources using
&[Input]batches via Rayonpar_chunks()
Files:
src/source/timestamps.rs
src/{transform,source,analyze}/**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
Use
AtomicBoolfor early termination signaling across Rayon threads
Files:
src/source/timestamps.rs
🧠 Learnings (7)
📚 Learning: 2026-03-12T18:24:52.371Z
Learnt from: CR
Repo: oritwoen/vuke PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-12T18:24:52.371Z
Learning: Applies to src/main.rs : CLI command and subcommand changes go in `src/main.rs` using clap derive macros
Applied to files:
src/main.rs
📚 Learning: 2026-03-05T12:48:44.245Z
Learnt from: CR
Repo: oritwoen/vuke PR: 0
File: src/source/AGENTS.md:0-0
Timestamp: 2026-03-05T12:48:44.245Z
Learning: Applies to src/source/src/main.rs : Update `SourceCommand` enum in `src/main.rs` when adding a new source type
Applied to files:
src/main.rs
📚 Learning: 2026-03-05T12:48:44.245Z
Learnt from: CR
Repo: oritwoen/vuke PR: 0
File: src/source/AGENTS.md:0-0
Timestamp: 2026-03-05T12:48:44.245Z
Learning: Applies to src/source/src/main.rs : Update `create_source()` function in `src/main.rs` to handle new source variants
Applied to files:
src/main.rssrc/source/timestamps.rs
📚 Learning: 2026-03-05T12:48:44.245Z
Learnt from: CR
Repo: oritwoen/vuke PR: 0
File: src/source/AGENTS.md:0-0
Timestamp: 2026-03-05T12:48:44.245Z
Learning: Applies to src/source/stdin.rs : Implement line-by-line streaming in `StdinSource` for memory efficiency
Applied to files:
src/main.rs
📚 Learning: 2026-03-05T12:48:44.245Z
Learnt from: CR
Repo: oritwoen/vuke PR: 0
File: src/source/AGENTS.md:0-0
Timestamp: 2026-03-05T12:48:44.245Z
Learning: Applies to src/source/mod.rs : Add variant to `SourceType` enum with `create()` and `from_str()` methods for new sources
Applied to files:
src/main.rs
📚 Learning: 2026-03-05T12:48:44.245Z
Learnt from: CR
Repo: oritwoen/vuke PR: 0
File: src/source/AGENTS.md:0-0
Timestamp: 2026-03-05T12:48:44.245Z
Learning: Applies to src/source/!(mod).rs : Implement `Source` trait with `process()` method accepting `transforms`, `deriver`, `matcher`, and `output` parameters
Applied to files:
src/source/timestamps.rs
📚 Learning: 2026-03-12T18:25:01.029Z
Learnt from: CR
Repo: oritwoen/vuke PR: 0
File: src/output/AGENTS.md:0-0
Timestamp: 2026-03-12T18:25:01.029Z
Learning: Applies to src/output/console.rs : Compact CSV format for file output should be: `source,transform,privkey_hex,address`
Applied to files:
src/source/timestamps.rs
🧬 Code graph analysis (1)
src/main.rs (1)
src/source/timestamps.rs (1)
from_dates(22-55)
🔇 Additional comments (2)
src/main.rs (1)
1149-1157: The rename is wired through cleanly.
create_source()forwards the renamed field straight intoTimestampSource::from_dates(), so the CLI spelling and source mode stay aligned.src/source/timestamps.rs (1)
15-18: Milliseconds now matches the actual work path.Stored flag, constructor arg, overflow check,
count * 1001, and the0..1000expansion all describe the same unit now.Also applies to: 22-23, 50-53, 74-96, 113-121
Closes #68.
The
--microsecondsflag iterates 0..1000 per timestamp - that's millisecond granularity, not microsecond. Microseconds would be 0..1_000_000. The flag name was just wrong, so this renames it to--millisecondsto match what the code actually does.Two files, pure rename, no behavior change.