Interface conformance¶
A block's interface is checked at three points: when the block pipeline generates it, when bake builds the package, and when the kernel runs the block. Each check compares the interface with something independent of it, and a mismatch stops the work at that point with an error that names what disagreed.
At generation¶
xratu capability generate compiles the interface and compares it with the
block's Python module:
| Checked | Error when it fails |
|---|---|
| The interface id matches the block: its module, followed by the class when one class holds every export | the admitted XCI interface id must match the reusable capability block's authored interface |
The interface version matches the block version, as major.minor |
the admitted XCI interface version must match the reusable capability block version |
| Each exported method in the module is in the interface, and each interface method is in the module | the admitted XCI methods must exactly cover the discovered reusable capability block exports |
At bake¶
xratu bake compiles the interface again, independently of generation, and
checks that:
- the interface definition file is the one generation compiled;
- the interface id, version and hash are unchanged;
- every method number is unchanged;
- the generated bindings and dispatch module are byte for byte what the compiler produces now.
A mismatch names the block and tells you to regenerate:
acme.billing XCI verification refused: XCI method ordinals disagree with the generated seed; regenerate the reusable block
It means something changed after generation: the block, its interface file, or a
generated file. Run xratu capability generate again, then bake.
At run time¶
The kernel recomputes the interface hash from the compiled interface sealed in the capsule, and refuses the capsule when it disagrees. See Canonical interface hashing.
Each call is then checked by the dispatch module inside the capsule before your method runs. The call is refused when its method number is outside the interface, when its arguments do not match the method's parameters, or when the block's class lacks the method: