fix: forward -- args through devbox scripts, fail serve loudly (#84)

devbox 0.17.2 runs .devbox/gen/scripts/<name>.sh with the args as positional
parameters but does not append "$@", so tools/serve.sh (and seed, bench,
mutation, import-scale, fogbench) saw an empty argv and a documented
`serve -- --image=...` silently served the default 4096 scene. End every
argument-taking script body with "$@".

serve: --dry-run parses and prints the options without building; unknown
options, non-numeric ports/tile sizes and --tile-size without --image fail
loudly; a no-image start prints the current map read from state.db; NixOS
gets security.pki.certificateFiles instead of the Debian trust steps.

Guard the faults import in worldmap/vision/markers with
`when defined(leakfault)` (it is only used inside those blocks), removing
the three UnusedImport warnings; leakfault builds still compile.

tools/devboxargs.test.mjs goes through `devbox run <script> -- <args>` for
serve (dry-run, unknown flag, tile-size without image) and seed (--help,
unknown flag), the seam the direct-tool tests missed.
This commit is contained in:
2026-11-21 21:35:39 +01:00
parent c8b5289a3d
commit 30b35592c7
9 changed files with 190 additions and 15 deletions
+3 -1
View File
@@ -26,7 +26,9 @@
## No DB transaction control here: the caller owns it, exactly like explored.nim.
import std/[math, options, strutils, tables]
import db_connector/db_sqlite
import faults, geometry, tokens, vision, world
import geometry, tokens, vision, world
when defined(leakfault):
import faults # faultActive() is only referenced inside the leakfault blocks below (#84)
proc anchorOf*(w: WallRec): (int, int) =
## The wall's drawn midpoint, rounded once to integer px and fixed for the wall (5.8, 6.1).
+3 -1
View File
@@ -28,7 +28,9 @@
## moves; a re-earn gets a fresh id. `markerFresh`/`markerDead` hold the markers minted/retracted by
## the current refresh so the mutation's transaction can persist them (server/markers.nim).
import std/[algorithm, math, sets, tables]
import tokens, worldmap, geometry, world, faults
import tokens, worldmap, geometry, world
when defined(leakfault):
import faults # faultActive() is only referenced inside the leakfault block below (#84)
type
Poly* = object
+3 -1
View File
@@ -15,7 +15,9 @@
## copies a token record before it applies an outcome, and a Nim seq assignment shares its buffer, so
## in-place edits would reach the authoritative list before the transaction commits (4.2 step 6).
import std/options
import geometry, moverules, tokens, world, faults
import geometry, moverules, tokens, world
when defined(leakfault):
import faults # faultActive() is only referenced inside the leakfault blocks below (#84)
proc geometryWalls*(sc: SceneRec, forSight = false): seq[Wall] =
## The scene's walls as the vision and move code see them. Each wall carries its stored switches: