Summary
When a requested environment is already recorded in environments.json, main.py:67 draws the text "Loading existing environment, please wait..." onto the display surface but never flushes it:
if env_key in environments:
graphik.drawText("Loading existing environment, please wait...", displayWidth/2, displayHeight/2, 20, "white")
env_id = environments[env_key]["environment_id"]
try:
environment = environmentService.get_environment_by_id(env_id)
No pygame.display.update() follows on the success path. The next update on that path is main.py:124, inside the render loop — and it is preceded by gameDisplay.fill(white) at main.py:122, which erases the message before it is ever presented. The message is therefore drawn to a surface that is cleared before the first flip.
Contrast with the creation path
The sibling branch does flush, at main.py:80-81:
graphik.drawText("Creating environment, please wait...", 400, 400, 20,"white")
pygame.display.update()
The two branches are intended to be parallel; only one of them actually presents its message.
Why it matters
Loading a cached environment issues a blocking call to Viron's get_environment_by_id, followed by a blocking get_locations_in_environment at main.py:120. For a large grid this is exactly the interval during which the user needs feedback, and the window instead shows an unpainted surface. The error path at main.py:74-76 does call update(), so a failure is visible while the wait that precedes it is not.
Suggested resolution
Add pygame.display.update() immediately after the drawText call at main.py:67, matching the creation path.
A secondary consideration: the creation path hardcodes the text position as 400, 400 rather than displayWidth/2, displayHeight/2 as the cached path does. Aligning the two would be a reasonable part of the same change, though it is cosmetic and only differs once displayWidth / displayHeight stop being 800.
Acceptance criteria
- The cached-environment path presents its progress message before the blocking service call is issued.
- The behavior is verified by a run against a Viron instance with a grid size already present in
environments.json, or by a headless run with the Viron services stubbed, asserting that pygame.display.update() is called before get_environment_by_id.
This issue body was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson
Summary
When a requested environment is already recorded in
environments.json,main.py:67draws the text"Loading existing environment, please wait..."onto the display surface but never flushes it:No
pygame.display.update()follows on the success path. The next update on that path ismain.py:124, inside the render loop — and it is preceded bygameDisplay.fill(white)atmain.py:122, which erases the message before it is ever presented. The message is therefore drawn to a surface that is cleared before the first flip.Contrast with the creation path
The sibling branch does flush, at
main.py:80-81:The two branches are intended to be parallel; only one of them actually presents its message.
Why it matters
Loading a cached environment issues a blocking call to Viron's
get_environment_by_id, followed by a blockingget_locations_in_environmentatmain.py:120. For a large grid this is exactly the interval during which the user needs feedback, and the window instead shows an unpainted surface. The error path atmain.py:74-76does callupdate(), so a failure is visible while the wait that precedes it is not.Suggested resolution
Add
pygame.display.update()immediately after thedrawTextcall atmain.py:67, matching the creation path.A secondary consideration: the creation path hardcodes the text position as
400, 400rather thandisplayWidth/2, displayHeight/2as the cached path does. Aligning the two would be a reasonable part of the same change, though it is cosmetic and only differs oncedisplayWidth/displayHeightstop being 800.Acceptance criteria
environments.json, or by a headless run with the Viron services stubbed, asserting thatpygame.display.update()is called beforeget_environment_by_id.This issue body was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson