Repository navigation
Read the Viron address from the environment in both entry points - #62
Merged
Merged
Conversation
main.py and console_view.py each hardcoded http://localhost:9999, so reaching a Viron elsewhere meant editing both. viron_address.py, which does not import Pygame, now reads PATCHWORK_VIRON_URL and PATCHWORK_VIRON_PORT, with the old address as the default. The README also warns that environments.json is not keyed by server, so it should not be carried over to a different Viron. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric, scored against head
Findings:
Do-not-auto-merge check: no This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
viron_address.pyis added, withgetVironAddress(), which readsPATCHWORK_VIRON_URLandPATCHWORK_VIRON_PORT. Pygame is not imported, soconsole_view.pycan use it, andhttp://localhost:9999remains the default.main.pyandconsole_view.pyread the address from it. Theirurlandportconstants are removed.:<port>/api/...to it and the port would otherwise land in the path. An invalid port prints a message and falls back to9999, as an invalid grid size does inparseArgs.Starting Vironsection states how the address is changed.The
PATCHWORK_prefix followsPATCHWORK_USAGE_REPORTING_KEY.environments.jsonrecords environments by grid size alone, so a cache written against one Viron would be read against another once the address changes. That could fail to load, or resolve to an unrelated environment with the same ID. The README now says to delete the file or use another working directory. The file format was left alone as out of scope for #60.Viron,render_window.py,graphik.pyand the workflow file are unchanged.headless_run.pychanges only in a docstring.Closes #60
Test plan
python3 -m unittest discover -s tests: 205 tests executed, all passing, 13 of them newpython3 -m py_compileon every top-level module, includingviron_address.pypython3 headless_run.py: all three scenarios PASSmain.pyandconsole_view.pyunmodified: both entry points were run through the realLocationServiceandEnvironmentServiceagainst local stand-in servers on:9999and:18099.main()ran with--exit-after-createon the real Pygame under SDL's dummy driver. With no variables set, requests arrived on:9999. WithPATCHWORK_VIRON_URL=http://127.0.0.1/andPATCHWORK_VIRON_PORT=18099, requests arrived on:18099only. WithPATCHWORK_VIRON_PORT=nope, the message was printed and requests arrived on:9999main.pyandconsole_view.py, and removing the trailing-slash handling, failed exactly 3 tests. The source was then restored and the suite re-runpython3 main.py 10 --exit-after-createcould not be run against a real server hereWhy this PR is held for a human
The address passed to
LocationServiceandEnvironmentServiceinmain()is changed, so this diff touches a service call site, and Phase 4 of the dev loop requires the live anchor for that. The anchor did not run, so the pre-authorized merge was not used.Three limits of the substitute should be known:
EnvironmentService, so the unmodified source was compiled in a scratch script with postponed annotations.For the reviewer, a run of
python main.py 10 --exit-after-createagainst a local Viron with no variables set covers the default. SettingPATCHWORK_VIRON_PORTto anything else should then fail to connect, which confirms the override is honoured.Notes for review
viron_address.pyjoins the README's exceptions to the workflow'spy_compilelist, for the same reason as the two modules in The workflow's py_compile step omits text_renderer.py and console_view.py #61, and a comment there records the third. The suite imports it, so a syntax error still fails CI.getVironAddress()is called inmain()even when both services are supplied, so an invalid port prints its message there too. The simpler call was kept over a guard for that case.Issues not picked
.github/workflows/needs a human merge, and that PR would have held up every later cycle while gaining no coverage.Locationcarries no grid ID.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson