Ownership and inventory events

Bazaar reports what a batch claim covers, what is installed on a terminal, and what the caller may do next. Two facts feed that view: ownership events for a claim, and installation observations for a device. This page is the contract Bazaar accepts for both.

The ownership producer is TrustMint’s ThingHub, on the topic trustmint.thing.ownership.v1 (trustmint#298, trustmint#310). Bazaar’s consumer is built and off by default: it starts only once its read grant on that topic is applied and BAZAAR_OWNERSHIP_EVENTS_AUTO_STARTUP=true is set, and the live end-to-end check runs after that (W10-LIVE). Bazaar does not invent ownership or installation facts to fill the gap: an absent producer reads as unknown, never as success.

What this wave did NOT build (held dependencies)

These are recorded dependencies, not completed behaviour. None of them is claimed as met, and no code path pretends otherwise.

Missing capability

Dependency

Current behaviour

Bundle authoring (create/update/withdraw)

~~bazaar#265~~ LANDED (closed 2026-10-21)

BundleAuthoringService is the production writer: create / read / update / activate / withdraw a DRAFT bundle, idempotent writes, typed 400s, and (2026-11-03) a dependency whose installation_order is not before its dependent is refused before any write. A bundle read now answers 404 only when no such bundle exists for the caller. What remains open is the post-claim flow below, not authoring.

Ownership stream feeding the Journal

The read grant on the topic and the opt-in setting, then W10-LIVE

OwnershipEventConsumer reads the stream into the Journal. It is off until the grant is applied, so nothing has flowed through it in a deployed environment. Proven against ThingHub’s byte-pinned payload on a real broker and database by OwnershipEventConsumerIT, not against ThingHub itself.

Owner change before notification (box clause)

A notification dispatcher: none exists in Bazaar or NovaBell

UNMET. OwnerChangeNotificationAdmission is the door a dispatcher must use: it reads the current owner from ThingHub at send time and passes it through OwnerChangeNotificationGuard. Nothing calls that door, because nothing sends these notifications. Do not describe the rule as enforced.

Which product an ownership event covers

No source yet: ThingHub knows devices, not software

Every event has productId null, so an item the producer asserted reads item_names_no_product on the claim’s software view until another transition names a product.

Consent enforcement at fire time

bazaar#213 per-device dispatch admission — BOUND 2026-10-27 (e75b546c)

The five bounds are evaluated at PER-DEVICE factory dispatch: FactoryDeliveryService.dispatch → AutomaticConsentEvaluatorBridge → AutomaticConsent.evaluate, with the server-held account, device, product/release, channel, schedule window and charge; an absent evaluator fails closed. Proven by OtaRolloutConsentWiringIT#theProductionBridgeDecidesTheFactoryDispatch and FactoryDeliveryServiceIT. Scope-level automatic OTA is refused by design, never evaluated. The resolution preview remains UX only and must not be described as enforcement.

Device registry (what a thing_id is, and who owns it)

ThingHub is the device-identity authority

Bazaar carries thing_id as an opaque identifier it received; it does not invent a device owner, and an unknown/foreign thing_id yields unknown inventory and no device-bound consent coverage.

Ownership events

An event carries one fact about one item of one claim:

Field

Meaning

eventId

The producer’s idempotency key. A redelivery must reuse it.

eventType

OWNERSHIP_ASSERTED, OWNERSHIP_TRANSFERRED or OWNERSHIP_REVOKED.

claimId

What the change is attributed to, and the id of the Journal it lands in. See Claim references.

accountId

The owner after the event. It names the Journal that receives the event.

previousAccountId

Required for a transfer (a different owner); for a revoke it is the same owner being revoked; an assertion carries none.

itemKey

The item within the claim.

productId

The software product the item names, when known. ThingHub always sends null.

occurredAt

When the source observed the event.

schemaVersion

MAJOR.MINOR.PATCH. This build reads major 1.

visibleAtSource

What the source believed about listing visibility at occurredAt. Historical evidence only. ThingHub holds no listing and always sends false, which means no belief, never “was hidden”.

Rules the consumer enforces:

  • Identity is account-scoped. Two tenants naming the same claim id own two independent Journals. A revision read from one tenant’s Journal is stale in the other’s.

  • eventId is the transition key. A redelivery that matches every stored fact is counted as a duplicate and inserts nothing. The comparison is at the precision the database keeps — microseconds — so sub-microsecond noise does not create a second event. The same key with different facts is refused rather than merged.

  • Previous owner is explicit. A transfer that names the same owner, or no owner, is rejected; a revoke that names a different owner is rejected.

  • Visibility is re-checked at read time. visibleAtSource is never served as current state. A listing that has since gone to draft or been withdrawn reads as hidden now; a product with no listing reads as unknown, not hidden. A transition naming no product is not visibility evidence: its visible_at_source reads as null in the drill-down and it cannot count as a visibility change.

Consuming the stream

OwnershipEventConsumer (group bazaar-ownership-journal-v1) appends each event to the Journal of the owner after it, keyed by eventId. A transfer appends to the new owner’s Journal; the previous owner’s Journal is not rewritten. There is no dead-letter topic. Every record ends in one of three outcomes:

Outcome

When

What happens

Consumed

Appended, or a redelivery that inserted nothing

The offset moves after the Journal’s transaction commits.

Rejected

The record is not this payload; or its eventId is stored with different facts; or the schema refuses the row

Logged at ERROR with its topic, partition and offset, counted in bazaar.ownership_event.rejected, and the offset moves: nothing could ever make it land, and holding it would stall that partition.

Held

The Journal is unavailable, or the payload is a later major than this build reads

Logged at ERROR, counted in bazaar.ownership_event.held, and retried every 30 seconds with the offset held, so nothing behind it overtakes it. The stall shows as consumer lag.

Claim references

ThingHub’s claimId is not always a claim. It can be a claim artifact id, a batch transfer id, an adjudication id, or a synthetic owner-transfer:<ref> or owner-removal:<ref>. All of them are appended, each as its own Journal under the reference it names: the payload has no field that tells an artifact from a transfer or adjudication, and a dropped event cannot be recovered once its offset moves. No door lists Journals, so one of these is reachable only by its owner asking for that exact reference.

The consequence: a Journal is the history of one reference, not a statement of who owns a Thing now. A claim’s Journal keeps saying COVERED after its Thing is transferred away, because that transfer is a different reference. Who owns a Thing now is ThingHub’s answer.

Appending directly

A tenant-authorized caller can also append transitions to its own Journal through the append route, one transition per event:

POST /software-onboarding/v1/claims/{claimId}/journal/transitions
{
  "expected_revision": 0,
  "transitions": [
    {
      "transition_key": "<eventId>",
      "item_key": "<itemKey>",
      "product_id": "<productId>",
      "kind": "OWNERSHIP",
      "from_state": null,
      "to_state": "COVERED",
      "outcome": "COVERED",
      "visible_at_source": true,
      "occurred_at": "2026-10-18T00:00:00Z"
    }
  ]
}

expected_revision is required. 0 creates the Journal for this account; any other value must equal the stored revision or the append is refused with 409. Because this route is tenant-writable, an OWNERSHIP row in a Journal is never an answer to who may be notified about a Thing.

Installation observations

Inventory resolution distinguishes four truths, and never collapses them into a boolean:

Truth

Meaning

KNOWN

A complete snapshot of the device. Absence is evidence that software is missing. Bazaar has no such source today; no code path guesses it.

PARTIAL

At least one terminal installation was observed, but the set is not complete. A product with terminal evidence is positively installed; absence proves nothing.

UNKNOWN

No terminal observation. Rendered as unknown/waiting — never as missing software and never as success.

STALE

Terminal evidence older than the freshness window. It records what was installed, not current success.

What counts as terminal evidence: a recorded installation outcome (delivery_execution.observed_state = 'INSTALLED') with a non-null observation time. A dispatch that has been sent but not terminated (PENDING, DOWNLOADING, INSTALLING) produces no evidence. Every evidence row carries its source and observedAt, so a positive answer is always attributable to an observation.

Per-item actions

The resolution response computes each item’s Get, Configure and Open decisions on the server from the entitlement, the inventory truth and the caller’s authorization. Each decision carries allowed and a reason. Clients render the decision they are given; they must not derive an action from a state name or assume a newest offer. A missing right blocks delivery of the affected item and requires a purchase — it never starts one silently.

Post-deploy dependency

The live proof of this contract belongs to the W10-LIVE post-deploy check and requires, besides this deployment:

  • ThingHub’s ownership producer deployed, and the topic present on the cluster;

  • Bazaar’s read grant on trustmint.thing.ownership.v1 applied, the consumer turned on, and the consumer group declared in the lag alarms;

  • a real claim’s event read back from its Journal.

“Owner change before notification” cannot be observed at all until a dispatcher exists.

Bundle authoring no longer blocks this list: BundleAuthoringService is the production writer (bazaar#265, closed 2026-10-21), so a bundle can exist in production and be resolved; a 404 now means only that no such bundle exists for the caller. The ownership stream is proven by OwnershipEventConsumerIT, the service ITs and the HTTP controller IT, none of which is a live end-to-end proof.