Skip to content

fix: validate help module selections - #119

Open
vycdev2 wants to merge 2 commits into
vycdev:developfrom
vycdev2:fix/validate-help-module-selection-20260809
Open

fix: validate help module selections#119
vycdev2 wants to merge 2 commits into
vycdev:developfrom
vycdev2:fix/validate-help-module-selection-20260809

Conversation

@vycdev2

@vycdev2 vycdev2 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Validate help-module component selections before parsing page and module data.
  • Return a friendly recovery embed instead of throwing on malformed interaction data.
  • Add focused coverage for valid and malformed selection identifiers.

Verification

  • dotnet restore
  • dotnet build --no-restore
  • dotnet test Morpheus.Tests/Morpheus.Tests.csproj --no-restore --filter FullyQualifiedName~HelpCommandRegistrationTests
  • Full suite: 304 passed, 2 known globalization-invariant baseline failures in NormalizeTimeUntilEventName_NormalizesCase because tr-TR is unavailable in this environment.
  • git diff --check passed.
  • Repository-wide dotnet format remains blocked by pre-existing line-ending/whitespace findings across the checkout.

This was generated by an AI agent (vycdev2). Please verify any changes before merging or applying.

@vycdev2
vycdev2 force-pushed the fix/validate-help-module-selection-20260809 branch from 2b4f123 to e1cc5b0 Compare August 9, 2026 22:36

vycdev commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Two malformed interaction cases still need coverage before this is safe to merge:

  • messageComponent.Data.Values.First() still throws when Discord supplies no selected value. Please use FirstOrDefault() (and allow the parser/recovery path to handle null) or validate the collection before reading it.
  • TryParseHelpModuleName accepts values such as 2147483647_StocksModule. Later, (page - 1) * HelpPageSize overflows to a negative index and visibleCommands[i] throws. Please calculate the start index without overflow and reject pages outside the selected module's actual page range.

Please add regression tests for an absent selection and an overflowing/out-of-range page. The current branch otherwise integrates cleanly with develop; its existing focused tests and the full 388-test suite pass.

@vycdev2
vycdev2 force-pushed the fix/validate-help-module-selection-20260809 branch from e1cc5b0 to 0524c44 Compare August 11, 2026 02:06
@vycdev2

vycdev2 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the malformed interaction cases and rebased onto current develop in 0524c44:

  • empty selections now use FirstOrDefault() and flow to the invalid-page response; page bounds use overflow-safe arithmetic and reject pages beyond the selected module’s visible command count; regression coverage includes null selection, out-of-range pages, and int.MaxValue.

Verification: dotnet build passed; focused help tests passed 13/13; full suite passed 440 with 1 skipped; git diff --check passed.

This was generated by an AI agent (vycdev2). Please verify any changes before merging or applying.

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.

2 participants