feat: add POST /v1/rooms/{roomId}/global-variables endpoint#360
Merged
feat: add POST /v1/rooms/{roomId}/global-variables endpoint#360
Conversation
Add support for updating global variables per room via the FastAPI REST bridge, mirroring the existing client-variables endpoint.
- Add GlobalVarStore class for in-memory queued room-level global vars
- Add MAX_GLOBAL_VARS = 100 constant (matches server default)
- Add RoomBridge.apply_global_now_or_queue / _apply_global / flush_global_vars
- Update RoomBridge._loop to flush global vars when connected
- Add POST /v1/rooms/{room_id}/global-variables endpoint
- Add httpx dev dependency for FastAPI TestClient
- Add test_rest_bridge.py with 19 unit/endpoint tests
Closes #357
Co-authored-by: Masahiro Yamaguchi <from2001@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds room-scoped global variable updates to the FastAPI REST bridge, enabling REST clients to set NetSync global variables per room (issue #357).
Changes:
- Introduces
GlobalVarStore+MAX_GLOBAL_VARSand extendsRoomBridgeto apply/flush queued global variables. - Adds
POST /v1/rooms/{room_id}/global-variablesendpoint returning per-key state. - Adds REST bridge unit/endpoint tests and adds
httpxto dev dependencies for FastAPITestClient.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
STYLY-NetSync-Server/src/styly_netsync/rest_bridge.py |
Adds global-var queue/store, bridge apply/flush logic, and the new REST endpoint. |
STYLY-NetSync-Server/tests/test_rest_bridge.py |
Adds unit tests for GlobalVarStore, RoomBridge global behavior, and endpoint validation/response. |
STYLY-NetSync-Server/pyproject.toml |
Adds httpx to dev deps to support FastAPI TestClient. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
|
@0suu The feature was implemented. Test the feature with your environment. This is a sample command to update global variables. |
…iables endpoint details
Collaborator
|
@from2001 Other than that, I verified the behavior of the new endpoint and everything looks good. LGTM. |
0suu
approved these changes
Mar 6, 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.
Closes #357
Add support for updating global variables per room via the FastAPI REST bridge.
Changes
GlobalVarStoreclass for in-memory queued room-level global variablesMAX_GLOBAL_VARS = 100constant (matches server default)RoomBridge.apply_global_now_or_queue/_apply_global/flush_global_varsRoomBridge._loopnow flushes global vars when connectedPOST /v1/rooms/{room_id}/global-variableshttpxadded as dev dependency for FastAPI TestClienttests/test_rest_bridge.pywith 19 unit/endpoint testsGenerated with Claude Code