feat(builder): documented launch options only, and no game-specific code
Launch options must be documented. A draft passed an option its server doesn't have; servers ignore unknown options, so it booted and passed every boot test while its setting did nothing. build now reads the pages research based the variant on, in full, and the drafter rejects any launch option in the startup command that none of them, nor the image's own scripts, mention. Shell tools' options (mkdir -p, [ -n ...]) are skipped; the check is off without sources. The builder is game-agnostic: - AUTHORING.md (the model's rules), the research prompt and the schema describe the rules without naming a game. - The draft prompt no longer includes real templates from the repo. Its format example is one invented server (no real command, options, ports or app id), checked by TestExampleTemplateFollowsTheRules. - Comments, help texts, BUILDER.md and test fixtures use invented names and values. - TestBuilderIsGameAgnostic reads every game's name and id from games/ and fails if any appears in the builder's code, tests, rules, schemas or docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dd92b6be4c
commit
8623ba2d7b
16 files changed
+395
-120
No files matched your search
@@ -6,21 +6,21 @@ import (
|
||||
)
|
||||
|
||||
func TestParseConfigFormats(t *testing.T) {
|
||||
// Palworld's Unreal-style list
|
||||
pal := parseConfig("/server/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini", "[/Script/Pal.PalGameWorldSettings]\n"+
|
||||
`OptionSettings=(Difficulty=None,ExpRate=1.000000,ServerName="Default Palworld Server",CrossplayPlatforms=(Steam,Xbox,PS5,Mac))`)
|
||||
want := map[string]string{"Difficulty": "None", "ExpRate": "1.000000", "ServerName": "Default Palworld Server", "CrossplayPlatforms": "(Steam,Xbox,PS5,Mac)"}
|
||||
if len(pal) != len(want) {
|
||||
t.Fatalf("palworld: got %d settings: %+v", len(pal), pal)
|
||||
// An Unreal-style option list
|
||||
list := parseConfig("/server/Game/Saved/Config/LinuxServer/GameSettings.ini", "[/Script/Game.WorldSettings]\n"+
|
||||
`OptionSettings=(Difficulty=None,ExpRate=1.000000,ServerName="Default Server",CrossplayPlatforms=(Steam,Xbox,PS5,Mac))`)
|
||||
want := map[string]string{"Difficulty": "None", "ExpRate": "1.000000", "ServerName": "Default Server", "CrossplayPlatforms": "(Steam,Xbox,PS5,Mac)"}
|
||||
if len(list) != len(want) {
|
||||
t.Fatalf("option list: got %d settings: %+v", len(list), list)
|
||||
}
|
||||
for _, s := range pal {
|
||||
for _, s := range list {
|
||||
if s.Section != "OptionSettings" || want[s.Key] != s.Value {
|
||||
t.Errorf("palworld setting %+v", s)
|
||||
t.Errorf("option list setting %+v", s)
|
||||
}
|
||||
}
|
||||
|
||||
// Minecraft's server.properties
|
||||
mc := parseConfig("/data/server.properties", "#Minecraft server properties\nmax-players=20\nmotd=A Minecraft Server\nlevel-seed=\n")
|
||||
// A server.properties file
|
||||
mc := parseConfig("/data/server.properties", "#Server properties\nmax-players=20\nmotd=A Server\nlevel-seed=\n")
|
||||
if len(mc) != 3 || mc[0].Key != "max-players" || mc[0].Value != "20" || mc[2].Value != "" {
|
||||
t.Errorf("properties: %+v", mc)
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func TestAnalyzeLines(t *testing.T) {
|
||||
{At: 2, Source: "console", Text: "Failed to load optional module"},
|
||||
{At: 9, Source: "console", Text: "[09:00:01 INFO]: Done (8.1s)! For help, type \"help\""},
|
||||
{At: 9, Source: "console", Text: "[09:00:01 INFO]: Thread RCON Listener started"},
|
||||
// After the stop at 200s: the shutdown, as Minecraft's runner prints it
|
||||
// After the stop at 200s: the shutdown, as a wrapper script prints it
|
||||
{At: 201, Source: "console", Text: "[06:01:39] [RCON Listener #1/INFO]: Thread RCON Client /0:0:0:0:0:0:0:1 started"},
|
||||
{At: 202, Source: "console", Text: "2026-10-25T06:01:39.976Z\tINFO\tmc-server-runner\tDone"},
|
||||
}, []logLine{{At: -1, Source: "/server/x.log", Text: "Listening on 0.0.0.0:7777"}}, 200)
|
||||
@@ -90,13 +90,13 @@ func TestAnalyzeLines(t *testing.T) {
|
||||
|
||||
func TestConfigCandidates(t *testing.T) {
|
||||
for rel, want := range map[string]bool{
|
||||
"server.properties": true,
|
||||
"Pal/Saved/Config/LinuxServer/x.ini": true,
|
||||
"ShooterGame/Saved/Logs/ShooterGame.log": true,
|
||||
"steamapps/appmanifest_123.acf": false,
|
||||
"Engine/Config/BaseEngine.ini": false,
|
||||
"plugins/Geyser/config.yml": false,
|
||||
"world/level.dat": false,
|
||||
"server.properties": true,
|
||||
"Game/Saved/Config/LinuxServer/x.ini": true,
|
||||
"Game/Saved/Logs/Server.log": true,
|
||||
"steamapps/appmanifest_123.acf": false,
|
||||
"Engine/Config/BaseEngine.ini": false,
|
||||
"plugins/SomePlugin/config.yml": false,
|
||||
"world/level.dat": false,
|
||||
} {
|
||||
if got := isConfigCandidate(rel, 1000); got != want {
|
||||
t.Errorf("isConfigCandidate(%q) = %v, want %v", rel, got, want)
|
||||
|
||||
Reference in new issue
Block a user