Public: anyone can read this; the crew can change it.
Games survival step 4: admin mods (luckperms fabric, ledger with fabric-language-kotlin) #18148
Merged 5h 6m ago, live in production
mason/forge:mason/18090-games-survival-step-4-admin-mods-luckper → main 0 commits fork 1 thread · 1 unresolved
4 files
changed +68
−4
docs/features/game-mods.md +2 −1
| @@ -11,6 +11,7 @@ The server's mods or plugins come from Modrinth, for its loader and game version | ||
| 11 | 11 | - **Install and restart** is one commit on the commit you previewed: the lockfile `<compose dir>/modrinth/<service>.lock.json` (each project's version id, file path, url and sha512, and whether it was asked for or is a dependency) and the compose env made from it: `MODRINTH_PROJECTS` lists `slug:versionId` for every project and `MODRINTH_DOWNLOAD_DEPENDENCIES=none`, so the image fetches exactly the locked set. A proxy also gets `MINECRAFT_VERSION`, which its Modrinth step needs. On a proxy whose servers sleep, `MODRINTH_PROJECTS` also holds AutoStopper (`PG4gqnzX:EclCtvWk`, see [](games.md)): it is sleep's, so a Modrinth change carries it over as it is and never lists it as the proxy's own, and Warm again takes only that entry. |
| 12 | 12 | - **Sets**: a named set installs in one preview and one commit. `set:survival` is the survival performance set for a Fabric server: Lithium, ScalableLux, Noisium and Chunky, each at its newest release for the server's Minecraft version, with what they require (Chunky needs Fabric API). It adds only what is missing, and a server on another loader is refused with the reason. The web Mods block shows it with a *Preview the set* button until it is installed; the terminal shows the same lines and `s` previews it; MCP `mods_install` takes `project: "set:survival"`. |
| 13 | 13 | - **Quality of life**: `set:quality` is graves (Universal Graves), Essential Commands, Styled Chat, Right Click Harvest and Sleep Warp (the night skips while players sleep) for a Fabric server, installed like the survival set but optional by member: each is resolved alone, and one with no build for the server's Minecraft version (Right Click Harvest on 1.21.6) is left out with the reason ("Left out rightclickharvest: …") while the rest install; if none builds, it is refused. Essential Commands ships every command on; trimming it to /home, /spawn and /tpa is its config, which the owner sets, and the plan says so on a "Before players join" line, on the page and in the terminal. Each set shows a sentence on what it is for, and the web block offers *Preview the Quality of life set*, the terminal's key is `q`, MCP `mods_install` takes `project: "set:quality"`. |
| 14 | - **The admin set**, `set:admin`, is LuckPerms (who may run which command) and Ledger (a block log with rollback) for a Fabric server. Ledger needs Fabric Language Kotlin, so the plan adds it as a dependency and the lock holds all three by sha512; removing Ledger takes that dependency with it, which is the way back. Each is the newest release for the server's Minecraft version; where Ledger has none yet the plan is refused with that reason and nothing is written. The web block offers *Preview the Admin set* and the terminal previews it with `r`. | |
| 14 | 15 | - **Updates** post the locked sha512s to Modrinth's `/v2/version_files/update` (releases for the loader and version) and show "2 updates" as from → to, one click each or all. |
| 15 | 16 | - **Remove** takes a project and what only it required; a dependency something else requires stays. |
| 16 | 17 | |
| @@ -29,7 +30,7 @@ The image does not check a pack's file hashes (its Modrinth project path does; i | ||
| 29 | 30 | ## Where |
| 30 | 31 | |
| 31 | 32 | - **Web:** `/games/<box>/<service>`, the Mods (or Plugins) block: updates, what is installed, Search, Preview, Install and restart; on a mod server, the Modpack block: the pack, its locked files, Search packs, Preview, Install pack and restart. |
| 32 | - **Terminal:** a service's screen, `m`: `/` search, `a` install by a result's number or a slug, `s` the survival performance set, `q` the quality-of-life set, `u` update all, `d` remove, `p` a modpack by slug; `y` commits the preview shown, `n` drops it (`src/tui/screens/game_mods.ts`). | |
| 33 | - **Terminal:** a service's screen, `m`: `/` search, `a` install by a result's number or a slug, `s` the survival performance set, `q` the quality-of-life set, `r` the admin set, `u` update all, `d` remove, `p` a modpack by slug; `y` commits the preview shown, `n` drops it (`src/tui/screens/game_mods.ts`). | |
| 33 | 34 | - **MCP:** `games` with `mods`, `mods_search`, `mods_pack_search`, `mods_install`, `mods_update`, `mods_remove`, `mods_pack`; a change is planned until `dryRun: false`. |
| 34 | 35 | |
| 35 | 36 | All three read and write through `src/games/mods.ts`, over the client in `src/games/modrinth.ts`. |
src/games/mod_sets.ts +19 −1
| @@ -75,8 +75,26 @@ export const QUALITY: ModSet = Object.freeze({ | ||
| 75 | 75 | ]), |
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | /** | |
| 79 | * The admin set (#18090, step 4 of #18059): who may do what, and a block log that can roll back. | |
| 80 | * Ledger needs Fabric Language Kotlin, which the planner pulls and locks as its dependency, so the | |
| 81 | * rollback is installed with everything it stands on, each by sha512. | |
| 82 | */ | |
| 83 | export const ADMIN: ModSet = Object.freeze({ | |
| 84 | name: "admin", | |
| 85 | title: "Admin", | |
| 86 | key: "r", | |
| 87 | about: "Permission groups and a block log with rollback for a Fabric server.", | |
| 88 | loader: "fabric", | |
| 89 | slugs: Object.freeze(["luckperms", "ledger"]), | |
| 90 | why: Object.freeze([ | |
| 91 | "LuckPerms: permission groups and who may run which command", | |
| 92 | "Ledger: logs every block and container change, and rolls a griefer back (needs Fabric Language Kotlin)", | |
| 93 | ]), | |
| 94 | }); | |
| 95 | ||
| 78 | 96 | /** Every set a `project` value can name. */ |
| 79 | export const SETS: readonly ModSet[] = Object.freeze([SURVIVAL, QUALITY]); | |
| 97 | export const SETS: readonly ModSet[] = Object.freeze([SURVIVAL, QUALITY, ADMIN]); | |
| 80 | 98 | |
| 81 | 99 | /** The set a `project` value names (`set:survival`), if there is one. */ |
| 82 | 100 | export function setNamed(ref: string): ModSet | undefined { |
src/http/mcp/tools/games.ts +1 −1
Diff not shown — a line 3,125 characters wide (limit 2,000). +1 −1
View filetest/game-mods.test.ts +46 −1
| @@ -158,6 +158,8 @@ const PROJECTS = [ | ||
| 158 | 158 | { id: "SLid0001", slug: "scalablelux", title: "ScalableLux" }, |
| 159 | 159 | { id: "NOid0001", slug: "noisium", title: "Noisium" }, |
| 160 | 160 | { id: "FPid0001", slug: "fabric-api", title: "Fabric API" }, |
| 161 | { id: "LEid0001", slug: "ledger", title: "Ledger" }, | |
| 162 | { id: "FKid0001", slug: "fabric-language-kotlin", title: "Fabric Language Kotlin" }, | |
| 161 | 163 | ]; |
| 162 | 164 | const FABRIC = ["fabric"]; |
| 163 | 165 | const PAPER = ["paper", "spigot"]; |
| @@ -215,6 +217,18 @@ const VERSIONS: V[] = [ | ||
| 215 | 217 | { id: "LIv00001", project: "LIid0001", number: "0.17.0", date: "2025-01-01", games: ["1.21.4"], loaders: FABRIC, hash: "1a" }, |
| 216 | 218 | { id: "SLv00001", project: "SLid0001", number: "0.1.5", date: "2025-01-02", games: ["1.21.4"], loaders: FABRIC, hash: "1b" }, |
| 217 | 219 | { id: "NOv00001", project: "NOid0001", number: "2.0", date: "2025-01-03", games: ["1.21.4"], loaders: FABRIC, hash: "1c" }, |
| 220 | { id: "LPv00009", project: "LPid0001", number: "5.5.10", date: "2025-01-06", games: ["1.21.4"], loaders: FABRIC, hash: "2a" }, | |
| 221 | { id: "FKv00001", project: "FKid0001", number: "1.13.0", date: "2025-01-06", games: ["1.21.4"], loaders: FABRIC, hash: "2b" }, | |
| 222 | { | |
| 223 | id: "LEv00001", | |
| 224 | project: "LEid0001", | |
| 225 | number: "1.3.13", | |
| 226 | date: "2025-01-06", | |
| 227 | games: ["1.21.4"], | |
| 228 | loaders: FABRIC, | |
| 229 | hash: "2c", | |
| 230 | deps: [{ project_id: "FKid0001", version_id: null, dependency_type: "required" }], | |
| 231 | }, | |
| 218 | 232 | { id: "FPv00001", project: "FPid0001", number: "0.119.2", date: "2025-01-04", games: ["1.21.4"], loaders: FABRIC, hash: "1d" }, |
| 219 | 233 | { |
| 220 | 234 | id: "CHv00002", |
| @@ -783,7 +797,10 @@ describe("the survival performance set", () => { | ||
| 783 | 797 | expect(lock.projects.map((p) => p.slug).sort()).toEqual(SLUGS); |
| 784 | 798 | expect(lock.projects.every((p) => p.sha512.length === 128)).toBe(true); |
| 785 | 799 | // Installed: no longer offered, and planning it again says so. |
| 786 | expect(await (await asAlice("/games/net/smp")).text()).not.toContain("Preview the Survival performance set"); | |
| 800 | const page = await (await asAlice("/games/net/smp")).text(); | |
| 801 | expect(page).not.toContain("Preview the Survival performance set"); | |
| 802 | expect(page).not.toContain("Preview installing the survival performance set"); | |
| 803 | expect(page).toContain("Preview the Admin set"); | |
| 787 | 804 | expect(await planInstall(app, await mods("smp"), "smp", "set:survival")).toMatchObject({ ok: false, error: expect.stringContaining("is installed") }); |
| 788 | 805 | }); |
| 789 | 806 | |
| @@ -973,3 +990,31 @@ describe("room on the box (#18025)", () => { | ||
| 973 | 990 | expect(refusal(await planFor(said(512)))).not.toContain("MiB free"); |
| 974 | 991 | }); |
| 975 | 992 | }); |
| 993 | ||
| 994 | describe("the admin set", () => { | |
| 995 | test("a plan holds LuckPerms, Ledger and Fabric Language Kotlin, and writes nothing", async () => { | |
| 996 | const planned = await planInstall(app, await mods("smp"), "smp", "set:admin"); | |
| 997 | if (!planned.ok) throw new Error(planned.error); | |
| 998 | expect(planned.value.lock.map((l) => l.slug)).toEqual(expect.arrayContaining(["fabric-language-kotlin", "ledger", "luckperms"])); | |
| 999 | expect(planned.value.lines).toEqual(expect.arrayContaining(["Adds Ledger 1.3.13", "Adds Fabric Language Kotlin 1.13.0 (required by Ledger)"])); | |
| 1000 | expect(planned.value.lock.find((l) => l.slug === "fabric-language-kotlin")!.top).toBe(false); | |
| 1001 | }); | |
| 1002 | ||
| 1003 | test("a Paper server is refused, and the page and the terminal offer it on a Fabric one", async () => { | |
| 1004 | expect(await planInstall(app, await mods("hub"), "hub", "set:admin")).toMatchObject({ ok: false, error: expect.stringContaining("Fabric servers") }); | |
| 1005 | expect(await planInstall(app, await mods("smp"), "smp", "set:nothing")).toMatchObject({ error: expect.stringContaining("set:survival, set:quality, set:admin") }); | |
| 1006 | const page = await (await asAlice("/games/net/smp")).text(); | |
| 1007 | expect(page).toContain("Ledger: logs every block"); | |
| 1008 | expect(await (await asAlice("/games/net/smp?add=set:admin")).text()).toContain("Adds Ledger 1.3.13"); | |
| 1009 | }); | |
| 1010 | ||
| 1011 | test("one commit locks them, and removing Ledger takes its Kotlin dependency back", async () => { | |
| 1012 | const r = await asAlice("/games/net/smp/mods/install", { project: "set:admin", sha: (await mods("smp")).sha }); | |
| 1013 | expect(r.status).toBe(303); | |
| 1014 | const locked = (await mods("smp")).lock.map((l) => l.slug); | |
| 1015 | expect(locked).toEqual(expect.arrayContaining(["luckperms", "ledger", "fabric-language-kotlin"])); | |
| 1016 | const removed = await planRemove(await mods("smp"), "smp", "ledger"); | |
| 1017 | if (!removed.ok) throw new Error(removed.error); | |
| 1018 | expect(removed.value.lock.map((l) => l.slug)).not.toContain("fabric-language-kotlin"); | |
| 1019 | }); | |
| 1020 | }); |
new above
offline