Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional Statlocker integration to the ingest tool so that, after successful match ingestion, match IDs can be sent to statlocker.gg (enabled by default, opt-out via --no-statlocker), with corresponding installer and NixOS module support.
Changes:
- Introduces a new
statlockermodule that issues an HTTP GET to statlocker.gg for ingested matches. - Hooks Statlocker notifications into both initial cache ingestion and live cache watching flows.
- Adds
--no-statlockerwiring across CLI handling, Nix module option, and Linux/Windows installer prompts.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/statlocker.rs | New Statlocker notification helper (enable/disable + notify APIs). |
| src/scan_cache.rs | Triggers Statlocker notifications after successful ingestion. |
| src/main.rs | Adds CLI flag handling to disable Statlocker. |
| module.nix | Adds statlocker.enable option and wires it to --no-statlocker. |
| install-windows.ps1 | Prompts for Statlocker and threads --no-statlocker into shortcuts/task creation. |
| install-linux.sh | Prompts for Statlocker and threads --no-statlocker into service/shortcuts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/statlocker.rs
Outdated
| pub(crate) fn notify(match_id: u64) { | ||
| if !STATLOCKER_ENABLED.load(Ordering::Relaxed) { | ||
| return; | ||
| } | ||
|
|
||
| let url = format!("https://statlocker.gg/api/match/{match_id}/populate"); | ||
| debug!("Notifying Statlocker for match {match_id}"); | ||
|
|
||
| let client = HTTP_CLIENT.get_or_init(ureq::Agent::new_with_defaults); | ||
| match client.get(&url).call() { | ||
| Ok(resp) if resp.status().is_success() => { |
There was a problem hiding this comment.
notify() performs a synchronous client.get(...).call() on the ingestion/watch thread, so the integration is not actually “fire-and-forget” and can block cache watching/ingestion while waiting on DNS/TLS/network. Consider dispatching this request to a background thread (or queue) and/or setting a short timeout so Statlocker latency/outages don’t delay core ingestion behavior.
| if (-not $isInteractive) { | ||
| Write-Host "Y (default in non-interactive mode)" -ForegroundColor Cyan | ||
| Write-InstallLog -Level 'INFO' "Non-interactive mode detected. Enabling Statlocker integration by default." | ||
| $enableStatlocker = $true | ||
| } else { |
There was a problem hiding this comment.
$isInteractive is referenced here before it’s assigned later in the script. As written, this branch will treat interactive runs as non-interactive (since $isInteractive is $null), so the Statlocker prompt won’t appear and will always default to enabled. Initialize $isInteractive before this prompt, or compute a dedicated interactivity flag locally.
install-windows.ps1
Outdated
| $vbsRunArgs = """$ExecutablePath""" | ||
| if ($extraArgs -ne "") { | ||
| $vbsRunArgs = """$ExecutablePath"" $extraArgs" | ||
| } | ||
| $vbsContent = @" | ||
| Set WshShell = CreateObject("WScript.Shell") | ||
| WshShell.Run """$ExecutablePath""", 0, False | ||
| WshShell.Run "$vbsRunArgs", 0, False | ||
| "@ |
There was a problem hiding this comment.
The generated VBScript line WshShell.Run "$vbsRunArgs", 0, False will expand to something like WshShell.Run ""C:\path\app.exe" --no-statlocker", 0, False, which breaks VBScript string quoting (the quote before the space ends the literal). Generate the command string using VBScript-escaped quotes (triple quotes) like the previous implementation, or avoid wrapping $vbsRunArgs in quotes in the VBScript line and instead embed a fully-escaped VBScript string literal.
30c0dd2 to
50575b9
Compare
Fire-and-forget HTTP GET to statlocker.gg/api/match/<id> after every successful match ingestion. Enabled by default, disabled via --no-statlocker CLI flag. Install scripts on Linux and Windows prompt the user during installation. Nix module exposes statlocker.enable option.
50575b9 to
68ab523
Compare
Summary
statlocker.gg/api/match/<id>/populateafter every successful match ingestion--no-statlockerCLI flagstatlocker.enableoption (defaulttrue)Test plan
cargo build+cargo clippypass cleanlycargo test— all existing tests pass--no-statlocker— no Statlocker log lines appear