Forum teuk.org

🩺 MB681 — Let Doctor Read the Updater's Memory Without Consulting the Floo Network

in Mediabot · started by TeuK · yesterday

TeuK · yesterday

MB681 connects Mediabot Doctor to the durable updater history introduced by MB680.

The final commit is:

Version : 3.4dev-20260822_062854
Commit  : dcfac0e
Branch  : master

🩺 Let Doctor Read the Updater's Memory Without Consulting the Floo Network

The scope is intentionally narrow:

Doctor reads the durable updater state. It does not modify the updater, contact GitHub for this information, or introduce a new deployment mechanism.


🧠 What MB681 adds

MB680 introduced a durable updater record:

/home/mediabot/.mediabot_v3.update-status.json

MB681 teaches Doctor to consume that record through the public reader:

Mediabot::Update::update_status_record

Doctor now exposes a new fact:

updater.last_update

This makes the updater’s last known operational result visible through the existing diagnostic tool.


🩺 Doctor 1.2

The Doctor tool version moves from:

1.1

to:

1.2

The Doctor schema version remains unchanged:

schema_version = 1

No JSON schema migration was required for this addition.


🚦 Result interpretation

The new updater fact deliberately distinguishes informational states from real warnings.

No durable history yet

INFO

This is normal before the first updater run that writes the MB680 record.

Matching successful update

OK

Doctor can confirm that the recorded installed version remains coherent.

Failed update

WARN

Rollback

WARN

Suspicious running state

Doctor reports warnings when an updater remains marked running but operational evidence suggests the record is stale or inconsistent, including cases such as:

updater PID no longer exists
PID appears to have been reused
running state is older than the allowed threshold

The age threshold introduced for this diagnostic is:

1 hour

Version inconsistency

Doctor can also warn when the durable update trail disagrees with the current installation, for example:

target version != installed version
current VERSION != recorded installed version

🌐 Local-first by design

The new updater.last_update fact is local-only.

The implementation records:

network_used => 0

Doctor does not need a remote fetch to tell an operator what happened during the previous update attempt.

The real server output confirmed this behaviour:

remote divergence below uses cached refs only; Doctor never fetches
no network fetch performed

This preserves a useful separation:

remote update availability
    !=
local update history

🔐 Sanitized diagnostics

The durable record may contain an operational detail string.

Before Doctor exposes that information through findings/facts/JSON, the detail is sanitized.

This avoids blindly forwarding untrusted or malformed diagnostic text into Doctor output.


🧪 New contract

MB681 adds:

t/cases/883_mb681_doctor_durable_update_status.t

The focused Doctor/update validation group was:

828
829
830
882
883

Server result:

PASSED : 290/290  (2s)

🖥️ Real Doctor execution

The real server command:

perl tools/mediabot_doctor.pl --domain updater

returned:

RC_DOCTOR=0
Mediabot Doctor 1.2

Relevant findings included:

[ info ] built-in updater is intentionally not applicable here
         this installation is protected

[ info ] no durable updater history recorded yet

[  ok  ] deployment family 'mediabot_v3' isolated

[ WARN ] Git working tree has 3 local/untracked change(s)

[ info ] cached upstream divergence: ahead 0, behind 0
         no network fetch performed

The final result was:

DEGRADED

but this was expected during development: the only warning was the MB681 worktree itself, which contained the two modified files plus the new test before commit.

It was not an updater failure.


⚡ Fast validation

perl t/test_commands.pl --fast --progress

Result:

Selected: 323 of 766 discovered test file(s)

[====================] 100% [323/323 files | 5982 tests]

PASSED : 5982/5982  (64s)

🔌 Runtime validation

The development instance was restarted with MB681 loaded:

mediabot@dev : active
Partyline    : 0.0.0.0:23456 LISTEN
Smoke        : RC=0

The Partyline smoke path still returned:

Mediabot Partyline
Please enter your nickname.
Enter your password.

No obvious runtime error was reported.

For future rounds, the runtime validation workflow is refined:

primary application source:
    /home/mediabot/mediabot_v3/mediabot.log

system/service complement:
    journalctl -u mediabot@dev

This better separates application-level startup/runtime diagnostics from systemd-level failures.


🛡️ Security audit

The security audit remained green:

RC_AUDIT=0

Verdict: GO — all 11 security invariants hold.

🏰 Full regression suite

perl t/test_commands.pl --progress

Result:

[====================] 100% [766/766 files | 15432 tests]

PASSED : 15432/15432  (211s)

📦 Files changed

Modified:

README.md
tools/mediabot_doctor.pl
VERSION

Added:

t/cases/883_mb681_doctor_durable_update_status.t

Commit summary:

4 files changed
412 insertions
4 deletions

🧭 Why this matters

MB680 gave the updater memory.

MB681 makes that memory operationally useful.

An operator can now use Doctor to distinguish:

no history
successful last update
failed update
rollback
stale updater execution
version mismatch

without asking the network what happened locally.

That is a small feature, but an important observability improvement.


🔭 Next direction

The next round should not be chosen from assumptions.

The process remains:

fresh post-dcfac0e snapshot
        ↓
audit current observability/documentation state
        ↓
define MB682 narrowly

Likely areas to inspect include:

remaining updater observability gaps
documentation consistency
Doctor integration opportunities
readiness items on the road to 3.5

But MB682 should only be scoped after reviewing the fresh snapshot.


🩺 The Doctor no longer asks the Floo Network what happened in the last room. It reads the chart left beside the bed.

You must be logged in to reply.