Skip to content

Unit testing and close source sync#194

Open
SCDerox wants to merge 7 commits into
mainfrom
with-testing
Open

Unit testing and close source sync#194
SCDerox wants to merge 7 commits into
mainfrom
with-testing

Conversation

@SCDerox

@SCDerox SCDerox commented Jun 2, 2026

Copy link
Copy Markdown
Member

Changes applied to most modules

Unless noted otherwise, the modified modules received some combination of:

  • Formatting - reformatted to the repository's ESLint (@stylistic) conventions (brace spacing, multi-line
    destructuring). No behavior change.
  • Unit-test hooks - internal helper functions exported (e.g. module.exports.__test = { ... }) so the logic can be
    unit-tested. No behavior change.
  • Migrations - modules with database schema changes had their migrations moved from the old
    "migrate inside botReady.js" approach to the new file-based Umzug migration system
    under modules/<module>/migrations/.

Per-module changes

color-me - author: hfgd

  • Added error handling around role creation (gracefully handles Discord's "max roles reached" error 30005 and logs
    failures with context) and a unit-test export.

connect-four - author: TomatoCake

  • Exported the game-logic functions (win detection, board rendering) for unit testing. No behavior change.

economy-system - author: jateute

  • Bug fix: the work/crime payouts called randomIntFromInterval(max, min) with the arguments swapped; corrected to
    (min, max).
  • Ported the schema migrations to the Umzug system (economy_User__V1, economy_Cooldown__V1, economy_Shop__V1),
    replacing the old destructive sync({force:true}) re-insert migration in botReady.js.
  • Added unit-test exports; removed a stray developer note and leftover debug console.log statements that logged user IDs.

massrole - author: hfgd

  • Exported the target-resolution helper for unit testing. No behavior change.

nicknames - author: hfgd

  • Re-architected onto the shared Nickname Manager service. Removed
    renameMember.js and the old botReady.js full re-scan; added onLoad.js (registers a nickname provider) and
    persistExternalEditAsBase.js (persists manual nickname edits as the new base name). guildMemberUpdate.js was
    rewritten to drive updates through the manager, skip the guild owner, and detect external edits.
  • The new files (onLoad.js, persistExternalEditAsBase.js) and the manager itself are intentionally lightly
    commented; the system is documented in developer-docs/nickname-manager.md.

ping-protection - author: Kevin

  • Reformatted to repo style; switched to the shared safeSetFooter helper and minor adjustments to the
    administrator-permission checks. Behavior otherwise preserved.

quiz - author: TomatoCake

  • Feature: quiz questions can now carry an optional image (with URL validation) and headline/title. Added the
    corresponding slash-command options, config field, and model columns, plus an Umzug migration (quiz_QuizList__V1).
  • Switched the duration parser to the in-repo src/functions/parseDuration wrapper.

rock-paper-scissors - author: TomatoCake

  • Exported the winner-resolution / game-state helpers for unit testing. No behavior change.

staff-management-system - author: Kevin

  • Reformatted to repo style; added unit-test exports and an Umzug migration (staff-management-system_ActivityCheck__V1).
    Behavior otherwise preserved.

starboard - author: TomatoCake

  • Bug fixes: added a missing await on the starboard handlers; fetch partial messages before use; made the
    member-role check null-safe (msg.member?.roles).

temp-channels - author: hfgd

  • Added support for the v4 message schema (renders the allowed-users list as a TextDisplayBuilder component when the
    message uses "_schema": "v4", falling back to the previous text append otherwise).
  • Ported the schema migrations (TempChannel__V1, __V2) to the Umzug system.

twitch-notifications - author: jateute

  • Upgraded the Twitch auth to @twurple v8 (AppTokenAuthProvider); credentials are still read from the module's
    configs/config.json (twitchClientID / clientSecret).
  • Extracted the stream-state decision logic into a pure classifyStreamUpdate function (exported for unit testing).

uno - author: TomatoCake

  • Exported the card/turn/render helpers for unit testing. No behavior change.

Fixes #195

…ing VIEW_CHANNEL deny. Add regression test.
@Kevinking500

Copy link
Copy Markdown
Contributor

Looks good for my modules. Though this will likely conflict with eachother if either get released first with my hotfix PR for my modules, I think you can probably add those changes into this PR, and close mine? Idk

SCDerox and others added 2 commits June 9, 2026 17:49
Resolves conflict in staff-management.js (kept with-testing's template
clone block). Also takes with-testing's commands/ping-protection.js, since
the hotfix's brace/list change there targeted the old public structure and
broke when combined with the synced version (its functional fix lives in
interactionCreate.js, which merged cleanly). All hotfix fixes verified intact.
@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm caniuse-lite is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/jest@30.4.2npm/caniuse-lite@1.0.30001793

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001793. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm caniuse-lite is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/jest@30.4.2npm/caniuse-lite@1.0.30001793

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001793. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm caniuse-lite is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/jest@30.4.2npm/caniuse-lite@1.0.30001793

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001793. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm caniuse-lite is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/jest@30.4.2npm/caniuse-lite@1.0.30001793

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001793. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm validator is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package-lock.jsonnpm/sequelize@6.37.8npm/umzug@3.8.3npm/validator@13.15.26

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/validator@13.15.26. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

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.

Invite Tracking Module is Absent

2 participants