Skip to content

feat: add Statlocker integration#70

Merged
raimannma merged 2 commits intomasterfrom
feat/statlocker-integration
Feb 10, 2026
Merged

feat: add Statlocker integration#70
raimannma merged 2 commits intomasterfrom
feat/statlocker-integration

Conversation

@raimannma
Copy link
Member

@raimannma raimannma commented Feb 10, 2026

Summary

  • Fire-and-forget HTTP GET to statlocker.gg/api/match/<id>/populate after every successful match ingestion
  • Enabled by default, disabled via --no-statlocker CLI flag
  • Install scripts (Linux & Windows) prompt the user during installation
  • Nix module exposes statlocker.enable option (default true)

Test plan

  • cargo build + cargo clippy pass cleanly
  • cargo test — all existing tests pass
  • Run binary without flag — debug logs show "Notifying Statlocker for match ..."
  • Run binary with --no-statlocker — no Statlocker log lines appear
  • Review install script prompts manually in interactive terminal

@raimannma raimannma requested a review from Copilot February 10, 2026 10:41
@raimannma raimannma self-assigned this Feb 10, 2026
@raimannma raimannma added the enhancement New feature or request label Feb 10, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 statlocker module 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-statlocker wiring 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.

Comment on lines 12 to 22
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() => {
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +416 to +420
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 {
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$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.

Copilot uses AI. Check for mistakes.
Comment on lines 255 to 262
$vbsRunArgs = """$ExecutablePath"""
if ($extraArgs -ne "") {
$vbsRunArgs = """$ExecutablePath"" $extraArgs"
}
$vbsContent = @"
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """$ExecutablePath""", 0, False
WshShell.Run "$vbsRunArgs", 0, False
"@
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@raimannma raimannma force-pushed the feat/statlocker-integration branch 2 times, most recently from 30c0dd2 to 50575b9 Compare February 10, 2026 10:51
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.
@raimannma raimannma force-pushed the feat/statlocker-integration branch from 50575b9 to 68ab523 Compare February 10, 2026 10:58
@raimannma raimannma enabled auto-merge (rebase) February 10, 2026 10:58
@raimannma raimannma merged commit 537a64c into master Feb 10, 2026
36 checks passed
@raimannma raimannma deleted the feat/statlocker-integration branch February 10, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant