current_schema_version() line-scanned res://../project.yaml at runtime. That resolves to the repo root in a dev run and to nothing in an exported build, so a shipped game got the "?.?.?" fallback every time. Since that tag is the Atlas disk cache's ONLY invalidation signal, every exported build stamped and compared the same sentinel: a canvas cached by one build would be served by every later build, forever. T-1239 is what that failure looks like once it happens. loading_screen.gd carried a byte-for-byte copy of the same function, so the version shown to the player was "?.?.?" in exactly the builds where a version string is worth showing. Both call sites now share client/scripts/build_version.gd, which reads application/config/version out of ProjectSettings — a value Godot bakes into the PCK, identical in the editor and in an export by construction rather than by luck. No file IO, no fallback branch. project.yaml stays the source of truth (CLAUDE.md); client/project.godot mirrors it. A mirror nobody checks would be worse than the bug it replaces -- the old code failed loudly everywhere, a stale mirror fails silently -- so tooling/check-client-version compares the two and the pre-push hook runs it unconditionally. Not gated on "were those files in this push": drift persists on main once introduced, and gating would let an existing drift ride along. The test this replaces asserted that current_schema_version() did not return its fallback, and passed -- in the one environment where the code under test worked. Three tests now pin the property that actually matters: a real version, sourced from the baked setting, matching project.yaml. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
32 lines
1.5 KiB
GDScript
32 lines
1.5 KiB
GDScript
extends RefCounted
|
|
|
|
## The running client's version string — the ONE place anything asks (T-1241).
|
|
##
|
|
## Reads `application/config/version` out of ProjectSettings, which Godot bakes
|
|
## into the exported PCK. That is the whole point: two call sites previously
|
|
## line-scanned `res://../project.yaml` at runtime, which resolves to the repo
|
|
## root in a dev run and TO NOTHING in an exported build — both returned their
|
|
## "?.?.?" fallback in a shipped game.
|
|
##
|
|
## For the Atlas disk cache (D-255, step_canvas_disk_cache.gd) that was not a
|
|
## cosmetic defect: the version tag is that cache's ONLY invalidation signal, so
|
|
## a constant sentinel meant every exported build stamped and compared the same
|
|
## string and a canvas cached by one build would be served by every later build,
|
|
## forever. T-1239 is what that failure looks like when it happens — eight days
|
|
## of a map drawn from a canvas whose generating code no longer existed.
|
|
##
|
|
## No file IO and no fallback branch, deliberately. A missing setting returns ""
|
|
## and callers can see that; there is no environment where this reads one thing
|
|
## in the editor and another in an export, which is exactly the property the
|
|
## project.yaml scan lacked.
|
|
##
|
|
## `project.yaml` remains the source of truth for the version (CLAUDE.md); the
|
|
## ProjectSettings entry is a mirror, and `tooling/check-client-version` fails
|
|
## the push if the two drift.
|
|
|
|
const SETTING_KEY: String = "application/config/version"
|
|
|
|
|
|
static func current() -> String:
|
|
return str(ProjectSettings.get_setting(SETTING_KEY, ""))
|