Fix: skip stale DB versions for installer-detected servers without file_id
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) <noreply@anthropic.com>
This commit is contained in:
parent
88a3744289
commit
cef0d8465e
@@ -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*
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Clear stale current_version values from installer-detected servers
|
||||
* that have no file_id. These are full filenames from the modpack
|
||||
* installer that aren't valid for version comparison.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('modpackchecker_servers')
|
||||
->where('detection_method', 'installer')
|
||||
->whereNull('current_file_id')
|
||||
->update([
|
||||
'current_version' => null,
|
||||
'status' => 'pending_calibration',
|
||||
]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// No rollback — data was stale
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user