bridge: REQ-2026-04-16-mc-versioning — Gemini-approved fix for 26.x.x versioning

This commit is contained in:
Claude
2026-04-16 07:30:56 +00:00
parent 76a2aafba4
commit ed1ae82825

View File

@@ -0,0 +1,103 @@
# REQ-2026-04-16-mc-versioning
**From:** Chronicler #93
**Date:** 2026-04-16
**Priority:** HIGH — blocks all version detection in installer
**Status:** PENDING
**Consultation:** docs/consultations/gemini-modpack-installer-versioning-2026-04-16.md
---
## Context
Minecraft switched to calendar-based versioning in December 2025. Current version is `26.1.2`, not `1.21.4`. Our installer has hardcoded `1.21.1` as "latest" and the `javaVersionForMC()` function doesn't handle the new scheme. Gemini consulted, architecture locked.
---
## Changes Required
### 1. Replace `javaVersionForMC()` in modpack-installer.js
```javascript
function javaVersionForMC(mcVersion) {
const major = parseInt(mcVersion.split('.')[0]);
if (major >= 26) return 21; // New 2026+ calendar scheme
if (major === 1) {
const minor = parseInt(mcVersion.split('.')[1]);
if (minor >= 21) return 21;
if (minor >= 17 && minor <= 20) return 17;
if (minor <= 16) return 8;
}
return 21; // Frostwall fallback
}
```
### 2. Replace hardcoded version lists with live DB-backed lookups
Add a new DB table `mc_versions` to cache available versions:
```sql
CREATE TABLE mc_versions (
version VARCHAR(20) PRIMARY KEY,
java_version INT NOT NULL DEFAULT 21,
paper_supported BOOLEAN DEFAULT FALSE,
forge_supported BOOLEAN DEFAULT FALSE,
neoforge_supported BOOLEAN DEFAULT FALSE,
fabric_supported BOOLEAN DEFAULT FALSE,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
```
Add a pg-boss cron job that runs at 3AM daily:
- Hit Paper API for supported versions
- Hit Modrinth `/tag/game_version` for all MC versions
- Sort with `semver.rsort()` (add `semver` to package.json)
- Upsert into `mc_versions` table
Routes that currently show hardcoded version dropdowns should query this table instead.
### 3. Update NextCloud mod stack lookup in modpackInstaller.js
Replace direct path lookup with exact-then-fallback strategy:
```javascript
async function getNextCloudModStack(mcVersion) {
const exactPath = `standard-mods/${mcVersion}/`;
const baseRelease = mcVersion.split('.').slice(0, 2).join('.');
const fallbackPath = `standard-mods/${baseRelease}/`;
if (await webdav.exists(exactPath)) return exactPath;
if (await webdav.exists(fallbackPath)) return fallbackPath;
throw new Error(`Mod stack missing for both ${exactPath} and ${fallbackPath}`);
}
```
### 4. Update vanilla form version list
Replace hardcoded MC version list in `_vanilla_form.ejs` with dynamic fetch from `mc_versions` table (Paper-supported versions only).
### 5. Update modpack search version filter
Replace hardcoded `1.21.1` option in `index.ejs` search filter with dynamic list from `mc_versions`.
---
## Notes
- `standard-mods/1.21.1/` has been renamed to `standard-mods/26.1.2/` in NextCloud — the 5 mods are already there
- NextCloud WebDAV correct path: `/remote.php/dav/files/mkrause612@gmail.com/`
- Add `semver` to package.json
---
## Migration
Migration 145: `mc_versions` table (see SQL above)
## Deploy
Standard pattern. Run migration 145 + npm install (semver) + restart.