Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

metarel_consumer_bad_v0 — conformance fixture (must be refused)

Area: Vocabulary & packages Teaches: the negative companion to metarel_vocab_v0 — filling an imported metarel’s endpoint with the wrong metatype across a package boundary is refused with OE0631 at the consumer’s ox check. Run: ox check examples/metarel_consumer_bad_v0 --codes (must print OE0631 and exit non-zero)

This is a negative conformance fixture, not a tutorial. It depends on metarel_vocab_v0 and intentionally declares a relation with a wrong-sorted endpoint. It MUST fail ox check — that refusal is the whole point. For the teaching version, read metarel_vocab_v0.

What it does wrong

It imports the metatype-constrained characterization metarel from the separate metarel_vocab_v0 package — whose aspect_of position requires an aspect — and then fills that position with a kind:

use metarel_vocab_v0::{ kind, aspect, characterization };

pub kind Person;
pub kind Vehicle;

// WRONG: `aspect_of` requires an `aspect`, but `Vehicle` is a `kind`.
pub characterization inheresVia(bearer: Person, aspect_of: Vehicle);

The constraint lives in the dependency, not in this file — so this fixture proves the endpoint-metatype check survives the package join and is enforced at the consumer’s ox check.

Required behavior

ox check must refuse it with OE0631 and exit non-zero:

$ ox check examples/metarel_consumer_bad_v0 --codes
OE0631
$ echo $?
1

Full diagnostic:

Error: OE0631
  × OE0631: in `root::inheresVia`, position 1 of relation `inheresVia` is
  │ `Vehicle` (a `kind`), but its classifying metarel `characterization`
  │ declares that position as `aspect` — an endpoint must be (a sub-metatype
  │ of) the metarel's position metatype.

This package must never build clean. The pipeline test (oxc-driver/tests/cli_pipeline.rs) asserts the OE0631 refusal through the real ox binary; if a change lets it pass, the test fails.