From 727e08b0acba8e2cbc29a592682fff63d149b376 Mon Sep 17 00:00:00 2001 From: NeyorDEV <180453958+NeyorDEV@users.noreply.github.com> Date: Wed, 21 Oct 2026 07:10:55 +0000 Subject: [PATCH 1/3] fix(core): explain updates that keep the same version number Real packs showed "3.3.6 -> 3.3.6" as an update for Packet Fixer, Stella, SkyOcean and others: their authors publish a separate file per Minecraft version under the same version number. The reason now says so, instead of looking like an error. --- src/core/engine.ts | 13 ++++++ test/core/rebuild.test.ts | 88 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 test/core/rebuild.test.ts diff --git a/src/core/engine.ts b/src/core/engine.ts index 771b38a..b222ab9 100644 --- a/src/core/engine.ts +++ b/src/core/engine.ts @@ -328,6 +328,7 @@ export async function analyzePack( reason: joinReasons( idNote, change && loaderChangeReason(change), + current && rebuildReason(current, best, target), fallback && fallbackReason(fallback, target), ), }); @@ -496,6 +497,18 @@ async function searchReplacements( return result; } +// Même numéro de version, autre fichier : l'auteur publie un fichier par version de Minecraft +// (ex. 1.13.2 pour 26.2 puis 1.13.2 pour 26.3). Sans cette précision, « 1.13.2 → 1.13.2 » +// ressemble à une erreur. +function rebuildReason( + current: ModrinthVersion, + best: ModrinthVersion, + target: MigrationTarget, +): string | undefined { + if (current.id === best.id || current.version_number !== best.version_number) return undefined; + return `Same version number, file built for Minecraft ${target.minecraftVersion}.`; +} + function compatLayerReason(hint: CompatLayerHint): string { return `Its ${getLoader(hint.runs as Loader).name} version could run through ${hint.name} (${COMPAT_LAYER_NOTE}; not added to the pack).`; } diff --git a/test/core/rebuild.test.ts b/test/core/rebuild.test.ts new file mode 100644 index 0000000..c9579b0 --- /dev/null +++ b/test/core/rebuild.test.ts @@ -0,0 +1,88 @@ +import { describe, expect, it } from 'vitest'; +import { analyzePack } from '../../src/core/engine.js'; +import type { ModrinthVersion } from '../../src/modrinth/types.js'; +import type { ModPack } from '../../src/types.js'; +import { renderTable } from '../../src/report/table.js'; +import { createFakeClient, loadCatalog } from '../helpers/fakeModrinth.js'; + +// Cas réel : Packet Fixer, Stella, SkyOcean… publient « 3.3.6 » pour 26.2 puis un autre fichier +// « 3.3.6 » pour 26.3. Le rapport affichait « 3.3.6 → 3.3.6 » sans explication. +function version(id: string, number: string, gameVersion: string, hash: string): ModrinthVersion { + return { + id, + project_id: 'REBUILD1', + name: id, + version_number: number, + game_versions: [gameVersion], + loaders: ['fabric'], + version_type: 'release', + date_published: '2024-09-01T00:00:00Z', + dependencies: [], + status: 'listed', + files: [ + { + hashes: { sha1: hash.repeat(20), sha512: hash.repeat(64) }, + url: `https://cdn.modrinth.com/data/fixture/${id}.jar`, + filename: `${id}.jar`, + primary: true, + size: 1000, + }, + ], + }; +} + +function catalog() { + const base = loadCatalog(); + base.projects.push({ + id: 'REBUILD1', + slug: 'rebuild-mod', + title: 'Rebuild Mod', + description: 'A mod republished for each Minecraft version.', + categories: ['utility'], + project_type: 'mod', + loaders: ['fabric'], + game_versions: ['1.20.1', '1.21.1'], + downloads: 1000, + }); + base.versions.push( + version('v1rebuild-old', '3.3.6', '1.20.1', 'c3'), + version('v1rebuild-new', '3.3.6', '1.21.1', 'c4'), + ); + return base; +} + +const pack: ModPack = { + source: 'mrpack', + minecraftVersion: '1.20.1', + loader: 'fabric', + mods: [ + { + fileName: 'rebuild-mod-3.3.6.jar', + path: 'mods/rebuild-mod-3.3.6.jar', + origin: 'index', + hashes: { sha1: 'c3'.repeat(20) }, + metadata: [], + }, + ], + otherFiles: [], + warnings: [], +}; + +describe('same version number rebuilt for the target', () => { + it('explains an update that keeps the version number', async () => { + const { client } = createFakeClient(catalog()); + const result = await analyzePack( + pack, + { minecraftVersion: '1.21.1', loader: 'fabric' }, + client, + ); + const mod = result.mods[0]; + expect(mod).toMatchObject({ + status: 'update-found', + currentVersion: { id: 'v1rebuild-old', versionNumber: '3.3.6' }, + targetVersion: { id: 'v1rebuild-new', versionNumber: '3.3.6' }, + reason: 'Same version number, file built for Minecraft 1.21.1.', + }); + expect(renderTable(result)).toContain('Same version number, file built for Minecraft 1.21.1.'); + }); +}); From a73818841bb1781c7f71c3c904dd27bb168e8cf2 Mon Sep 17 00:00:00 2001 From: NeyorDEV <180453958+NeyorDEV@users.noreply.github.com> Date: Wed, 21 Oct 2026 07:11:00 +0000 Subject: [PATCH 2/3] docs(changelog): record the same-version rebuild explanation --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1693594..30e3a8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ All notable changes to ModShift are documented here. The format follows ## [Unreleased] +### Fixed + +- An update that keeps the same version number (a file rebuilt for the target Minecraft + version, e.g. `3.3.6 → 3.3.6`) is now explained in the report instead of looking like an error. + ## [0.1.0] - 2026-10-20 First public version. From 7e54f5ee5b117cd37d2c049be984832a7f3ab62a Mon Sep 17 00:00:00 2001 From: NeyorDEV <180453958+NeyorDEV@users.noreply.github.com> Date: Wed, 21 Oct 2026 07:11:10 +0000 Subject: [PATCH 3/3] docs: format the README install section and regenerate its site page The README edit on main left a trailing space (Prettier check fails) and the generated installation page out of date (docs:pages check fails), so CI on main was red. --- README.md | 2 +- docs/guide/installation.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ae2a01..840d7dd 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ https://neyordev.github.io/ModShift/ once GitHub Pages is enabled. ModShift needs **Node.js 20.17+ or 22.13+**. ```bash -# From npm +# From npm npm install --global modshift # From source diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 54f671d..9d911fe 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -5,7 +5,7 @@ ModShift needs **Node.js 20.17+ or 22.13+**. ```bash -# From npm (once published) +# From npm npm install --global modshift # From source