Skip to content

Two notification events have never fired: HOST_IMAGE_FAIL and HOST_IMAGEUP_COMPLETE #1202

Description

@mastacontrola

Split out of the hook/event work (#1194, #1196, #1200, #1201). Recorded as F-19 in docs/refactor-facts.md and listed as H.10 in docs/hook-event-plan.md, deliberately not folded into that sequence: this is making a notification feature work for the first time, not refactoring a subsystem, so it wants its own test and its own review.

The mismatch

Core calls notify() from six call sites with five distinct names. The three bundled notification plugins (slack, ntfy, pushbullet) register listeners for six. They do not line up:

cd packages
grep -rn -e '->notify(' web/lib --include=*.php | wc -l
grep -rh -A1 '>register(' web/lib/plugins/*/events/*.event.php | grep -o "'[A-Z_a-z]*'" | sort -u
grep -rn 'HOST_IMAGE_FAIL\|HOST_IMAGEUP_COMPLETE' web/lib --include=*.php | grep -v plugins   # nothing

HOST_IMAGE_FAIL and HOST_IMAGEUP_COMPLETE have listeners in all three plugins and no notify() anywhere in the tree. So "image deploy failed" and "image upload complete" notifications have never fired on any FOG server, for anyone, since those plugins shipped. Nothing errors — the listener is registered and simply never called, which is why this went unnoticed.

HOST_CHECKIN is the inverse: core notifies it on every task checkin and nothing has ever listened. Harmless, but it means the name exists in notifyEvents on every install as a thing an admin can see and never receive.

What is needed

A core notify() for each of the two dead names, at the point where the outcome is actually known — not at the point that is convenient. HOST_IMAGEUP_COMPLETE in particular has to fire after the upload is genuinely finished and the image row is consistent, or the notification arrives before the image is usable.

Then a test that pins each name to its call site, so the next person who moves that code finds out.

Worth deciding at the same time whether HOST_CHECKIN should keep being notified. It costs a notify() per checkin for something nothing consumes; either give it a listener or stop firing it.

Notes

notify() is now safe to call from anywhere: the name-recording no longer runs before the input is validated, and neither error handler can go fatal on a bad name (#1194, #1200, #1201). So this is additive work with no groundwork left to do.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugready-for-agentWell-scoped, self-contained; an AI coding agent can produce a PR

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions