feat: validate allocated assignment manifest

This commit is contained in:
Josh Creek
2026-08-31 20:38:56 +01:00
parent ecc78b7a2a
commit 698413cd91
4 changed files with 36 additions and 20 deletions
+6 -2
View File
@@ -70,6 +70,8 @@ static func specs() -> Array[Spec]:
out.append(Spec.new("match-id", Kind.STRING, "", "allocation", "Opaque allocated match identifier"))
out.append(Spec.new("server-id", Kind.STRING, "", "allocation", "Opaque allocated server identifier"))
out.append(Spec.new("playlist-version", Kind.STRING, "", "allocation", "Matchmaking playlist contract version"))
out.append(Spec.new("client-build", Kind.STRING, "", "allocation", "Expected immutable client build identifier"))
out.append(Spec.new("assignment-expiry-unix", Kind.INT, 0, "allocation", "Unix expiry for the allocated assignment; must be in the future"))
out.append(Spec.new("server-image-digest", Kind.STRING, "", "allocation", "Expected immutable server image digest (sha256:...)"))
out.append(Spec.new("transport", Kind.STRING, "", "allocation", "Assigned transport: steam_sdr or enet"))
out.append(Spec.new("region", Kind.STRING, "", "allocation", "Assigned region: EU or NA"))
@@ -259,9 +261,11 @@ func _validate() -> void:
if not rotation in ["sequential", "random"]:
errors.append("--arena-rotation must be sequential or random, got '%s'" % rotation)
if bool(values["allocated-mode"]):
for key in ["match-id", "server-id", "playlist-version", "server-image-digest", "transport", "region"]:
for key in ["match-id", "server-id", "playlist-version", "client-build", "assignment-expiry-unix", "server-image-digest", "transport", "region"]:
if String(values[key]).is_empty():
errors.append("--allocated-mode requires --%s" % key)
if int(values["assignment-expiry-unix"]) <= int(Time.get_unix_time_from_system()):
errors.append("--assignment-expiry-unix must be in the future")
var digest := String(values["server-image-digest"])
if not _is_sha256_digest(digest):
errors.append("--server-image-digest must be sha256:<64 hex characters>")
@@ -307,7 +311,7 @@ static func help_text() -> String:
lines.append("")
lines.append("The command line overrides the config file, which overrides the defaults")
lines.append("shown below. An unknown flag is an error, not a warning.")
var sections := ["general", "network", "match", "logging"]
var sections := ["general", "network", "match", "logging", "allocation"]
var all := specs()
for section in sections:
lines.append("")