Repository: TraceMachina/nativelink (language: rust)

Issue:
Misspellings in code files need to be fixed
Currently, we are doing strict misspelling check on documentation files.
But we haven't checked misspellings in code files yet - in comments, variable names, function names, etc.

I did an intensive misspelling check on all source files and found out 92 occurrences in 27 files.



Discussion / hints:

Fix patch:
diff --git a/nativelink-config/src/cas_server.rs b/nativelink-config/src/cas_server.rs
index 60576696d..3061c4f44 100644
--- a/nativelink-config/src/cas_server.rs
+++ b/nativelink-config/src/cas_server.rs
@@ -468,7 +468,7 @@ pub enum EnvironmentSource {
     /// (requested by the client).
     timeout_millis,
 
-    /// A special file path will be provided that can be used to comminicate
+    /// A special file path will be provided that can be used to communicate
     /// with the parent process about out-of-band information. This file
     /// will be read after the command has finished executing. Based on the
     /// contents of the file, the behavior of the result may be modified.
@@ -665,7 +665,7 @@ pub enum WorkerConfig {
 pub struct GlobalConfig {
     /// Maximum number of open files that can be opened at one time.
     /// This value is not strictly enforced, it is a best effort. Some internal libraries
-    /// open files or read metadata from a files which do not obay this limit, however
+    /// open files or read metadata from a files which do not obey this limit, however
     /// the vast majority of cases will have this limit be honored.
     /// As a rule of thumb this value should be less than half the value of `ulimit -n`.
     /// Any network open file descriptors is not counted in this limit, but is counted
@@ -696,7 +696,7 @@ pub struct GlobalConfig {
     /// are collected at runtime (performance metrics) from being tallied. The
     /// overhead of collecting metrics is very low, so this flag should only be
     /// used if there is a very good reason to disable metrics.
-    /// This flag can be forcably set using the `NATIVELINK_DISABLE_METRICS` variable.
+    /// This flag can be forcibly set using the `NATIVELINK_DISABLE_METRICS` variable.
     /// If the variable is set it will always disable metrics regardless of what
     /// this flag is set to.
     ///
diff --git a/nativelink-scheduler/src/simple_scheduler_state_manager.rs b/nativelink-scheduler/src/simple_scheduler_state_manager.rs
index 573a9acf2..ff1d3881f 100644
--- a/nativelink-scheduler/src/simple_scheduler_state_manager.rs
+++ b/nativelink-scheduler/src/simple_scheduler_state_manager.rs
@@ -806,9 +806,9 @@ where
     async fn assign_operation(
         &self,
         operation_id: &OperationId,
-        worker_id_or_reason_for_unsassign: Result<&WorkerId, Error>,
+        worker_id_or_reason_for_unassign: Result<&WorkerId, Error>,
     ) -> Result<(), Error> {
-        let (maybe_worker_id, update) = match worker_id_or_reason_for_unsassign {
+        let (maybe_worker_id, update) = match worker_id_or_reason_for_unassign {
             Ok(worker_id) => (
                 Some(worker_id),
                 UpdateOperationType::UpdateWithActionStage(ActionStage::Executing),
diff --git a/nativelink-util/src/common.rs b/nativelink-util/src/common.rs
index 7dd93c48d..0f7976960 100644
--- a/nativelink-util/src/common.rs
+++ b/nativelink-util/src/common.rs
@@ -191,7 +191,7 @@ impl Serialize for DigestInfo {
     }
 }
 
-/// Custom deserializer for `DigestInfo` becaues the default Deserializer
+/// Custom deserializer for `DigestInfo` because the default Deserializer
 /// would try to decode the data as a byte array, but we use {hex}-{size}.
 impl<'de> Deserialize<'de> for DigestInfo {
     fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
diff --git a/nativelink-util/src/digest_hasher.rs b/nativelink-util/src/digest_hasher.rs
index 6d57785a3..280311f7b 100644
--- a/nativelink-util/src/digest_hasher.rs
+++ b/nativelink-util/src/digest_hasher.rs
@@ -31,7 +31,7 @@ use crate::common::DigestInfo;
 use crate::origin_context::{ActiveOriginContext, OriginContext};
 use crate::{fs, make_symbol, spawn_blocking};
 
-// The symbol can be use to retrieve the active hasher function.
+// The symbol can be used to retrieve the active hasher function.
 // from an `OriginContext`.
 make_symbol!(ACTIVE_HASHER_FUNC, DigestHasherFunc);
 
diff --git a/nativelink-util/src/fastcdc.rs b/nativelink-util/src/fastcdc.rs
index 49536392f..62860f250 100644
--- a/nativelink-util/src/fastcdc.rs
+++ b/nativelink-util/src/fastcdc.rs
@@ -25,7 +25,7 @@ impl State {
 /// In layman's terms this means we can take an input of unknown size and composition
 /// and chunk it into smaller chunks with chunk boundaries that will be very similar
 /// even when a small part of the file is changed. This use cases where a large file
-/// (say 1G) has a few minor changes weather they byte inserts, deletes or updates
+/// (say 1G) has a few minor changes whether they byte inserts, deletes or updates
 /// and when running through this algorithm it will slice the file up so that under
 /// normal conditions all the chunk boundaries will be identical except the ones near
 /// the mutations.
diff --git a/nativelink-util/src/fs.rs b/nativelink-util/src/fs.rs
index 27c0d834a..0f909e099 100644
--- a/nativelink-util/src/fs.rs
+++ b/nativelink-util/src/fs.rs
@@ -161,7 +161,7 @@ impl ResumeableFileSlot {
 
     /// Utility function to read data from a handler and handles file descriptor
     /// timeouts. Chunk size is based on the `buf`'s capacity.
-    /// Note: If the `handler` changes `buf`s capcity, it is responsible for reserving
+    /// Note: If the `handler` changes `buf`s capacity, it is responsible for reserving
     /// more before returning.
     pub async fn read_buf_cb<'b, T, F, Fut>(
         &'b mut self,
diff --git a/nativelink-util/src/health_utils.rs b/nativelink-util/src/health_utils.rs
index 80b29bea0..8e151cf0c 100644
--- a/nativelink-util/src/health_utils.rs
+++ b/nativelink-util/src/health_utils.rs
@@ -124,7 +124,7 @@ pub struct HealthRegistryBuilder {
 
 /// Health registry builder that is used to build a health registry.
 /// The builder provides creation, registering of health status indicators,
-/// sub building scoped health registries and building the health registry.
+/// sub-building scoped health registries and building the health registry.
 /// `build()` should be called once for finalizing the production of a health registry.
 impl HealthRegistryBuilder {
     pub fn new(namespace: &str) -> Self {
diff --git a/nativelink-util/src/known_platform_property_provider.rs b/nativelink-util/src/known_platform_property_provider.rs
index 461de9ce7..df079eb39 100644
--- a/nativelink-util/src/known_platform_property_provider.rs
+++ b/nativelink-util/src/known_platform_property_provider.rs
@@ -26,6 +26,6 @@ use crate::operation_state_manager::ClientStateManager;
 pub trait KnownPlatformPropertyProvider:
     ClientStateManager + Sync + Send + Unpin + RootMetricsComponent + 'static
 {
-    // / Returns the platform property manager.
+    // Returns the platform property manager.
     async fn get_known_properties(&self, instance_name: &str) -> Result<Vec<String>, Error>;
 }
diff --git a/nativelink-util/src/metrics_utils.rs b/nativelink-util/src/metrics_utils.rs
index 3ba95a564..88d987782 100644
--- a/nativelink-util/src/metrics_utils.rs
+++ b/nativelink-util/src/metrics_utils.rs
@@ -157,7 +157,7 @@ pub struct AsyncCounterWrapper {
     pub successes: AtomicU64,
     pub failures: AtomicU64,
     pub drops: AtomicU64,
-    // Time spent in nano seconds in the future.
+    // Time spent in nanoseconds in the future.
     // 64 bit address space gives ~584 years of nanoseconds.
     pub sum_func_duration_ns: AtomicU64,
 }
@@ -278,7 +278,7 @@ impl AsyncCounterWrapper {
     }
 }
 
-/// Tracks an number.
+/// Tracks a number.
 #[derive(Default)]
 pub struct Counter(AtomicU64);
 
diff --git a/nativelink-util/src/operation_state_manager.rs b/nativelink-util/src/operation_state_manager.rs
index f600a4d3c..0a3835f08 100644
--- a/nativelink-util/src/operation_state_manager.rs
+++ b/nativelink-util/src/operation_state_manager.rs
@@ -81,7 +81,7 @@ pub struct OperationFilter {
     /// The digest of the action that the operation must have.
     pub action_digest: Option<DigestInfo>,
 
-    /// The operation must have it's worker timestamp before this time.
+    /// The operation must have its worker timestamp before this time.
     pub worker_update_before: Option<SystemTime>,
 
     /// The operation must have been completed before this time.
@@ -160,6 +160,6 @@ pub trait MatchingEngineStateManager: Sync + Send + MetricsComponent {
     async fn assign_operation(
         &self,
         operation_id: &OperationId,
-        worker_id_or_reason_for_unsassign: Result<&WorkerId, Error>,
+        worker_id_or_reason_for_unassign: Result<&WorkerId, Error>,
     ) -> Result<(), Error>;
 }
diff --git a/nativelink-util/src/origin_context.rs b/nativelink-util/src/origin_context.rs
index fc75e18b9..ceaf53a32 100644
--- a/nativelink-util/src/origin_context.rs
+++ b/nativelink-util/src/origin_context.rs
@@ -31,13 +31,13 @@ use tracing::{Instrument, Span};
 use crate::background_spawn;
 
 /// Make a symbol that represents a unique memory pointer that is
-/// constant and choosen at compile time. This enables two modules
+/// constant and chosen at compile time. This enables two modules
 /// to use that memory location to reference data that lives in a
-/// shared module without the two modules knowing about eachother.
-/// For example, lets say we have a context that holds anonymous
+/// shared module without the two modules knowing about each other.
+/// For example, let's say we have a context that holds anonymous
 /// data; we can use these symbols to let one module set the data
 /// and tie the data to a symbol and another module read the data
-/// with the symbol, without the two modules knowing about eachother.
+/// with the symbol, without the two modules knowing about each other.
 #[macro_export]
 macro_rules! make_symbol {
     ($name:ident, $type:ident) => {
@@ -132,7 +132,7 @@ impl OriginContext {
     }
 
     /// Consumes the context and runs the given function with the context set
-    /// as the active context. When the function exists the context is restored
+    /// as the active context. When the function exits, the context is restored
     /// to the previous global context.
     #[inline]
     pub fn run<T>(self, span: Span, func: impl FnOnce() -> T) -> T {
@@ -140,7 +140,7 @@ impl OriginContext {
     }
 
     /// Wraps a function so when it is called the passed in context is set as
-    /// the active context and when the function exists the context is restored
+    /// the active context and when the function exits, the context is restored
     /// to the previous global context.
     #[inline]
     fn wrap<T>(self: Arc<Self>, span: Span, func: impl FnOnce() -> T) -> impl FnOnce() -> T {
@@ -153,7 +153,7 @@ impl OriginContext {
     }
 
     /// Wraps a future so when it is called the passed in context is set as
-    /// the active context and when the future exists the context is restored
+    /// the active context and when the future exits, the context is restored
     /// to the previous global context.
     #[inline]
     pub fn wrap_async<T>(
@@ -299,7 +299,7 @@ pin_project! {
             let this = this.project();
             // Note: If the future panics, the context will not be restored, so
             // this is a best effort to provide access to our global context
-            // in the desturctors the event of a panic.
+            // in the destructors the event of a panic.
             let _enter = this.context.take().map(OriginContext::enter);
             // SAFETY: 1. `Pin::get_unchecked_mut()` is safe, because this isn't
             //             different from wrapping `T` in `Option` and calling
diff --git a/nativelink-util/src/resource_info.rs b/nativelink-util/src/resource_info.rs
index 4683d7c43..9ae7cb1a1 100644
--- a/nativelink-util/src/resource_info.rs
+++ b/nativelink-util/src/resource_info.rs
@@ -206,9 +206,9 @@ enum State {
     OptionalMetadata,
 }
 
-// Iterate backwards looking for "(compressed-)blobs", once found, move foward
+// Iterate backwards looking for "(compressed-)blobs", once found, move forward
 // populating the output struct. This recursive function utilises the stack to
-// temporarly hold the reference to the previous item reducing the need for
+// temporarily hold the reference to the previous item reducing the need for
 // a heap allocation.
 fn recursive_parse<'a>(
     rparts: &mut impl Iterator<Item = &'a str>,
diff --git a/nativelink-util/src/store_trait.rs b/nativelink-util/src/store_trait.rs
index 2c4f69154..3315816f3 100644
--- a/nativelink-util/src/store_trait.rs
+++ b/nativelink-util/src/store_trait.rs
@@ -847,7 +847,7 @@ pub trait SchedulerStore: Send + Sync + 'static {
 }
 
 /// A type that is used to let the scheduler store know what
-/// index is beign requested.
+/// index is being requested.
 pub trait SchedulerIndexProvider {
     /// Only keys inserted with this prefix will be indexed.
     const KEY_PREFIX: &'static str;
diff --git a/nativelink-worker/src/local_worker.rs b/nativelink-worker/src/local_worker.rs
index f5964a709..8c5ce979f 100644
--- a/nativelink-worker/src/local_worker.rs
+++ b/nativelink-worker/src/local_worker.rs
@@ -56,7 +56,7 @@ use crate::worker_utils::make_supported_properties;
 /// consider an error to have occurred.
 const ACTIONS_IN_TRANSIT_TIMEOUT_S: f32 = 10.;
 
-/// If we loose connection to the worker api server we will wait this many seconds
+/// If we lose connection to the worker api server we will wait this many seconds
 /// before trying to connect.
 const CONNECTION_RETRY_DELAY_S: f32 = 0.5;
 
diff --git a/nativelink-worker/src/running_actions_manager.rs b/nativelink-worker/src/running_actions_manager.rs
index bbdf3f55c..bb84687f8 100644
--- a/nativelink-worker/src/running_actions_manager.rs
+++ b/nativelink-worker/src/running_actions_manager.rs
@@ -93,7 +93,7 @@ const DEFAULT_HISTORICAL_RESULTS_STRATEGY: UploadCacheResultsStrategy =
 #[allow(non_camel_case_types)]
 #[derive(Debug, Deserialize)]
 enum SideChannelFailureReason {
-    /// Task should be considered timedout.
+    /// Task should be considered timed out.
     timeout,
 }
 


Test patch:
diff --git a/nativelink-util/tests/fastcdc_test.rs b/nativelink-util/tests/fastcdc_test.rs
index c80cc6971..ffaf1d679 100644
--- a/nativelink-util/tests/fastcdc_test.rs
+++ b/nativelink-util/tests/fastcdc_test.rs
@@ -100,7 +100,7 @@ async fn test_random_20mb_16k_chunks() -> Result<(), std::io::Error> {
 }
 
 #[nativelink_test]
-async fn insert_garbage_check_boundarys_recover_test() -> Result<(), std::io::Error> {
+async fn insert_garbage_check_boundaries_recover_test() -> Result<(), std::io::Error> {
     let mut rand_data = {
         let mut data = vec![0u8; 100_000];
         let mut rng = SmallRng::seed_from_u64(1);