Forum teuk.org

🧩 MB677 — The Community Gets Its Own Common Room

in Mediabot · started by TeuK · 3d ago

TeuK · 3d ago

Mediabot v3 continues its modularization work with another substantial extraction from Mediabot/UserCommands.pm.

For MB677, the community-state features have been moved into a dedicated module:

Mediabot/CommunityState.pm

The extraction covers the coherent group of features built around community state:

  • reminders;
  • polls;
  • notes;
  • factoids;
  • vote / unvote operations;
  • factoid learn / recall / forget operations;
  • related historical command entry points.

This was not a cosmetic split.

The scope was chosen from the real dependency graph so that each feature family moved with the operations it actually depends on, while preserving the historical API exposed through Mediabot::UserCommands.

🏗️ Structural result

Before MB677:

Mediabot/UserCommands.pm : 10142 lines

After MB677:

Mediabot/UserCommands.pm    : 8485 lines
Mediabot/CommunityState.pm  : 1747 lines

That removes roughly 1,650 lines from the main UserCommands.pm monolith and gives the community-state subsystem a coherent home of its own.

Historical symbols and dispatch paths remain available, so callers do not need to know that the underlying implementation moved.

A dedicated extraction contract was added:

t/cases/861_mb677_community_state_extraction.t

Existing tests that intentionally inspect implementation structure were updated so that they continue validating the same contracts across the new module boundary.

🧪 Validation

MB677 went through the full Mediabot validation sequence.

Focused tests

PASSED : 1052/1052  (4s)

These covered the extraction contract together with historical reminders, polls, notes, factoids, dispatch and compatibility tests.

Runtime IRC checks

The development bot was restarted with the extracted module and tested directly on IRC.

Commands exercised included:

m remindlist
m remind list
m pollstatus
m notes
m factoids __mb677_smoke_no_match__
m whatis __mb677_smoke_unknown__
m factoid __mb677_smoke_unknown__

Expected responses were returned for all four feature families.

Runtime logs were also checked for obvious Perl/runtime failures:

OK: no obvious runtime error

Fast suite

PASSED : 5480/5480  (64s)

Full suite

PASSED : 14392/14392  (209s)

No tests were removed to make the extraction pass, and no runtime regression was observed during the smoke checks.

🧹 Why this matters

UserCommands.pm has historically been responsible for a very large number of unrelated features.

MB677 continues the work of turning that monolith into smaller, understandable subsystems without changing the interface users and existing code already rely on.

The important part is not merely that code moved.

The result is a module boundary that reflects an actual responsibility:

Mediabot/CommunityState.pm

now owns the community-state behaviour for reminders, polls, notes and factoids, while the old passages through Mediabot::UserCommands remain open for compatibility.

The castle is still the same.

It just has a much better floor plan. 🏰

📦 Commit

Version : 3.4dev-20260820_140006
Commit  : e898e45

🧩 Give the Community Its Own Common Room Without Losing the Old Passages

You must be logged in to reply.