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.

Source

The package’s real Argon source, transcluded from the file this corpus compiles — what you read here is exactly what CI builds.

//! `metarel_consumer_bad_v0` — the REFUSAL half of the CROSS-PACKAGE metarel
//! endpoint-metatype proof (RFD 0031 D1, #311 F3). A modeler package that
//! DEPENDS ON the separate `metarel_vocab_v0` vocabulary, imports its
//! `characterization` metarel, and declares a relation whose `aspect_of`
//! position is filled by a `kind` (not an `aspect`).
//!
//! This is exactly Gustavo's publish→consume journey: the constraint lives in
//! a DEPENDENCY, not this file. Before #311 F3 the consumer checked CLEAN (the
//! dependency's `position_metatypes` were discarded at the package join); it
//! must now be refused the feature-named OE0631 — the same refusal the
//! in-package violation (`examples/machine_parts_bad`) gets.
//!
//! This package MUST NOT build; the corpus test asserts the OE0631 refusal.

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

// `Person` and `Vehicle` are both declared with the DEPENDENCY's `kind`
// introducer — both are `kind`-sorted.
pub kind Person;
pub kind Vehicle;

// WRONG: `characterization`'s `aspect_of` position (declared in the dependency)
// requires an `aspect`, but `Vehicle` is a `kind`. Refused OE0631 across the
// dependency boundary — the §4.3 endpoint-metatype verification.
pub characterization inheresVia(bearer: Person, aspect_of: Vehicle);