Mediabot v3 continues the progressive modularization of the historical Partyline subsystem.
After MB678-I moved the TCP/DCC transport layer into:
Mediabot/Partyline/Transport.pm
MB678-II extracts the next coherent responsibility from Mediabot/Partyline.pm:
Mediabot/Partyline/SessionAuth.pm
This round focuses specifically on session lifecycle and authentication.
The Partyline command dispatcher and the command implementations intentionally remain in Mediabot/Partyline.pm.
The goal remains the same as in MB678-I: establish one clean architectural boundary at a time, preserve the historical Partyline API, and avoid mixing unrelated refactors into a single commit.
The new SessionAuth.pm module now owns the session/authentication responsibilities around:
A total of 14 methods were extracted:
_cancel_auth_timeout
_close_session
_reverse_dns_timeout
_schedule_reverse_dns_lookup
_display_nick
_broadcast
_broadcast_chat
_telnet_echo_off
_telnet_echo_on
_strip_telnet_iac
_pl_bf_blocked
_pl_bf_record
_pl_bf_clear
_do_login
The historical Mediabot::Partyline method surface remains available through imports.
Existing callers therefore continue using the same API without needing to know that the implementation moved.
One important decision in MB678-II was to leave:
_handle_line
inside Mediabot/Partyline.pm.
_handle_line sits directly on the boundary between the authentication state machine and the large Partyline command dispatcher.
Moving it together with Session/Auth would have blurred the new module boundary and mixed authentication work with the future command extraction.
So MB678-II keeps:
transport β Partyline/Transport.pm
session + auth β Partyline/SessionAuth.pm
dispatch β Partyline.pm
commands β Partyline.pm
This keeps the architecture explicit and leaves a clean starting point for the next Partyline round.
Before MB678-II:
Mediabot/Partyline.pm : 6041 lines
Mediabot/Partyline/Transport.pm : 1012 lines
After MB678-II:
Mediabot/Partyline.pm : 5426 lines
Mediabot/Partyline/Transport.pm : 1012 lines
Mediabot/Partyline/SessionAuth.pm : 676 lines
The central Partyline module therefore loses another 615 lines of session/auth implementation.
A dedicated extraction contract was added:
t/cases/863_mb678_partyline_session_auth_extraction.t
The previous MB678 transport contract was also adjusted so that it continues validating the intended architecture after the second extraction.
MB678-II first went through targeted session/auth validation.
The exported-symbol contract was checked independently:
PASSED : 368/368
The focused Session/Auth suite then passed:
PASSED : 484/484 (3s)
This covered areas including:
During the first combined focused run, 85_exported_symbols_resolve.t reported a large cascade of failures.
The cause was not MB678-II.
One of the earlier focused tests deliberately installs a minimal fake JSON package containing only:
encode_json
and marks JSON.pm as loaded in %INC.
When 85_exported_symbols_resolve.t later attempted to load AdminCommands.pm, that module also needed:
decode_json
The isolated test process therefore saw an intentionally incomplete fake JSON module.
Running the export contract independently confirmed the real state:
PASSED : 368/368
The Session/Auth focused suite without that artificial ordering issue also passed completely:
PASSED : 484/484
No runtime code change was required.
The Partyline authentication-throttling invariant previously assumed that all authentication code lived physically inside Partyline.pm.
MB678-II updates the audit so that the security contract follows the new module boundary.
The invariant itself remains unchanged and fail-closed.
Final result:
Verdict: GO β all 11 security invariants hold.
The audit continues to verify:
The development instance was restarted with the new Session/Auth module.
The Partyline listener remained available:
0.0.0.0:23456 LISTEN
A real TCP session was then opened against the running bot.
The first prompt was received normally:
Mediabot Partyline
Please enter your nickname.
A real nickname was sent:
Te[u]K
and the session correctly advanced into the authentication state:
Enter your password.
No password was sent during the smoke test.
This validates the real runtime path through:
TCP transport
β
session creation
β
nickname parsing
β
session/auth state
β
password prompt
Result:
RC_SMOKE=0
Runtime logs remained clean:
OK: no obvious runtime error
The complete fast suite passed after the extraction:
PASSED : 5618/5618 (63s)
Final full validation:
PASSED : 14530/14530 (207s)
No tests were removed, hidden or weakened to make the extraction pass.
Partyline started MB678 as a module of almost seven thousand lines containing several distinct responsibilities.
After the first two MB678 rounds, those responsibilities are already becoming explicit:
Mediabot/Partyline.pm
dispatch + commands
Mediabot/Partyline/Transport.pm
TCP / DCC transport
Mediabot/Partyline/SessionAuth.pm
session lifecycle + authentication
This is more than moving code between files.
Each new boundary corresponds to a real runtime responsibility and has its own regression contract.
That makes Partyline easier to understand, safer to change and much easier to bisect if a future regression ever appears.
The password has not changed.
It simply has a much better guarded chamber now. π
Version : 3.4dev-20260820_154710
Commit : a81729b
π Give Partyline Sessions Their Own Chamber Without Changing the Password
You must be logged in to reply.