Forum teuk.org

🔍 Mediabot v3 — A Read-Only Marauder's Map for Achievement Identities

in Mediabot · started by TeuK · 6d ago

TeuK · 6d ago

Commit: bcf100b
Version: 3.4dev-20260817_104422

MB654 adds a strictly read-only diagnostic for Mediabot’s durable Achievement identities.

The purpose is simple:

explain what Mediabot currently knows about an IRC identity without creating, touching, merging or repairing anything.

This round deliberately changes no database schema and performs no database writes.


🗺️ New Partyline diagnostic

The new command is:

.achievementprofile <nick> <#channel>

Example shape:

Achievement identity diagnostic (read-only)
  Query    : Teuk on #channel
  Storage  : MariaDB
  Profile  : 42
  Display  : Te[u]K
  USER     : 7 (Teuk) [authoritative resolver anchor on this channel]
  Unlocks  : 17
  Progress : 9 counter(s)
  Aliases  : 2 durable identity record(s)
    Te[u]K!~teuk@cloak.example
    Teuk!teuk@cloak.example
  Evidence : nick maps to one stored profile on this channel; registered USER id is authoritative
  Note     : mb646 does not persist historical merge reasons; this shows current durable evidence only.

The command is diagnostic-only.

It does not call identity mutation helpers and does not try to “repair” ambiguous data.


🧠 Current evidence, not invented history

MB646 stores the durable identity state that exists now.

It does not store a historical explanation of every merge decision that led to that state.

MB654 therefore refuses to invent one.

The diagnostic reports:

historical_reason = not_persisted

when the reason cannot actually be proven from stored data.

That distinction matters.

A diagnostic that confidently invents a plausible story is worse than one that clearly says what it does not know.


🔎 What the diagnostic exposes

For an unambiguous profile, MB654 can report:

profile id
display nick
registered USER anchor
durable identity records
last-seen timestamps
achievement unlock count
progress-counter count
current evidence used to resolve the identity

Aliases and candidate lists are bounded so Partyline output remains operationally useful.


⚠️ Ambiguity is not silently resolved

If a nick could plausibly refer to more than one durable Achievement profile on a channel, the command does not guess.

Instead it reports the ambiguity and the candidates it can prove from current storage.

That is intentional.

The command exists to explain the resolver, not to become a second resolver with slightly different rules.


🔒 Strictly read-only implementation

The implementation uses only SELECT statements.

The source guard confirmed:

OK: 3 diagnostic SQL statement(s), SELECT-only
OK: no identity mutation helper called by diagnostic

The diagnostic intentionally avoids helpers whose normal runtime role may populate caches or create/touch identity state.

No schema change was made.

No migration was added.

No config, service or systemd change was made.


🧪 Focused regression

The focused Achievement + Partyline suite covered the existing Achievement persistence, progress, async and identity behaviour together with the new diagnostic.

Result:

PASSED : 495/495

The Partyline renderer was also exercised independently:

PARTYLINE_ACHIEVEMENTPROFILE_SMOKE=OK

🗄️ Real MariaDB validation

The diagnostic was then executed against the real DEV database through an isolated connection with the MariaDB session explicitly placed in read-only mode.

A real stored profile was selected and resolved successfully:

QUERY      = Balibalo on #radiocapsule
STORAGE    = MariaDB
STATUS     = ok
PROFILE    = 3
DISPLAY    = Balibalo
USER_ID    = 17
USER_NICK  = Balibalo
UNLOCKS    = 0
PROGRESS   = 0
ALIASES    = 1
HISTORY    = not_persisted

Stored durable identity evidence:

Balibalo!Balibalo@teuk.org

Final validation:

REAL_ACHIEVEMENT_IDENTITY_CHECK=OK
RC=0

The small DBI warning seen during the probe came from calling the DBI rollback() method while AutoCommit remained enabled after an SQL-level START TRANSACTION READ ONLY.

It was a property of the standalone probe, not MB654, and did not indicate a write.


🧪 Full-suite validation

The complete Mediabot test suite passed:

PASSED : 13414/13414
RC=0

Runtime:

868s

So the new diagnostic did not regress the rest of the application.


🏰 Why this matters

Achievement persistence is now durable enough that operational questions become more interesting than simply “is there a row?”

When two IRC identities appear to belong to the same Achievement profile, an operator now has a way to inspect the stored evidence directly.

That makes identity behaviour:

less magical
more observable
easier to debug
safer to trust

without introducing another mutation path.


✨ Commit

bcf100b
🔍 Give Achievement Identities a Read-Only Marauder's Map

Version:

3.4dev-20260817_104422

Committed scope:

CHANGELOG.md
VERSION
Mediabot/Achievements.pm
Mediabot/Partyline.pm
t/cases/836_mb654_achievement_identity_diagnostics.t

The Achievement resolver still makes the decisions.

MB654 simply turns on the light.

You must be logged in to reply.