Skip to content

Commit d085315

Browse files
committed
chore(comments): strip ai-sounding and restate-the-code comments across workspace
1 parent 97ea65f commit d085315

14 files changed

Lines changed: 28 additions & 69 deletions

File tree

api/src/error/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,4 @@ impl ResponseError for Error {
8383
}
8484
}
8585

86-
// Short hand alias, which allows you to use just Result<T>
8786
pub type Result<T> = std::result::Result<T, Error>;

api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ fn build_screenscraper_client(
503503
/// Returns `None` when EMUREADY_ENABLED is unset or not "true". The EmuReady
504504
/// API is open and unauthenticated for read endpoints; the flag exists so
505505
/// existing deployments do not silently start hitting an external service on
506-
/// next deploy. Matching only — no proxy routes are exposed.
506+
/// next deploy. Matching only. No proxy routes are exposed.
507507
fn build_emuready_client(
508508
http: Client,
509509
redis_conn: redis::aio::MultiplexedConnection,

api/src/openapi/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,11 @@ pub struct ApiDoc;
548548
pub fn create_openapi() -> utoipa::openapi::OpenApi {
549549
let mut openapi = ApiDoc::openapi();
550550

551-
// Extract existing schemas if already generated
552551
let existing_components = openapi
553552
.components
554553
.take()
555554
.unwrap_or_else(Components::default);
556555

557-
// Build new components with security scheme
558556
let new_components = ComponentsBuilder::from(existing_components)
559557
.security_scheme(
560558
"bearer_auth",
@@ -567,7 +565,6 @@ pub fn create_openapi() -> utoipa::openapi::OpenApi {
567565
)
568566
.build();
569567

570-
// Assign merged components back to OpenAPI doc
571568
openapi.components = Some(new_components);
572569

573570
openapi

service/src/http/download.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use tokio::fs::File;
1111
use tokio::io::AsyncWriteExt;
1212

1313
lazy_static! {
14-
// Define the regex pattern for extracting the filename
1514
static ref FILENAME_REGEX: Regex = Regex::new(r#"filename\*?=(?:UTF-8''|")?([^";]+)"#).unwrap();
1615
}
1716

@@ -71,9 +70,7 @@ pub async fn download_file(
7170
}
7271
}
7372

74-
// Function to extract the filename from Content-Disposition header value
7573
fn extract_filename(content_disposition: &str) -> Option<String> {
76-
// Using the cached regex to capture the filename part
7774
if let Some(captures) = FILENAME_REGEX.captures(content_disposition) {
7875
return captures.get(1).map(|c| c.as_str().to_string());
7976
}

service/src/identification/mod.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,9 @@ pub async fn identify_game_and_metadata_mappings(
9595
}
9696
}
9797

98-
/// Walk the supported match types in order (sha256, sha1, md5, name+size) and return the first
99-
/// hit, together with whether the hit was served from cache. If every hash that could have been
100-
/// checked produced a cached-but-empty result, surface a `Cached(None)`; otherwise `NonCached(None)`.
101-
///
102-
/// Cache-coherence bookkeeping lives in [`IdentifyAggregator`]; this fn is
103-
/// the impure dispatch shell that runs the cache lookups and records the
104-
/// per-attempt metric.
98+
/// Tries each match type in order (sha256, sha1, md5, name+size) and returns
99+
/// the first hit. When every attempted hash produced a cached-but-empty
100+
/// result the outcome collapses to `Cached(None)`, otherwise `NonCached(None)`.
105101
async fn identify_game(
106102
search: &GameFileMatchSearch,
107103
redis_conn: &mut MultiplexedConnection,

service/src/identification/protocol.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ impl IdentifyAggregator {
3333
}
3434

3535
/// Fold one per-match-type cache outcome into the running tally.
36-
///
37-
/// `Break(result)` means the caller should return `result` immediately
38-
/// (a hit was found, served from cache or computed). `Continue(())`
39-
/// means the caller should move on to the next match type.
4036
pub fn observe(
4137
&mut self,
4238
match_type: GameMatchType,
@@ -55,12 +51,10 @@ impl IdentifyAggregator {
5551

5652
/// Collapse the running tally into a final cache outcome.
5753
///
58-
/// Returns `Cached(None)` only when `cached_but_empty == expected_count`
59-
/// and `expected_count != 0`. Note that `cached_but_empty` is bumped on
60-
/// every `Cached(None)` outcome including the filename+size attempt,
61-
/// while `expected_count` only counts hash fields. The asymmetry is a
62-
/// known wrinkle preserved verbatim from the pre-refactor logic; see
63-
/// the test module for the pinned behavior.
54+
/// Returns `Cached(None)` only when every hash attempt produced
55+
/// `Cached(None)`. `cached_but_empty` is bumped on every `Cached(None)`
56+
/// outcome including the filename+size attempt, while `expected_count`
57+
/// only counts hash fields; see the test module for the pinned behavior.
6458
pub fn finalize(self) -> CacheStatus<Option<(GameMatchType, IdentifyEntry)>> {
6559
if self.cached_but_empty == self.expected_count && self.cached_but_empty != 0 {
6660
Cached(None)
@@ -148,7 +142,7 @@ mod tests {
148142
/// filename+size attempt is also cached empty, `cached_but_empty`
149143
/// (3 hashes + 1 filename = 4) no longer equals `expected_count`
150144
/// (3 hashes), so the result is `NonCached(None)` even though every
151-
/// attempt was cached. Worth revisiting in a follow-up.
145+
/// attempt was cached.
152146
#[test]
153147
fn filename_size_cached_empty_breaks_cached_none_collapse() {
154148
let mut agg = IdentifyAggregator::new(3);
@@ -165,8 +159,7 @@ mod tests {
165159

166160
/// Pins a second wrinkle: when only filename+size is attempted (no
167161
/// hashes) and it returns Cached(None), the `expected_count != 0`
168-
/// guard in `finalize` forces `NonCached(None)`. Also worth a
169-
/// follow-up.
162+
/// guard in `finalize` forces `NonCached(None)`.
170163
#[test]
171164
fn only_filename_size_cached_empty_yields_noncached_none() {
172165
let mut agg = IdentifyAggregator::new(0);

service/src/ingestion/parser/import.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ pub async fn parse_and_import_dat_file(
117117
})
118118
.collect();
119119

120-
// Delete existing files that are not in the new files
121120
for file in existing_files.iter() {
122121
let identifier = (
123122
&file.file_name,
@@ -134,7 +133,6 @@ pub async fn parse_and_import_dat_file(
134133

135134
let mut to_insert = vec![];
136135

137-
// Insert new files that are not in the existing files
138136
for rom in game.rom.iter() {
139137
let identifier = (
140138
&rom.name,
@@ -217,10 +215,9 @@ fn parse_company_and_platform(
217215
) -> anyhow::Result<(Option<String>, String, Vec<String>)> {
218216
let mut dat_header = dat.header.name.clone();
219217

220-
// Remove Arcade - from the name as its not a company or system
218+
// Remove Arcade - from the name because it is not a company or system
221219
dat_header = dat_header.replace("Arcade - ", "");
222220

223-
// Remove subset prefix if present
224221
if let Some(subset) = &dat.header.subset {
225222
let subset_prefix = format!("{subset} - ");
226223
if dat_header.starts_with(&subset_prefix) {
@@ -241,25 +238,21 @@ fn parse_company_and_platform(
241238

242239
match split.len() {
243240
1 => {
244-
// Single part - it's the platform, no company
245241
platform = split[0].to_string();
246242
}
247243
2 => {
248-
// Two parts - company and platform
249244
company = Some(split[0].to_string());
250245
platform = split[1].to_string();
251246
}
252247
_ => {
253-
// Three or more parts
254248
company = Some(split[0].to_string());
255249

256-
// Join the remaining parts
257250
let remaining_parts = split[1..].to_vec();
258251

259-
// Check if this looks like extra metadata (contains brackets, "NKit", etc)
252+
// Stop joining parts onto the platform once one looks like extra
253+
// metadata (bracketed tags, NKit, RVZ, and similar).
260254
let mut platform_parts = Vec::new();
261255
for part in remaining_parts {
262-
// Stop adding to platform if we hit what looks like metadata
263256
if part.contains('[')
264257
|| part.contains("NKit")
265258
|| part.contains("RVZ")
@@ -282,10 +275,8 @@ fn parse_company_and_platform(
282275

283276
// Remove company name from platform if it appears there for GameCube
284277
if let Some(ref company_name) = company {
285-
// Remove "Company Platform" -> "Platform"
286278
if platform.starts_with(company_name) && platform.to_lowercase().contains("gamecube") {
287279
let after_company = platform.strip_prefix(company_name).unwrap_or(&platform);
288-
// Clean up any leading spaces or separators
289280
platform = after_company
290281
.trim_start_matches(' ')
291282
.trim_start_matches('-')
@@ -297,7 +288,6 @@ fn parse_company_and_platform(
297288
let company_no_spaces = company_name.replace(' ', "");
298289
if platform.starts_with(&company_no_spaces) && platform.len() > company_no_spaces.len() {
299290
let potential_platform = &platform[company_no_spaces.len()..];
300-
// Check if the next character is uppercase (indicating camelCase split)
301291
if potential_platform
302292
.chars()
303293
.next()
@@ -309,10 +299,8 @@ fn parse_company_and_platform(
309299
}
310300
}
311301

312-
// Remove version from platform if present
313302
platform = platform.replace(&format!(" ({version})"), "");
314303

315-
// Extract tags from platform
316304
let mut clean_platform = platform.clone();
317305
for capture in DAT_TAG_REGEX.captures_iter(&platform) {
318306
if let Some(tag_match) = capture.get(1) {
@@ -337,7 +325,6 @@ fn parse_company_and_platform(
337325
let number_str = number_match.as_str();
338326
let number = number_str.parse::<u32>().unwrap_or(1);
339327

340-
// Convert PS1, PS2, PS3, etc. to PlayStation 1, PlayStation 2, etc.
341328
platform = format!("PlayStation {number}");
342329
}
343330

service/src/matching/manual.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ async fn apply_manual_entity_match(
9090
"Overwriting existing mapping for {}: {entity_id}",
9191
target.label()
9292
);
93-
// TODO: decide how to notify the user that this entry is already matched
9493
}
9594

9695
if let Some(provider_id) = &mapping.provider_id
@@ -186,7 +185,6 @@ pub async fn apply_manual_game_match_by_game(
186185

187186
let mut games_to_update = vec![];
188187

189-
// Find all parents and children of the same game
190188
for game in games {
191189
if let Some(parent) = find_game_parent(&game, db_conn).await? {
192190
debug!("Found parent game: {}", parent.id);
@@ -230,7 +228,6 @@ pub async fn apply_manual_game_match_by_game(
230228
&& mapping.match_type != MatchTypeEnum::None
231229
{
232230
debug!("Overwriting existing mapping for game: {}", game.id);
233-
// TODO: decide how to notify the user that this entry is already matched
234231
}
235232

236233
if let Some(provider_id) = &mapping.provider_id

service/src/model/match_result.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ impl GameMatchType {
7878
/// `None` for [`GameMatchType::NoMatch`] (not cached).
7979
///
8080
/// Note: `FileNameAndSize` returns `"filename_size"` here while
81-
/// [`Self::metric_label`] returns `"filename"`. The mismatch predates
82-
/// this method (cache hit/miss metrics used `"filename_size"`; identify
83-
/// attempt metrics used `"filename"`) and is preserved to keep existing
84-
/// Prometheus series stable. Future cleanup should align them.
81+
/// [`Self::metric_label`] returns `"filename"`. Cache hit/miss metrics
82+
/// use `"filename_size"` and identify attempt metrics use `"filename"`;
83+
/// the two segments stay distinct to keep existing Prometheus series
84+
/// stable.
8585
pub fn cache_segment(&self) -> Option<&'static str> {
8686
match self {
8787
GameMatchType::SHA256 => Some("sha256"),

service/src/providers/igdb/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ impl IgdbClient {
12681268
}
12691269

12701270
let rate_limited_future = self.service.lock().await.ready().await?.call(req);
1271-
// MutexGuard has to have been dropped here, so it's 2 statements
1271+
// Bind the future to a local so the MutexGuard drops before .await.
12721272
let res = rate_limited_future.await?;
12731273

12741274
let body = res.text().await?;

0 commit comments

Comments
 (0)