From 4f0155dda96932570f38057baea363ec9c081574 Mon Sep 17 00:00:00 2001 From: unimatrixgit <95320811+unimatrixgit@users.noreply.github.com> Date: Mon, 30 Nov 2026 20:31:05 +0100 Subject: [PATCH] Render canonical raw Melange Spice on Arrakis drops --- .forgejo/workflows/arrakis-raw-spice.yml | 44 +++++++++++++++++++ JarvisConnector/build.gradle.kts | 2 +- .../jarvis/ItemMetadataOverlay.java | 1 + JarvisConnector/src/main/resources/plugin.yml | 2 +- tools/install-plugin-fleet.py | 21 ++++++++- tools/navigator-transition.json | 7 +-- tools/plugin_arrakis_raw_spice.py | 28 ++++++++++++ 7 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 .forgejo/workflows/arrakis-raw-spice.yml create mode 100644 tools/plugin_arrakis_raw_spice.py diff --git a/.forgejo/workflows/arrakis-raw-spice.yml b/.forgejo/workflows/arrakis-raw-spice.yml new file mode 100644 index 00000000..991da2ed --- /dev/null +++ b/.forgejo/workflows/arrakis-raw-spice.yml @@ -0,0 +1,44 @@ +name: Arrakis Raw Spice Build +on: + workflow_dispatch: + push: + branches: ['fix/arrakis-raw-spice-*'] + +jobs: + raw-spice: + runs-on: dune-ci + steps: + - name: Check out exact revision + shell: bash + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + git init . + git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/plugins.git "$GITHUB_SHA" + git checkout --detach FETCH_HEAD + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + - uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: '9.2.1' + - name: Verify the Arrakis JARVIS-only transition + shell: bash + run: | + set -euo pipefail + gradle --no-daemon -p JarvisConnector test jar + python3 tools/test_plugin_fleet_install.py -v + python3 tools/plugin_arrakis_raw_spice.py JarvisConnector/build/libs/jarvistranslator.jar + mkdir raw-spice-artifacts + cp JarvisConnector/build/libs/jarvistranslator.jar raw-spice-artifacts/ + printf '%s\n' "$(git rev-parse HEAD)" > raw-spice-artifacts/SOURCE_COMMIT + python3 tools/write-plugin-manifest.py raw-spice-artifacts "$GITHUB_SHA" + cp tools/{install-plugin-fleet,plugin_arrakis_raw_spice,plugin_menu_pack,plugin_backend_abi,plugin_fleet_rollback,plugin_pack_properties,plugin_pillager_abi,reset-arrakis-terrain}.py raw-spice-artifacts/ + (cd raw-spice-artifacts && sha256sum -- *.jar *.json *.py SOURCE_COMMIT > SHA256SUMS) + - uses: actions/upload-artifact@v3 + with: + name: DuneRealms-Arrakis-Raw-Spice + path: raw-spice-artifacts/ + if-no-files-found: error diff --git a/JarvisConnector/build.gradle.kts b/JarvisConnector/build.gradle.kts index faba1ba8..0f34f47f 100644 --- a/JarvisConnector/build.gradle.kts +++ b/JarvisConnector/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java } group = "com.dunerealms" -version = "0.5.38-navigator1" +version = "0.5.39-rawspice1" repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/") } dependencies { compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT") diff --git a/JarvisConnector/src/main/java/com/dunerealms/jarvis/ItemMetadataOverlay.java b/JarvisConnector/src/main/java/com/dunerealms/jarvis/ItemMetadataOverlay.java index 7894ed12..77aab908 100644 --- a/JarvisConnector/src/main/java/com/dunerealms/jarvis/ItemMetadataOverlay.java +++ b/JarvisConnector/src/main/java/com/dunerealms/jarvis/ItemMetadataOverlay.java @@ -76,6 +76,7 @@ final class ItemMetadataOverlay implements Listener { // Commodity drops must not differ by miner, House or price changes. // Preserve Core's spice identity; do not add per-unit serial metadata. meta.setMaxStackSize(64); + meta.setItemModel(new NamespacedKey("dunerealms","spice_common")); meta.displayName(Component.text("Melange Spice",NamedTextColor.GREEN).decoration(TextDecoration.ITALIC,false)); meta.lore(List.of(Component.text("Harvested from the sands of Arrakis.",NamedTextColor.GRAY).decoration(TextDecoration.ITALIC,true))); } diff --git a/JarvisConnector/src/main/resources/plugin.yml b/JarvisConnector/src/main/resources/plugin.yml index df46c400..925656cb 100644 --- a/JarvisConnector/src/main/resources/plugin.yml +++ b/JarvisConnector/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: JarvisTranslator main: com.dunerealms.jarvis.JarvisTranslator -version: 0.5.38-navigator1 +version: 0.5.39-rawspice1 api-version: '1.21.8' description: Shared J.A.R.V.I.S. website API and native server action translator. softdepend: [Citizens, Citizens, CoreProtect, SCore, ExecutableItems, ExecutableCrafting, DuneEss, ImageFrame, DecentHolograms, MedievalFactions, Towny, WorldGuard] diff --git a/tools/install-plugin-fleet.py b/tools/install-plugin-fleet.py index 40eacb89..a1132d57 100644 --- a/tools/install-plugin-fleet.py +++ b/tools/install-plugin-fleet.py @@ -75,8 +75,9 @@ def verify_dunechest_fleet_target(sid, root, unit, incoming, installed): def plan(artifacts, inventory, expected_source): mode=inventory.get('mode') - if mode not in {'gui-preserve-backends','pillager-preserve-economy','arrakis-crysknife','navigator','planet-dunechest','fleet-dunechest'}: + if mode not in {'gui-preserve-backends','pillager-preserve-economy','arrakis-crysknife','navigator','planet-dunechest','fleet-dunechest','arrakis-raw-spice'}: raise ValueError('An explicit supported rollout mode is required') + raw_spice=mode=='arrakis-raw-spice' pillager=mode=='pillager-preserve-economy' crysknife=mode=='arrakis-crysknife' navigator=mode=='navigator' @@ -89,6 +90,10 @@ def plan(artifacts, inventory, expected_source): allowed_names = {'DuneEss', 'DuneRealms', 'DuneCore', 'DuneLobby', 'DuneNPC', 'DunerealmsGUI', 'DuneTerrain', 'JarvisTranslator', 'DuneMenus'} if dunechest: allowed_names={'DuneChest'} + if raw_spice: + allowed_names={'JarvisTranslator'} + if inventory.get('menuPack') is not None: + raise ValueError('Raw spice rollout must retain current resource pack configuration') files, names = {}, set() for entry in manifest['plugins']: name = entry['filename'] @@ -155,8 +160,11 @@ def plan(artifacts, inventory, expected_source): uses_menu='dunemenus' in wanted or bool(menu and menu.get('unified') and not (crysknife or dunechest)) if menu and menu.get('unified') and not (crysknife or dunechest) and 'dunerealmsgui' not in wanted: raise ValueError('Unified pack rollout must select its matching DunerealmsGUI adapter') - if not (pillager or crysknife or navigator or dunechest) and wanted - {'dunemenus','dunerealmsgui','dunenpc','dunelobby','mcgui'}: + if not (pillager or crysknife or navigator or dunechest or raw_spice) and wanted - {'dunemenus','dunerealmsgui','dunenpc','dunelobby','mcgui'}: raise ValueError('GUI rollout must retain working Ess/JARVIS/Core/Terrain binaries') + if raw_spice and (sid != 'arrakis' or root != ARRAKIS_ROOT or unit != 'dune-arrakis.service' + or wanted != {'jarvistranslator'} or selected_prerequisites): + raise ValueError('Raw spice rollout may only replace JARVIS on Arrakis') if crysknife and ( sid != 'arrakis' or unit != 'dune-arrakis.service' or root != ARRAKIS_ROOT @@ -311,6 +319,15 @@ def plan(artifacts, inventory, expected_source): replaced={entry['filename'] for entry in previous} retained=[{'filename':path.name,'sha256':digest(path),'metadata':metadata(path)} for path in sorted(plugins.glob('*.jar')) if path.name not in replaced] + if raw_spice: + from plugin_arrakis_raw_spice import BASELINE_SHA256, verify_jar + installed = existing_paths.get('jarvistranslator') + if installed is None or digest(installed) not in {BASELINE_SHA256, chosen[0]['sha256']}: + raise ValueError('Raw spice rollout requires the retained Arrakis JARVIS') + verify_jar(chosen[0]['source']) + replaced = {entry['filename'] for entry in previous} + retained = [{'filename': path.name, 'sha256': digest(path), 'metadata': metadata(path)} + for path in sorted(plugins.glob('*.jar')) if path.name not in replaced] configurations = [] if uses_menu or crysknife or dunechest: if menu is None: diff --git a/tools/navigator-transition.json b/tools/navigator-transition.json index 20929974..e49249cd 100644 --- a/tools/navigator-transition.json +++ b/tools/navigator-transition.json @@ -53,9 +53,10 @@ } }, "JarvisTranslator": { - "version": "0.5.38-navigator1", + "version": "0.5.39-rawspice1", "changedClasses": [ "com/dunerealms/jarvis/GuildTransport.class", + "com/dunerealms/jarvis/ItemMetadataOverlay.class", "com/dunerealms/jarvis/JarvisTranslator.class", "com/dunerealms/jarvis/OrganisationTransport.class", "com/dunerealms/jarvis/SharedGameApi.class" @@ -67,13 +68,13 @@ "com/dunerealms/jarvis/CrysknifeRules.class", "com/dunerealms/jarvis/HomeSmugglerTransport.class" ], - "retainedTreeSha256": "296d4823a7a721355d741bd3d6179911d03825c2f8b20b079bbc3489683536ee" + "retainedTreeSha256": "fa0170f6f542233abc3b918e18fdd5dd40f18f1731792a9cf9237387075b8b0f" }, "1128d8d1a9ab7b0d257089e52c46c9a7dc6096e3b8bfbf241169474d503ee5ab": { "addedClasses": [ "com/dunerealms/jarvis/HomeSmugglerTransport.class" ], - "retainedTreeSha256": "34711cc8b84d1477a5270f21dc672404c77fc8e41af7769018c57a22ad107182" + "retainedTreeSha256": "dadf275ef5f27a9a8cba75d80ef3d1a58958c0eb75a767b8b9fb94d30059f891" } } } diff --git a/tools/plugin_arrakis_raw_spice.py b/tools/plugin_arrakis_raw_spice.py new file mode 100644 index 00000000..c32342d4 --- /dev/null +++ b/tools/plugin_arrakis_raw_spice.py @@ -0,0 +1,28 @@ +from pathlib import Path +import hashlib +import zipfile + +BASELINE_SHA256 = 'ebe8d2edc9f3300a039de1f76b81a2435895569704b2087e0625db699effe5d7' +OVERLAY = 'com/dunerealms/jarvis/ItemMetadataOverlay.class' +RETAINED_TREE = '80df0c65f8d85bcac8dd52c620197f4013a7f17e48a422ef8da1d451674c2' +DESCRIPTOR_SHA256 = '5d953df8bfa49bc5e57a698c018ea24bba3253a53d291ac6e48dd03d7e162a5a' + + +def verify_jar(path): + with zipfile.ZipFile(path) as jar: + names = [name for name in jar.namelist() if not name.endswith('/')] + if len(set(names)) != len(names): + raise ValueError('Duplicate JARVIS archive entry') + if b'spice_common' not in jar.read(OVERLAY): + raise ValueError('Raw spice model missing from ItemMetadataOverlay') + if hashlib.sha256(jar.read('plugin.yml')).hexdigest() != DESCRIPTOR_SHA256: + raise ValueError('JARVIS descriptor differs outside the reviewed version') + rows = [name + '\0' + hashlib.sha256(jar.read(name)).hexdigest() + for name in sorted(names) if name not in {OVERLAY, 'plugin.yml'}] + if hashlib.sha256('\n'.join(rows).encode()).hexdigest() != RETAINED_TREE: + raise ValueError('JARVIS changed outside the reviewed raw spice overlay and version') + + +if __name__ == '__main__': + import sys + verify_jar(Path(sys.argv[1]))