TradeSourceRecoveredPayload trade.source.recovered@1

Generated at from openvibe-contracts v0.34.2 and openvibe-sdk v0.5.0.

Version
1.0.0
Owner
trade
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/events/payloads/trade.source.recovered.v1.json

trade.source.recovered v1 (OpenVibe.Trade server/domain/freshness.js evaluate). A stale source is fresh again by Trade's own clock: a successful fetch younger than its staleness window is now known, reported through Sources' health during the sync (sync.js reportHealth) or proved by the retrieved_at of a newly recorded observation or filing (noteRetrieval). Sent only on a stale-to-fresh transition; a source that is already fresh the first time Trade evaluates it is not a recovery and sends nothing. Envelope: subject { type: source, id: <source_key> }, visibility public, priority low, actor service:trade.

Fields

FieldTypeRequiredDescriptionConstraints
source_keystringyesOpenVibe.Sources source key.
  • pattern ^[a-z0-9][a-z0-9-]{1,63}$
staleconstyes
  • = false
stale_sincenullyesAlways null: the source is fresh.
last_success_atstringyesThe successful fetch that made it fresh (or a later one).
  • format date-time
stale_after_secintegeryesThe staleness window applied, in seconds.
upstream_statusstring | nullyesSources' own health status as last reported (healthy, stale, failing, never_fetched, disabled, manual); null if never reported.
evaluated_atstringyes
  • format date-time

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: proved-by-retrieval
{
  "source_key": "test-feed",
  "stale": false,
  "stale_since": null,
  "last_success_at": "2026-09-23T15:30:00.000Z",
  "stale_after_sec": 10800,
  "upstream_status": null,
  "evaluated_at": "2026-09-23T15:30:04.000Z"
}
Valid: recovered
{
  "source_key": "test-feed",
  "stale": false,
  "stale_since": null,
  "last_success_at": "2026-09-23T15:30:00.000Z",
  "stale_after_sec": 10800,
  "upstream_status": "healthy",
  "evaluated_at": "2026-09-23T15:30:04.000Z"
}
Rejected: no-last-success
{
  "source_key": "test-feed",
  "stale": false,
  "stale_since": null,
  "last_success_at": null,
  "stale_after_sec": 10800,
  "upstream_status": "healthy",
  "evaluated_at": "2026-09-23T15:30:04.000Z"
}
Rejected: with-stale-since
{
  "source_key": "test-feed",
  "stale": false,
  "stale_since": "2026-09-23T15:00:00.000Z",
  "last_success_at": "2026-09-23T15:30:00.000Z",
  "stale_after_sec": 10800,
  "upstream_status": "healthy",
  "evaluated_at": "2026-09-23T15:30:04.000Z"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('trade.source.recovered@1', value);   // { valid, errors: [{ path, message }] }