Conversation
- Updated the dashboard initialization to include modloader versions. - Added a console log statement to confirm dashboard initialization. fix: Update Makefile for improved logging and cleanup - Changed Python command to use the PYTHON variable for consistency. - Enhanced logging levels for server startup. - Improved cleanup process in the Makefile. feat: Add documentation generation script - Introduced a new script to generate Markdown documentation for events. - Updated event handling to include descriptions in the XML configuration. fix: Improve error handling in bus message decoding - Added error logging for message decoding failures in the Bus class. - Enhanced event argument conversion to utilize the new encoding/decoding functions. refactor: Streamline event argument handling - Removed deprecated type mapping in EventArg class. - Updated argument conversion methods to use the new encode/decode functions. feat: Enhance user interface for version listing - Modified the user interface to return Version objects directly. - Improved API endpoints for fetching Minecraft and Forge versions. chore: Add utility functions for nested string splitting - Implemented a function to split strings while ignoring nested structures. - Added tests for the new utility function to ensure correctness. style: Update regex patterns for type matching - Enhanced regex patterns to match Python type hints for dicts, lists, and tuples.
… and event decoding
…oper file path for events.md
There was a problem hiding this comment.
Pull Request Overview
This PR updates the system to version 0.1.2 with comprehensive improvements to event handling, user interface, and development tooling. The changes refactor the argument handling system to use new encoding/decoding functions, enhance API endpoints to return Version objects directly, and add significant development infrastructure.
- Streamlined event argument handling by replacing deprecated type mapping with new encode/decode functions
- Enhanced user interface to return Version objects directly instead of strings in API endpoints
- Added comprehensive development tooling including documentation generation, improved Makefile, and VSCode workspace configuration
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/utils/regex.py | Added regex patterns for Python type hints and encoded data structures |
| server/src/utils/misc.py | Added utility function for nested string splitting with comprehensive tests |
| server/src/user_interface/web_server/http_server.py | Updated type annotations, improved error handling, and fixed variable naming conflicts |
| server/src/user_interface/Base_interface.py | Modified API methods to return Version objects directly instead of converting from strings |
| server/src/gen_doc.py | New script for generating Markdown documentation from event definitions |
| server/src/events_descriptions.json | New JSON file containing event descriptions for documentation generation |
| server/src/decode_event.py | Added raw mode option for event decoding |
| server/src/core/core.py | Added validation for required configuration paths |
| server/src/bus/events.xml | Updated XML schema and cleaned up comments |
| server/src/bus/events.py | Major refactor replacing type mapping with new encode/decode functions |
| server/src/bus/bus.py | Enhanced error handling for message decoding failures |
| pyproject.toml | Added new documentation generation script and package data |
| makefile | Improved Python variable consistency and enhanced logging configuration |
| forge-server-manager.code-workspace | Added comprehensive VSCode tasks and UI improvements |
| client/src/dashboard/dashboard.ts | Added modloader version initialization and console logging |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…dating usage in HttpServer
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if args.raw: | ||
| print(f"Decoded string: {decoded_string}") | ||
| else: | ||
| event, event_args = decode_event(decoded_string) | ||
| print_event(event, event_args) |
There was a problem hiding this comment.
The else block should be moved outside the if args.prefix block. Currently, if args.raw is True, the event decoding and printing logic will be skipped entirely, regardless of the prefix flag.
| server_path = data.get("path") | ||
| autostart = str2bool(data.get("autostart", "false")) | ||
|
|
||
| autostart = data.get("autostart", False) |
There was a problem hiding this comment.
The autostart parameter is extracted but the validation logic on line 329 still expects it to be converted from string. Either remove the str2bool conversion logic or keep using str2bool here.
| autostart = data.get("autostart", False) | |
| autostart = data.get("autostart", False) | |
| if isinstance(autostart, str): | |
| autostart = str2bool(autostart) |
| if server_type != "vanilla" and not modloader_version or not isinstance(modloader_version, str): | ||
| Logger.debug("Invalid modloader_version") | ||
| return {"message": "Invalid parameters"}, HTTP.BAD_REQUEST | ||
| modloader_version = Version.from_string(modloader_version) if modloader_version else None | ||
| if not modloader_version: | ||
| Logger.debug("Modloader version is required for non-vanilla servers") | ||
| return {"message": "Invalid parameters"}, HTTP.BAD_REQUEST | ||
| modloader_version = Version.from_string(modloader_version) |
There was a problem hiding this comment.
This validation incorrectly requires modloader_version for all server types. The check should only apply when server_type != 'vanilla' as indicated by the error message.
| # if version is in the form of x.y.z-dev-aaaa or x.y.z-dev+aaaa, set it to x.y.z-dev | ||
| # VERSION_STR = $(shell echo $(VERSION) | sed 's/-dev-[a-z0-9]*//') | ||
| VERSION_STR = $(shell echo $(VERSION) | sed 's/-dev-[a-z0-9]*//; s/-dev+.*//') | ||
| # VERSION_STR = $(shell echo $(VERSION) | sed 's/-dev-[a-z0-9]*\/\/') |
There was a problem hiding this comment.
Corrected comment has invalid sed syntax with '//' at the end.
| # VERSION_STR = $(shell echo $(VERSION) | sed 's/-dev-[a-z0-9]*\/\/') | |
| # VERSION_STR = $(shell echo $(VERSION) | sed 's/-dev-[a-z0-9]*//') |
Features
Versionobjects directly.Fixes
PYTHONvariable consistently.Refactor
EventArg.Chore/Tests
Style
dict,list, andtuple.Potential Impact / Notes
Versionobjects may require minor adjustments for any consumers that relied on primitive values.Versionreturn type consideration.How to Test
Versionobjects as intended.