# Layering contracts for mgf.apiprobe — the federation member rules.
#
# Run locally:  lint-imports
#
# Every contract is a hard MUST NOT — import-linter fails CI on any
# violation. Each contract has a `reason = ...` comment so a future
# engineer (or AI) knows why before relaxing it.

[importlinter]
root_packages =
    mgf.apiprobe
include_external_packages = True

# ---------------------------------------------------------------------------
# Contract 1 — apiprobe imports from mgf.common, NOT from any other
# federation sibling.
#
# Reason: per HANDOFF §3.5, apiprobe is a federation MEMBER, not a
# federation hub. Cross-sibling imports (e.g., apiprobe → mgf.qt)
# create a cycle once mgf.qt depends on mgf.common — which it does.
# The dependency direction in the federation is one-way:
#   sibling → mgf.common → (nothing)
# Anything else gets caught here.
# ---------------------------------------------------------------------------

[importlinter:contract:mgf-apiprobe-only-imports-from-mgf-common]
name = mgf.apiprobe does not import other federation siblings
type = forbidden
source_modules =
    mgf.apiprobe
forbidden_modules =
    # Future siblings under mgf.* — uncomment when the sibling ships
    # AND a real import attempt exists. Pre-emptive declarations only.
    # mgf.qt
    # mgf.cli
    # mgf.providers
    # mgf.gui

# ---------------------------------------------------------------------------
# Contract 2 — internal layering.
#
# Reason: mirrors mgf-common's strict layering posture (DP-01). Core
# domain modules MUST NOT import from CLI / reporting / transport —
# those are higher layers that ASSEMBLE the domain. Inversion makes
# core untestable in isolation.
#
# Layers (low → high):
#   core         — Probe, Check, Suite, Context, AuthFlow, Matcher,
#                  Finding, Response (no I/O)
#   schema       — schema validators (read-only on probe input)
#   matchers     — DSL primitives (pure functions)
#   checks       — check implementations (compose core + matchers + schema)
#   transport    — httpx wrapper (the I/O boundary)
#   reporting    — writers (consume Findings; produce strings/files)
#   cli          — top-level argparse glue (assembles everything)
# ---------------------------------------------------------------------------

[importlinter:contract:mgf-apiprobe-layering]
name = mgf.apiprobe core does not depend on higher layers
type = forbidden
source_modules =
    mgf.apiprobe.core
forbidden_modules =
    mgf.apiprobe.cli
    mgf.apiprobe.reporting
    mgf.apiprobe.transport
