From cef0d8465e30d7275314f598ebe168c56cb68607 Mon Sep 17 00:00:00 2001 From: "Claude (Chronicler #83 - The Compiler)" Date: Mon, 13 Apr 2026 06:33:57 -0500 Subject: [PATCH] Fix: skip stale DB versions for installer-detected servers without file_id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Installer-method servers had full filenames as current_version (e.g. "DeceasedCraft_Beta_DH_Edition_5.10.16") which prevented reaching pending_calibration. Now only uses DB current_version if file_id is also set (validated) or detection method isn't installer. Migration clears existing stale rows → pending_calibration. Co-Authored-By: Claude Opus 4.6 (1M context) --- ...MSG-2026-04-13-stale-installer-versions.md | 79 +++++++++++++++++++ .../Console/Commands/CheckModpackUpdates.php | 7 +- ..._000003_clear_stale_installer_versions.php | 28 +++++++ 3 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 docs/code-bridge/archive/MSG-2026-04-13-stale-installer-versions.md create mode 100644 services/modpack-version-checker/blueprint-extension/database/migrations/2026_04_13_000003_clear_stale_installer_versions.php diff --git a/docs/code-bridge/archive/MSG-2026-04-13-stale-installer-versions.md b/docs/code-bridge/archive/MSG-2026-04-13-stale-installer-versions.md new file mode 100644 index 0000000..eccb1f3 --- /dev/null +++ b/docs/code-bridge/archive/MSG-2026-04-13-stale-installer-versions.md @@ -0,0 +1,79 @@ +# MSG-2026-04-13-stale-installer-versions + +**From:** Chronicler #85 +**Date:** 2026-04-13 +**Priority:** HIGH — pending_calibration never triggers on live panel +**Status:** OPEN + +## Problem + +The cron's detection chain has a fallback that reads `current_version` from the +existing DB row. For installer-method servers, this means stale full installer +filenames (e.g. `DeceasedCraft_Beta_DH_Edition_5.10.16`) persist indefinitely — +the cron finds them in the DB, uses them, and never reaches `pending_calibration`. + +## Live Panel DB Evidence + +``` +DeceasedCraft: current: DeceasedCraft_Beta_DH_Edition_5.10.16 ← stale filename +FTB Stoneblock: current: FTB StoneBlock 4 1.10.0 ← stale filename +ATM10 Sky: current: ATM10 To the Sky-2.0.2 ← stale filename +``` + +None of these are showing `pending_calibration` — they're all `update_available` +because the string comparison fails between the full filename and the clean +semver from the API. + +## Root Cause + +In `checkVersion()`, the DB fallback runs before pending_calibration: +```php +if (empty($currentVersion)) { + $currentVersion = $existing->current_version ?? null; // ← picks up stale value +} +// ...never reaches pending_calibration because $currentVersion is not empty +``` + +## The Fix + +For `installer` detection method, the DB fallback should be skipped OR the +stale value should be validated before use. + +**Option A (recommended):** For installer-method servers, only use DB value +if `current_file_id` is also set. If there's a current_version string but no +file_id, treat it as unvalidated and continue to Truth File / pending_calibration: + +```php +if (empty($currentVersion)) { + if ($method !== 'installer' || !empty($existing->current_file_id)) { + $currentVersion = $existing->current_version ?? null; + $currentFileId = $existing->current_file_id ?? null; + } +} +``` + +**Option B:** Detect "dirty" version strings — if current_version contains +spaces or looks like a full filename (contains the modpack name), treat as +unvalidated. + +Option A is cleaner and more reliable. + +## Expected Behavior After Fix + +- Servers with stale installer filenames → Truth File check → not found → + `pending_calibration` +- Servers that have been calibrated (have `current_file_id`) → use DB value + → normal comparison +- Servers where manifest.json was found → Truth File written → file ID + comparison going forward + +## Also — One Data Cleanup Needed + +After the fix, existing stale rows need to be cleared so the cron re-evaluates +them. Either: +1. Add a one-time migration that nulls `current_version` where `current_file_id` + is null and `detection_method = 'installer'` +2. Or document a manual SQL command Chronicler can run + +--- +*— Chronicler #85* diff --git a/services/modpack-version-checker/blueprint-extension/app/Console/Commands/CheckModpackUpdates.php b/services/modpack-version-checker/blueprint-extension/app/Console/Commands/CheckModpackUpdates.php index 301f33b..b10dcac 100644 --- a/services/modpack-version-checker/blueprint-extension/app/Console/Commands/CheckModpackUpdates.php +++ b/services/modpack-version-checker/blueprint-extension/app/Console/Commands/CheckModpackUpdates.php @@ -252,8 +252,11 @@ class CheckModpackUpdates extends Command ->where('server_uuid', $server->uuid) ->first(); - if (empty($currentVersion)) { - $currentVersion = $existing->current_version ?? null; + // Only use DB value if file_id is set (validated) OR detection wasn't installer + if (empty($currentVersion) && $existing) { + if ($method !== 'installer' || !empty($existing->current_file_id)) { + $currentVersion = $existing->current_version ?? null; + } } $currentFileId = $existing->current_file_id ?? null; diff --git a/services/modpack-version-checker/blueprint-extension/database/migrations/2026_04_13_000003_clear_stale_installer_versions.php b/services/modpack-version-checker/blueprint-extension/database/migrations/2026_04_13_000003_clear_stale_installer_versions.php new file mode 100644 index 0000000..96fb34d --- /dev/null +++ b/services/modpack-version-checker/blueprint-extension/database/migrations/2026_04_13_000003_clear_stale_installer_versions.php @@ -0,0 +1,28 @@ +where('detection_method', 'installer') + ->whereNull('current_file_id') + ->update([ + 'current_version' => null, + 'status' => 'pending_calibration', + ]); + } + + public function down(): void + { + // No rollback — data was stale + } +};