Skip to content

venue: type the venue-error surface with dedicated variants for representable conditions #591

Description

@mfw78

Follow-up from #589 and #590 (M4 CoW follow-ups). Both had to encode a representable, recurring adapter condition as venue-error.invalid-body(string) because the surface has no dedicated variant for it.

Evidence

The venue-error variant in wit/videre-types/types.wit is { unknown-venue, invalid-body(string), unsupported, denied(string), rate-limited, unavailable(string), timeout }. Recent adapter work shoved typed conditions into the string payloads:

Both are venue-neutral, representable, recurring conditions wearing a string because the surface has no home for them. A caller cannot branch on them without parsing the message.

The design tension

The wire venue-error is deliberately coarse (see nullislabs/videre-nexum-module#11: denied is intentionally minimal, with venue-specific detail recovered venue-side via classify_denied). That coarseness is right for venue-reported errors whose taxonomy we do not control. It is wrong for adapter-detected conditions that are venue-neutral and finite: an invalid or empty receipt, a receipt-versus-derivation mismatch, an unsupported operation. Those deserve typed variants; the open-ended venue-reported cases keep a stringly escape hatch.

So this is not "make everything typed". It is: give the finite, representable, venue-neutral conditions dedicated variants, and keep invalid-body and denied string payloads only for genuinely custom or previously-unrepresentable errors.

Proposal

Audit the venue-error surface across the adapter (cow-venue) and the SDK, and:

Where this belongs: M5, before the cleave

venue-error is a videre:types WIT vocabulary, so the decisive factor is the repo cut, not the second venue. Adding a variant is an additive, non-breaking WIT change either way, but the cost differs sharply on which side of the cleave it lands:

The two demonstrated cases are self-evidently venue-neutral, so waiting for the second venue to confirm them buys nothing and costs the ripple. Do them now, cheaply, in the monorepo. This must land before the carve (#407 / #549); after that it is no longer a fold.

This does not pre-empt nullislabs/videre-nexum-module#23: the second-venue vocabulary pass in M6 still owns any variant we cannot yet prove venue-neutral, and extends this surface additively. This issue is the cheap precursor, not the freeze. It is also the natural sibling of nullislabs/videre-nexum-module#11 (venue-supplied denial classification): together they define the venue error and retry seam.

Acceptance criteria

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/sdknexum-sdk / shepherd-sdk, proc macros, cargo-nexumcomponent/wit-abiWIT packages, worlds, wit-bindgen, host/guest contractdebtCode works but makes future work harder.needs-designRequires thinking. No one has bandwidth.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions