"""mgf.common — the federation's cornerstone library.

``mgf-common`` is the shared-infrastructure base every MGF
federation sibling depends on. It provides typed errors, central
config + identity, structured logging + tracing, CLI primitives,
process supervision, observability, and the test-supervisor
schema (:mod:`mgf.common.testing`).

Federation siblings extend this base with framework-specific
adapters — ``mgf-http``, ``mgf-fastapi``, ``mgf-django``,
``mgf-sqlalchemy``, ``mgf-alembic``, ``mgf-apiprobe`` — plus the
out-of-process test runner ``mgf-test-supervisor``. The naming
convention is hyphens federation-wide (PyPI slugs, Codeberg
repos, local directories) with imports dotted under
``mgf.<sibling>``; see ``docs/standards/NAMING.md``.

Identity is process-wide: call :func:`bootstrap` once at startup
to set the app name + version that every observability function
reads (log paths, env-var prefixes, OTel service name, crash
report ``app`` field).

Stability: pre-v1.0. See ``PUBLIC_API.md`` for the per-name
stability tier; see ``docs/reference/`` for the surface tour.
"""

from __future__ import annotations

from mgf.common._doctor_snapshot import RUNTIME_SNAPSHOT_ENV_VAR
from mgf.common._errors import add_help_note
from mgf.common._identity import (
    UnconfiguredWarning,
    app_name,
    app_version,
    set_identity,
)
from mgf.common._lifecycle import (
    AppContext,
    bootstrap,
    current_context,
    reset_context,
)
from mgf.common._request_id import (
    REQUEST_ID_HEADER,
    current_request_id,
    generate_request_id,
    reset_request_id,
    set_request_id,
)
from mgf.common._test_helpers import bootstrap_for_test

__all__ = [
    "REQUEST_ID_HEADER",
    "RUNTIME_SNAPSHOT_ENV_VAR",
    "AppContext",
    "UnconfiguredWarning",
    "add_help_note",
    "app_name",
    "app_version",
    "bootstrap",
    "bootstrap_for_test",
    "current_context",
    "current_request_id",
    "generate_request_id",
    "reset_context",
    "reset_request_id",
    "set_identity",
    "set_request_id",
]

# Version string for the package itself. Bumped when a release is
# tagged; consumers rarely need to read this — they use
# ``mgf.common.app_version()`` for THEIR own app version, set via
# ``bootstrap(app_version=...)``.
__version__ = "0.50.0"

# PAPER-23 honesty probe (M2 Wave-2 §1.5): if this import happens
# inside a live pytest test while the pytest11 plugin silently failed
# to load (editable-install without dist-info entry points), warn
# LOUDLY. No-op (one env lookup) outside pytest. See _plugin_probe.
from mgf.common import _plugin_probe as _plugin_probe

_plugin_probe.warn_if_plugin_silently_absent()
