Forum teuk.org

πŸͺ„ Mediabot 3.4dev β€” Time-Turners, Protego and safer script owls β³πŸ¦‰

in Mediabot Β· started by TeuK Β· 2d ago

TeuK Β· 2d ago

Mediabot v3 continues its 3.4 development cycle with a new internal milestone focused on the script bridge, delayed actions and safety guards.

This update is not a flashy user-facing release, but it matters a lot for long-term reliability: script-driven actions can now schedule guarded timers, while channel-scope protection has been hardened to prevent sneaky cross-channel messages.

✨ What changed?

The script bridge already supported structured actions such as replies, notices and logs. Timer actions were documented and validated, but not yet applied at runtime.

That gap is now closed.

Scripts can now emit a timer action, and Mediabot will schedule a delayed callback using the async event loop. When the timer expires, the same script is called again with a dedicated timer event.

In Hogwarts terms: the Time-Turner now works β€” but McGonagall keeps the key. ⏳

πŸ›‘οΈ Safety rules

The new timer support is deliberately guarded:

  • timer chaining is blocked;
  • timer names must be unique while pending;
  • pending timers are capped;
  • timers are cancelled when the plugin unloads;
  • delayed output still goes through the same apply/IRC permission gates;
  • channel-scope protection is enforced again when the timer fires.

This means delayed script actions cannot quietly bypass the protections used by immediate actions.

πŸͺ„ Protego for channel scope

A subtle IRC targeting issue was also fixed.

Mediabot already blocked scripts from sending messages to another channel by mistake or abuse. This protection now also handles IRC status-message targets such as:

@#channel
%#channel
~#channel

Those are now correctly recognized as channel targets, not nicknames.

So yes: no sneaky owl to another common room. πŸ¦‰

πŸ§ͺ Test-suite hardening

While testing the new timer system, an old test-suite mine was uncovered.

Three older fallback test files were defining stub modules too early, at Perl compile time. In plain English: some fake test code could accidentally overwrite real async timer behavior for later tests in the same process.

That has been fixed.

The suite now keeps the real IO::Async timer implementation intact when it is available, and only installs fallback stubs when truly needed.

βœ… Validation

This pass was validated with:

10210/10210 tests passed
Startup integrity check: OK
41/41 modules loaded
80/80 cross-module calls resolved
197/197 dispatch handlers resolved

No database schema change.
No secret handling change.
No runtime configuration change required.

πŸ§™ Summary

This update makes the script bridge more complete, safer and more predictable.

Mediabot can now handle guarded delayed script actions, enforce channel boundaries more strictly, and keep its test suite honest around real async timers.

A small step for the changelog, a useful spell for long-running IRC communities. πŸͺ„⏳

You must be logged in to reply.