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

Legal catalog — cross-package refusal fixture

Area: Vocabulary & packages Teaches: the negative companion to legal_catalog_v0 — pointing an imported directed_obligation’s creditor endpoint at a norm concept instead of a party is refused with OE0631 across the package boundary. Run: ox check examples/legal_catalog_bad_v0 --codes (must print OE0631 and exit non-zero)

Conformance fixture, not a tutorial. This package is designed to be refused. It exists so CI can prove a metarel-endpoint violation is caught across a package boundary — the constraint lives in the imported vocabulary, not in this file. For the well-formed consumer, read legal_catalog_v0; for the vocabulary, legal_vocab_v0.

The imported directed_obligation metarel constrains both endpoints to be party-sorted. This fixture points the creditor endpoint at PayRent, a norm concept (an obligation) — a directed obligation cannot run to a norm:

pub directed_obligation owesBad(debtor: Tenant, creditor: PayRent);

ox check must refuse this with OE0631 and exit non-zero — the endpoint check fires on the dependency-declared metarel:

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

The full diagnostic names the offending position and both metatypes:

× OE0631: in `root::owesBad`, position 1 of relation `owesBad` is `PayRent`
│ (a `obligation`), but its classifying metarel `directed_obligation`
│ declares that position as `party` — an endpoint must be (a sub-metatype
│ of) the metarel's position metatype.

A corpus test (oxc-runtime/tests/examples_corpus.rs) asserts this package is refused with OE0631 — proving the metarel endpoint constraint survives the package join. If it regressed, this fixture would start building and CI would fail.

Source

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

//! `legal_catalog_bad_v0` — the cross-package metarel-endpoint REFUSAL fixture
//! for the deontic vocabulary `legal_vocab_v0` (#311, RFD 0031 D1). It declares
//! a relation with the imported `directed_obligation` metarel keyword whose
//! creditor endpoint is a NORM concept (`PayRent`), not a `party`. The
//! vocabulary constrains both `directed_obligation` endpoints to be
//! `party`-sorted, and the endpoint-metatype check fires ACROSS the package
//! boundary: `ox check` refuses with OE0631. The sibling `legal_catalog_v0` is
//! the well-formed counterpart.

use legal_vocab_v0::{ obligation, party, directed_obligation };
use legal_vocab_v0::{ LegalSubject, TimedObligation };

pub party Tenant <: LegalSubject {
    name: String,
}
pub party Landlord <: LegalSubject {
    name: String,
}

pub obligation PayRent <: TimedObligation {
    mut amount: Decimal,
}

// WRONG: the creditor endpoint must be `party`-sorted, but `PayRent` is a
// `norm` (an obligation). Refused OE0631 across the dependency boundary.
pub directed_obligation owesBad(debtor: Tenant, creditor: PayRent);