feat(builder): launch options must appear in the research sources
The Valheim draft in #13 passed -maxplayers, an option Valheim doesn't have. The server ignores unknown options, so the draft booted and passed every boot test while its MaxPlayers 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. The model gets it back to remove or spell correctly. Options of shell tools (mkdir -p, [ -n ...]) are skipped. The check is off when there are no sources (draft run by hand, no reader). Against #13's 11 real sources it flags -maxplayers and nothing else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dd92b6be4c
commit
8b49895d5e
6 files changed
+158
-3
No files matched your search
+26
-1
@@ -138,7 +138,8 @@ func build(o buildOptions) (*buildResult, error) {
|
||||
steamApp = o.variant.SteamAppID
|
||||
}
|
||||
d, err := newDrafter(draftJob{GamesDir: o.gamesDir, SchemaDir: o.schemaDir, Name: o.name, ID: o.id, Image: res.Image,
|
||||
SteamApp: steamApp, Notes: variantNotes(o.variant, o.notes), Report: report, Provider: o.provider, Model: o.model, NoPull: true})
|
||||
SteamApp: steamApp, Notes: variantNotes(o.variant, o.notes), Report: report, Provider: o.provider, Model: o.model, NoPull: true,
|
||||
Docs: sourceText(o.variant.Sources)})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -370,3 +371,27 @@ func buildSummary(o buildOptions, res *buildResult) string {
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// sourceText reads the pages research based the variant on, in full, so the drafter can check that every
|
||||
// launch option the model uses is documented there. Empty (check skipped) without a reader.
|
||||
func sourceText(sources []string) string {
|
||||
reader := os.Getenv("READER_URL")
|
||||
if reader == "" || len(sources) == 0 {
|
||||
fmt.Println("[build] no research sources to check launch options against (READER_URL or sources missing)")
|
||||
return ""
|
||||
}
|
||||
var b strings.Builder
|
||||
read := 0
|
||||
for _, s := range sources {
|
||||
text, err := readPageLimit(reader, s, 200_000)
|
||||
if err != nil {
|
||||
fmt.Printf("[build] could not read %s: %v\n", s, err)
|
||||
continue
|
||||
}
|
||||
read++
|
||||
b.WriteString(text)
|
||||
b.WriteString("\n")
|
||||
}
|
||||
fmt.Printf("[build] read %d of %d research sources to check launch options against\n", read, len(sources))
|
||||
return b.String()
|
||||
}
|
||||
Reference in new issue
Block a user