Architecture: ApiClient autoload (HTTP + JWT + error contract) #29

Merged
reviewer-bot merged 7 commits from agent/5b3da417b50c into main 2026-08-19 15:45:01 +00:00
Showing only changes of commit ef21bf9d69 - Show all commits
+16 -1
View File
@@ -17,8 +17,23 @@ func _initialize() -> void:
func _run() -> void:
# _initialize() fires before the SceneTree has processed its first frame,
# so a freshly add_child()'d HTTPRequest node isn't reliably considered
# "inside tree" yet (request_raw fails with !is_inside_tree()). One frame
# of delay is enough; this only matters for --script mode, not a real
# running game.
await process_frame
# Godot's --script/SceneTree runner doesn't resolve autoload singletons
# as bare global identifiers at compile time (the node exists at
# runtime -- root.has_node("ApiClient") is true -- but referencing it as
# a plain identifier fails with "Identifier not found: ApiClient" during
# script compilation). get_node sidesteps compile-time resolution
# entirely. This only affects --script mode; a real game scene resolves
# the bare autoload name normally.
var api_client := root.get_node("ApiClient")
print("SMOKE: calling ApiClient.health_check() ...")
var result: Dictionary = await ApiClient.health_check()
var result: Dictionary = await api_client.health_check()
print("SMOKE: result = ", result)
if result.ok \