Fix startup, tests and CI: 1099 tests now pass - #1
Merged
Conversation
The bot could not start. Seventeen modules imported sanitiseForDisplay from format.js, which does not export it — an ESM SyntaxError at instantiation, so loadRegistry() threw before the Discord client was constructed. It shipped because no check had ever run. No lockfile was committed, so actions/setup-node with cache:npm killed both verify jobs at step 3 and every later step showed 'skipped'. npm run syntax, which detects the import bug in seconds, had never executed. Startup and tooling: - Re-export sanitiseForDisplay from utils/format.js - Commit package-lock.json and make the CI cache conditional - Add load: true so the built Docker image reaches the daemon - Add LICENSE, correct REQUIRED_TESTS, add an import-resolution check - node --test tests/*.test.js, since Node 24 rejects a bare directory Then the suite ran for the first time and found 25 problems. Source: - toFiniteNumber accepted anything Number() could coerce, so an empty array rendered as '0 B' rather than 'Unknown' - CONTROL_CHARS_RE lacked the g flag, so sanitiseForDisplay stripped only the first control character, and omitted the U+202A-202E bidi override range - Number(null) is 0, which three call sites trusted: a null session TTL gave a zero-millisecond lifetime and a null cooldown silently disabled throttling - joinSections filtered the help menu's deliberate blank line, which shifted every command line up one position and made two commands vanish from paging - assertValidInteger accepted 1e3 and 0x10 as page numbers - withResponse is unsupported on the pinned discord.js 14.16.3 - onRetry was unguarded, so a logging failure could mask a panel error Tests: a panel double that did not record its rollback call, a panelServerId collision in a fixture, four cases asserting that trimming should reject rather than normalise, and an assertion that String(bigint) is lossy — it is not, String(number) is. 56 files parse, 404 named imports resolve, 29 audit checks pass, 1099 tests pass.
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.
Summary
The bot could not start. Seventeen modules imported
sanitiseForDisplayfromformat.js, which does not export it — an ESMSyntaxErrorat instantiation,so
loadRegistry()threw before the Discord client was constructed.It shipped because no check had ever run. No lockfile was committed, so
actions/setup-nodewithcache: npmkilled both verify jobs at step 3.Verified locally
npm run syntaxnpm run auditnpm testWhat this fixes in CI
Run #8 on
mainfailed 3 of 4 jobs. Both verify jobs died atAudit the projecton three false positives in the audit script itself, and the secretsjob matched the audit's own token-shaped placeholder. All four are fixed here.
Not verified
No runtime behaviour against a real Pterodactyl panel or Discord gateway.