Marrow

ADR-0010 — Importers may infer; the compiler may not

Import adapters derive tier, mode, and links from source artifacts and emit them as explicit, provenance-tagged declarations. The compiler keeps the never-infer rule.

Status: proposed

Import adapters (packages/ingest) may derive topology attributes from source artifacts, but must emit them as explicit declarations. The compiler continues to classify layout strictly from declared structure without inference.

Why

ADR-0001 bans inferring meaning from names. The compiler classifies layout only from declared tier, zone, and ha_pair_with.

Import adapters (Cisco IOS CLI output, .pcapng, NetBox, containerlab, GNS3, draw.io) must parse configuration evidence into topology semantics:

  • switchport mode trunk and switchport trunk allowed vlan 10,20 map to mode: trunk and vlans: "10,20".
  • Inter-switch links sharing a common /30 or /31 subnet map to mode: routed.

These derivations come from configuration state rather than name guessing. However, some assignments remain heuristic (such as inferring tier: core from high-density routed trunks). Moving inference into the compiler would violate ADR-0001 and make layout errors untraceable in source YAML.

Decision

  1. Import adapters derive schema attributes from source files.
  2. Every derived value is written to YAML as an explicit declaration (tier: core).
  3. Derived values carry provenance via x-source annotations indicating the source file, line number, and parser rule.
  4. Derivations are classified into two categories:
    • Evidence-based: Direct configuration readings (channel-group, switchport modes, LLDP TLVs). Emitted without diagnostics.
    • Heuristic: Structural assumptions (inferred tier). Emitted with an advisory diagnostic (MRW-I range) requesting review.
  5. Name-based guessing (core-* prefix) remains prohibited in both importers and the compiler.

Consequences

  • Positive: Imported topologies compile into valid archetypes on first build without manual intervention.
  • Positive: Incorrect values point to exact source configuration lines and are easily overridden in overlay files.
  • Positive: Compiler determinism and ADR-0001 remain intact.
  • Negative: Discovered YAML files include x-source metadata.
  • Negative: Importer heuristic rules require formal test fixtures to prevent parsing regressions.

Considered and rejected

  • Inference in the compiler core. Rejected: violates ADR-0001 and breaks byte-level build reproducibility.
  • Zero importer inference. Rejected: imported files would produce unranked layered layouts until every device is manually annotated.