docs(website): add Discord bot test plan #29

Merged
whitlocktech merged 1 commits from docs/bot-test-plan into main 2026-07-21 06:06:01 +00:00
Member

What & why

Adds website/test-plan.md — the test plan for the bot/ workspace, the last of the three website npm workspaces without a suite. The server and client suites landed in website PR #86; this documents how the bot follows the same path.

It's a plan, not code: it records the shared conventions and maps out the meaningful bot behavior to lock, so the eventual bot suite is a straightforward build rather than a design exercise.

Contents

  • Philosophy + harnessnode --test, zero external test deps, DB pool at a dead port, Discord Client/Message/Member hand-faked (the bot is CommonJS, so it mirrors the server suite verbatim).
  • Units to cover, high-value first and grounded in the actual code:
    • pure logic — normalize (leetspeak/repeat folding + word-boundary matching, including the documented gaps), duration, spamFilter (rate-limit side effect, mass-mention/emoji thresholds);
    • single-collaborator units — inviteFilter (fail-closed on unresolvable), siteApiClient (never-throws {ok} contract + maintenance branch), requireInternalKey (401 / fail-closed-empty / timing-safe);
    • the messageFilter pipeline — bypass-first decision order, fixed-duration mute, best-effort recording never breaking moderation;
    • models with real shaping logic.
  • Out of scope — discord.js internals, the live gateway, thin command wrappers, cron firing.
  • CI + SonarQube wiring and a suggested phasing, both mirroring PR #86.

How it was tested

Docs-only. Prose verified against bot/src (filter/, utils/duration.js, discord/messageFilter.js, site/siteApiClient.js, internal/requireInternalKey.js); companion links (website-README.md, BACKEND_DESIGN.md) resolve.

Checklist

  • I have read CONTRIBUTING.md.
  • The change builds and existing tests/checks pass locally.
  • I have added or updated tests/docs where it makes sense.
  • My commits are reasonably scoped with clear messages.

AI-assisted contributions (required)

  • AI tools were used. Tool(s): Claude Code (Opus 4.8). I have reviewed and understand every change, and take responsibility for it. AI-authored commits are marked with a Co-Authored-By trailer.

License

  • I agree that my contribution is licensed under this project's license (GNU GPL v3.0 or later), and I have the right to contribute it.

🤖 Generated with Claude Code

## What & why Adds `website/test-plan.md` — the test plan for the **`bot/` workspace**, the last of the three `website` npm workspaces without a suite. The server and client suites landed in website [PR #86](https://gitea.whitlocktech.com/RunicGateway/website/pulls/86); this documents how the bot follows the same path. It's a **plan**, not code: it records the shared conventions and maps out the meaningful bot behavior to lock, so the eventual bot suite is a straightforward build rather than a design exercise. ### Contents - **Philosophy + harness** — `node --test`, zero external test deps, DB pool at a dead port, Discord `Client`/`Message`/`Member` hand-faked (the bot is CommonJS, so it mirrors the server suite verbatim). - **Units to cover**, high-value first and grounded in the actual code: - pure logic — `normalize` (leetspeak/repeat folding + word-boundary matching, *including the documented gaps*), `duration`, `spamFilter` (rate-limit side effect, mass-mention/emoji thresholds); - single-collaborator units — `inviteFilter` (fail-closed on unresolvable), `siteApiClient` (never-throws `{ok}` contract + maintenance branch), `requireInternalKey` (401 / fail-closed-empty / timing-safe); - the `messageFilter` pipeline — bypass-first decision order, fixed-duration mute, best-effort recording never breaking moderation; - models with real shaping logic. - **Out of scope** — discord.js internals, the live gateway, thin command wrappers, cron firing. - **CI + SonarQube wiring** and a **suggested phasing**, both mirroring PR #86. ## How it was tested Docs-only. Prose verified against `bot/src` (`filter/`, `utils/duration.js`, `discord/messageFilter.js`, `site/siteApiClient.js`, `internal/requireInternalKey.js`); companion links (`website-README.md`, `BACKEND_DESIGN.md`) resolve. ## Checklist - [x] I have read CONTRIBUTING.md. - [x] The change builds and existing tests/checks pass locally. - [x] I have added or updated tests/docs where it makes sense. - [x] My commits are reasonably scoped with clear messages. ## AI-assisted contributions (required) - [x] AI tools were used. Tool(s): `Claude Code (Opus 4.8)`. I have reviewed and understand every change, and take responsibility for it. AI-authored commits are marked with a `Co-Authored-By` trailer. ## License - [x] I agree that my contribution is licensed under this project's license (**GNU GPL v3.0 or later**), and I have the right to contribute it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wtclaude added 1 commit 2026-07-21 06:02:06 +00:00
Document the test plan for the bot/ workspace — the last of the three website
npm workspaces without a suite (server + client landed in website PR #86).
Records the shared node --test conventions (no jest/vitest/jsdom; DB pool at a
dead port; Discord objects hand-faked) and maps the meaningful bot behavior to
lock: the normalize/duration/spam pure logic, the invite/site-api/internal-key
single-collaborator units, the messageFilter pipeline (bypass-first decision
order + fixed-duration mute + best-effort recording), and the models with real
shaping logic. Includes the CI + SonarQube coverage wiring to mirror PR #86 and
a suggested phasing.

Co-Authored-By: Claude <noreply@anthropic.com>
whitlocktech approved these changes 2026-07-21 06:03:11 +00:00
whitlocktech merged commit c3062f9960 into main 2026-07-21 06:06:01 +00:00
whitlocktech deleted branch docs/bot-test-plan 2026-07-21 06:06:01 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: RunicGateway/docs#29
No description provided.