Skip to content

registryLawFor

registryLawFor(registry, partNumber, lawKind): DeviceLaw | null

Defined in: packages/compiler/src/registry.ts:416

The law a registered part supplies for a device whose class already names its law kind.

This is rung 1 of identify.ts’s evidence ladder and only rung 1: an exact manufacturer part number, compared whole and case-folded. The other two rungs are deliberately unreachable here.

  • Declared type is not consulted. Circuit.Pentode is a class, and resolving a class to one part’s model would claim every pentode in the corpus is an EL84 — the same reason part-catalog.ts leaves declaredTypes empty for op-amps.
  • Pinout signature is not consulted. Every pentode has the same electrodes, so a pinout match cannot tell an EL84 from a KT66. That is exactly the case where a wrong identity is worse than none.

lawKind must match the law the device’s class already implies, so an entry can only refine the law that class was going to get. A triode cannot be handed a pentode’s fit by a catalog typo; it falls back instead.

Returns null when nothing matches, which is a correct and expected answer — the caller keeps its device-class default. See findGenericTubeFits, which reports every such fallback, because a silent one is what let every amp in the corpus run a 6V6 fit.

PartRegistry

string | null

"diode" | "bjt" | "ota" | "triode" | "pentode" | "tube-diode" | "transformer" | "switch" | "optocoupler" | "voltage-source" | "analog-switch" | "inverter" | "selector" | "capacitance" | "inductance" | "comparator" | "open" | "nand-gate" | "clock-driver" | "logic-divider" | "compandor" | "conductance" | "controlled-conductance" | "controlled-resistance" | "port-engage" | "ac-source" | "fet" | "ideal-opamp" | "spring-reverb"

DeviceLaw | null