Coverage for src/lexigram/features/hooks.py: 100%
10 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-26 02:04 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-26 02:04 +0800
1"""Root hook payload surface for lexigram-features.
3Defines canonical payload dataclasses for feature-flag lifecycle hook points.
4Actual hook registration and invocation use the framework's string-keyed
5``HookRegistryProtocol`` action/filter APIs.
6"""
8from __future__ import annotations
10from dataclasses import dataclass
12__all__ = [
13 "FeatureFlagEvaluatedHook",
14 "FeatureFlagUpdatedHook",
15]
18@dataclass(frozen=True, kw_only=True)
19class FeatureFlagEvaluatedHook:
20 """Payload fired when a feature flag is evaluated for a given context.
22 Attributes:
23 flag_key: Unique key of the feature flag that was evaluated.
24 enabled: Resolved boolean result of the evaluation.
25 """
27 flag_key: str
28 enabled: bool
31@dataclass(frozen=True, kw_only=True)
32class FeatureFlagUpdatedHook:
33 """Payload fired when a feature flag definition is created or updated.
35 Attributes:
36 flag_key: Unique key of the feature flag that changed.
37 """
39 flag_key: str