Catalog/C family/C02
Proposed specificationSource-located exemplarH1

Observer

Notify registered dependents of changes.

JOIN POINTsubject_change_notificationRECORD STATUSCandidate · v0.1.0
UML class view for Observer, showing participant roles, received calls, and analytical dependencies
FIG. C02 / UML CLASS VIEW
Object interaction diagram for Observer, showing role collaboration and a numbered message sequence
FIG. C02 / OBJECT INTERACTIONS
Context
A subject changes state or emits lifecycle information.
Trigger
The subject publishes a change notification.
Structure
Subscription registry, event payload, and observer callbacks.
Effect
Currently registered observers are notified under declared ordering semantics.
Requires
Observer identity and subscription lifetime are defined.
Ensures
Notification follows the event and unsubscribed observers no longer receive it.
Invariant
Observer failure does not corrupt subject state.
Violation
Callback errors and cascades are isolated or propagated by explicit policy.

Negative control

Polling the subject rather than notification is not the observer pointcut.

Permitted variation

Event emitter, listener, hooks, and stream observers.

Test obligation

Test subscribe, unsubscribe, ordering, callback error, and reentrancy.

Evolution question

Did observer callbacks gain event schemas and lifecycle controls?

PROMPT SKETCH
Notify subscribers after a subject change, within their declared subscription lifetime. An unsubscribed observer must not receive later notifications.
CODE DESIGN / PYTHON
class Subject:
    def __init__(self):
        self.observers = {}

    def subscribe(self, observer):
        self.observers[observer.id] = observer

    def unsubscribe(self, observer_id):
        self.observers.pop(observer_id, None)

    def publish(self, event):
        for observer in list(self.observers.values()):
            observer.notify(event)

Illustrative design sketch. Subscription lifetime is the contract; notification order is secondary. This example is a teaching aid, not implementation evidence or a conformance claim.

Join point
subject_change_notification
Source locator
Sarkar and Sarkar
Lexical cue
(?i)\b(?:Observer|observer|add[_-]?listener|register[_-]?(?:listener|observer))\bFrozen expression, v0.1.0. A match is a retrieval cue, not a confirmed implementation.
Aliases
None
Canonical exemplar
mastra-ai/mastrapackages/core/src/events/event-emitter/index.ts:21Support: packages/core/src/events/unix-socket-pubsub-solo.test.ts:54
Negative control
Polling the subject rather than notification is not the observer pointcut.

Scope-anchored review. pohe-agent analyze <repo> --pattern C02 anchors the cue to its enclosing declaration and checks a separate operational signature for all four pointcut dimensions. Missing roles and negative-control risks remain visible; a structural match is not E2/E3. Calibration report ↗

Source-located exemplar

A concrete source anchor is available for this proposed record. It is one exemplar, not evidence that all repositories—or every contract field—conform.

Review boundary: this candidate and its specification come from an AI-assisted study. Independent human validation remains open.

ANY-EVIDENCE FAMILY COVERAGE29/36

80.6% of repository families in the frozen panel have at least one current cue, historical cue, or canonical source layer. This is not confirmed prevalence.

Current lexical-cue repositories: 32 / 41
Canonical source anchormastra-ai/mastra 899383db98e0packages/core/src/events/event-emitter/index.ts:21

Registered subscribers receive event notifications.

Exploratory retrieval cue Regex / v0.1.0
(?i)\b(?:Observer|observer|add[_-]?listener|register[_-]?(?:listener|observer))\b

This expression is a discovery instrument only. A match is a retrieval cue—not a confirmed implementation, pointcut match, or contract proof.