# Layering contracts for mgf.vm.interchange.
#
# SCOPE (read before assuming CI guards more than it does):
# the machine-enforced contract here is the federation-leaf
# direction (the outward-direction half of rule DP-01):
# mgf.vm.interchange is an extracted sibling library. It MAY depend
# on mgf-common and mgf-vm (its upstreams), but it MUST NOT import
# any consumer application — the apps depend on it, never the
# reverse. A reverse import would create a federation cycle that
# breaks every consumer.
#
# Sibling-under-mgf.* forbidding (e.g. forbidding `mgf.<other>`)
# stays code-review enforced: import-linter REJECTS subpackages of
# an external PEP 420 root (`mgf` is the external root here) in
# `forbidden_modules` — the same constraint mgf-common/.importlinter
# documents. The enforceable machine contract is "no consumer-app
# import", which catches the realistic cycle.
#
# Run locally:      lint-imports
# Run in CI:        the woodpecker/CI lint step
#
# Adding contracts? Each contract is a hard MUST NOT — import-linter
# fails CI on any violation. Add a ``reason`` comment so a future
# engineer (or AI) knows why it exists before deciding to relax it.

# ``root_packages = mgf`` (the PEP 420 namespace root), not
# ``mgf.vm.interchange``: grimp refuses a deep namespace subpackage
# as a top-level root (``NotATopLevelModule``). Pointing it at the
# ``mgf`` namespace root lets it build the graph; the contracts below
# scope to ``mgf.vm.interchange`` via ``source_modules``. Same shape
# as mgf-vm-forensics/.importlinter.
[importlinter]
root_packages =
    mgf
# Required because the contract below names external top-level
# packages (consumer apps) as forbidden — without this flag,
# import-linter refuses to start.
include_external_packages = True

# ---------------------------------------------------------------------------
# Contract 1 — mgf.vm.interchange is a federation leaf (DP-01,
# outward direction). See the header for the full rationale and the
# subpackage-of-external-root caveat.
# ---------------------------------------------------------------------------
[importlinter:contract:interchange-is-a-federation-leaf]
name = mgf.vm.interchange does not import any consumer application
type = forbidden
source_modules =
    mgf.vm.interchange
forbidden_modules =
    vmanager
    vm_vmanager_app
    plasmamapper
    inthewords

[importlinter:contract:interchange-no-ui]
name = interchange imports no UI framework (PR-01)
type = forbidden
source_modules =
    mgf.vm.interchange
forbidden_modules =
    PySide6
    PyQt6
    PyQt5
    textual
    tkinter
