Skip to content

Refactor net_cmd_ms validation into schema-based parsing#190

Closed
OmniTroid wants to merge 4 commits into
Crystalwarrior:masterfrom
OmniTroid:ms-refactor
Closed

Refactor net_cmd_ms validation into schema-based parsing#190
OmniTroid wants to merge 4 commits into
Crystalwarrior:masterfrom
OmniTroid:ms-refactor

Conversation

@OmniTroid

Copy link
Copy Markdown
Collaborator

Replace ~350 lines of repetitive if/elif validation code with a data-driven approach using schema definitions and a helper method.

  • Add _MS_BASE_FIELDS, _MS_26_FIELDS, _MS_28_FIELDS, _MS_DRO_FIELDS as class attributes defining field names and types for each protocol
  • Add _MS_SCHEMAS list to try schemas from most to least complete
  • Add _MS_DEFAULTS dict for optional field default values
  • Add _parse_ms_args() helper that validates against schemas and handles DRO ding normalization and pair_order extraction
  • Simplify net_cmd_ms() to use the new helper

DISCLAIMER: This was refactored by Claude Code. The end goal seems quite bounded and straightforward. Should be tested with the various clients/protocols it supports.

OmniTroid and others added 3 commits January 23, 2026 11:02
Replace ~350 lines of repetitive if/elif validation code with a
data-driven approach using schema definitions and a helper method.

- Add _MS_BASE_FIELDS, _MS_26_FIELDS, _MS_28_FIELDS, _MS_DRO_FIELDS
  as class attributes defining field names and types for each protocol
- Add _MS_SCHEMAS list to try schemas from most to least complete
- Add _MS_DEFAULTS dict for optional field default values
- Add _parse_ms_args() helper that validates against schemas and
  handles DRO ding normalization and pair_order extraction
- Simplify net_cmd_ms() to use the new helper

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@OmniTroid

Copy link
Copy Markdown
Collaborator Author

Separated ms parsing into different file as this is 10x more complex than anything else.

@OmniTroid OmniTroid closed this Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant