Forum teuk.org

⏳ MB678-IV-C — Give Partyline Operations Their Own Time-Turner Without Changing the Schedule

in Mediabot · started by TeuK · 2d ago

TeuK · 2d ago

MB678 continues the progressive decomposition of Mediabot’s Partyline subsystem.

After extracting plugin/ScriptDryRun commands in MB678-IV-A and core operator/session commands in MB678-IV-B, this round moves the scheduler and operational-status command family into Mediabot::Partyline::Commands.

The extraction remains intentionally incremental: scheduler control, duration formatting, status, and metrics move together, while channel/network commands remain in the parent module for the next round.

The objective is unchanged: improve responsibility boundaries without changing Partyline protocol, command syntax, privilege semantics, runtime behaviour, or the historical Mediabot::Partyline method surface.


⏳ What moved

MB678-IV-C moves the following methods from:

Mediabot/Partyline.pm

into:

Mediabot/Partyline/Commands.pm

Methods moved:

_cmd_timers
_format_duration
_seconds_to_human
_cmd_schedule
_cmd_status
_cmd_metrics

This family covers:

  • scheduler task listing;
  • scheduler start/stop control;
  • scheduler failure reporting;
  • duration formatting;
  • human-readable time formatting;
  • operational Partyline status;
  • Prometheus-style metrics visibility.

The dispatcher remains unchanged and continues to call the historical methods through $self.

Mediabot::Partyline imports the six moved methods back from Mediabot::Partyline::Commands, preserving the existing API.


🧱 Structural result

Before MB678-IV-C:

Mediabot/Partyline.pm          : 3684 lines
Mediabot/Partyline/Commands.pm : 1421 lines

After MB678-IV-C:

Mediabot/Partyline.pm             : 3226 lines
Mediabot/Partyline/Commands.pm    : 1894 lines
Mediabot/Partyline/Dispatcher.pm  :  407 lines
Mediabot/Partyline/SessionAuth.pm :  676 lines
Mediabot/Partyline/Transport.pm   : 1012 lines

The parent module loses another 458 lines of operational command logic.

The next command family — channel and network visibility — intentionally remains in Partyline.pm for a separate extraction round.


🧪 Focused validation

A dedicated extraction contract was added:

t/cases/867_mb678_partyline_operational_commands_extraction.t

The initial targeted contract group reached:

217/218

The only execution failure was:

778_mb595_status_async_jobs.t

When re-run in isolation:

PASSED : 22/22

This confirmed that the failure was caused by shared-process test pollution/order rather than the IV-C extraction.

The historical method surface was also explicitly verified:

_cmd_timers
_format_duration
_seconds_to_human
_cmd_schedule
_cmd_status
_cmd_metrics

Result:

6/6 resolved through Mediabot::Partyline

🧩 Full-suite contract trap

The first full run reached:

FAILED : 4/14653
14649 passed

All four failures belonged to a single test:

575_mb356_scheduler_lifecycle_generation.t

The failing assertions checked:

  • scheduler failure reporting;
  • already-running task reporting;
  • already-stopped task reporting;
  • the historical MB356 scheduler marker.

Those strings and markers had legitimately moved with _cmd_schedule into:

Mediabot/Partyline/Commands.pm

The production runtime was correct.

The test still inspected only:

Mediabot/Partyline.pm

The source contract was updated to inspect:

Partyline.pm + Partyline/Commands.pm

No runtime code changed.

Targeted revalidation:

PASSED : 24/24

Because the correction affected only the source contract in test 575, the complete 14,653-assertion suite was not needlessly repeated.


⚡ Fast suite

The complete fast suite passed before the test-only 575 correction:

PASSED : 5741/5741  (63s)

No fast regression was introduced by IV-C.


🛡️ Security audit

The security audit remained completely green:

RC_AUDIT=0
Verdict: GO — all 11 security invariants hold.

The extraction preserved all current security guarantees, including authentication throttling and the existing external-command and output-sanitisation protections.


🔌 Real runtime validation

The development instance restarted successfully:

mediabot@dev : active

The Partyline listener remained available:

0.0.0.0:23456

A real TCP login smoke test produced:

Mediabot Partyline
Please enter your nickname.
Enter your password.

Result:

RC_SMOKE=0

No obvious runtime errors were found in the service journal.


🧠 Why this matters

Scheduler and operational-status commands form a distinct responsibility inside Partyline.

Moving them together gives Partyline::Commands a coherent operational boundary while leaving unrelated channel, community, configuration, AI, IRC-control, and moderation commands for later rounds.

The parent Partyline module has now fallen from:

6976 lines before MB678

to:

3226 lines after MB678-IV-C

This is now less than half of the original monolith.

More importantly, each extraction has remained:

  • bounded;
  • reversible;
  • covered by an explicit extraction contract;
  • compatible with the historical method surface;
  • runtime-tested;
  • security-audited.

No scheduler syntax changed.

No status or metrics command changed.

No privilege semantics changed.

No Partyline protocol changed.

The schedule stayed the same; only the machinery moved to a better room.


📦 Commit

Version : 3.4dev-20260821_062001
Commit  : a28388b
Branch  : master

⏳ Give Partyline Operations Their Own Time-Turner Without Changing the Schedule

Commit summary:

12 files changed
558 insertions
473 deletions

New test:

t/cases/867_mb678_partyline_operational_commands_extraction.t

The commit was successfully pushed to GitHub.


The timetable never changed. Partyline simply stopped keeping the Time-Turner in the hallway.

You must be logged in to reply.