NewsSourceFailedPayload news.source.failed@1

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

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

news.source.failed v1 (OpenVibe.News server/domain/ingest.js failedEvent). Ingestion of news items failed and nothing was made in its place (no source item, cluster or story text); the same transaction records it in news_ingest_runs. Four call sites, told apart by origin and state: origin sources (ingest.js upstreamFailure: OpenVibe.Sources reported sources.fetch.failed for a news source; state, error_code and http_status are Sources' own, and run_id and consecutive_failures are added); origin pull with state failed (the cursor pull could not read Sources; once per outage, not once per retry); origin webhook with state failed (server/http/webhook.js: a sources.item.created|updated delivery whose item could not be read from Sources, on the first delivery attempt only); origin pull or webhook with state rejected and error_code item.no_headline (a Sources item without a title). Envelope: subject { type: source, id: <source_key> } when the source is known, otherwise { type: ingest, id: <origin> }, visibility internal, priority important, actor service:news.

Fields

FieldTypeRequiredDescriptionConstraints
originenumyeswebhook: an Events delivery; pull: the cursor pull; sources: a failure Sources reported.
  • one of "webhook", "pull", "sources"
source_keystring | nullyesThe Sources source, as given; null for a pull failure or when the delivery named none.
sources_item_idstring | nullyesThe Sources item (itm_…) as given, for a rejected item or an unreadable delivery; null otherwise.
statestringyesrejected (an unusable item), failed (News could not read Sources), or for origin sources the fetch state Sources sent, copied as sent (robots_denied, http_error, rate_limited, parse_error…; failed when it sent none).
  • minLength 1
error_codestring | nullyesitem.no_headline for a rejected item; the Sources client's error code (e.g. sources.http_503), else pull.error or sources.error, when Sources could not be read; Sources' own error_code for origin sources (null when it sent none).
http_statusinteger | nullyesThe HTTP status Sources answered (or reported for its fetch); null when there was none.
detailstring | nullyesThe error message, cut to 500 characters; null for rejected items and origin sources.
  • maxLength 500
run_idstring | nullorigin sources only: Sources' fetch run (frn_…), as sent.
consecutive_failuresinteger | nullorigin sources only: the source's consecutive failed runs Sources reported, null when it reported none.

Examples

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

Valid: pull-outage
{
  "origin": "pull",
  "source_key": null,
  "sources_item_id": null,
  "state": "failed",
  "error_code": "sources.http_503",
  "http_status": 503,
  "detail": "OpenVibe.Sources answered 503: down"
}
Valid: rejected-item
{
  "origin": "pull",
  "source_key": "paper-b",
  "sources_item_id": "itm_01K5RZ3X8Y0Z2B4D6F8H0K2M4P",
  "state": "rejected",
  "error_code": "item.no_headline",
  "http_status": null,
  "detail": null
}
Valid: upstream-fetch
{
  "origin": "sources",
  "source_key": "wire-a",
  "sources_item_id": null,
  "state": "http_error",
  "error_code": "http_503",
  "http_status": 503,
  "detail": null,
  "run_id": "frn_01K5S3J8M0P2R4T6V8X0Z2B4D6",
  "consecutive_failures": 3
}
Valid: webhook-unreadable
{
  "origin": "webhook",
  "source_key": "wire-a",
  "sources_item_id": "itm_01K5RZ2V7W9Y1A3C5E7G9J1K3M",
  "state": "failed",
  "error_code": "sources.error",
  "http_status": null,
  "detail": "connect ECONNREFUSED 127.0.0.1:4700"
}
Rejected: detail-too-long
{
  "origin": "pull",
  "source_key": null,
  "sources_item_id": null,
  "state": "failed",
  "error_code": "pull.error",
  "http_status": null,
  "detail": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
Rejected: extra-property
{
  "origin": "pull",
  "source_key": null,
  "sources_item_id": null,
  "state": "failed",
  "error_code": "pull.error",
  "http_status": null,
  "detail": null,
  "cursor": 42
}
Rejected: missing-state
{
  "origin": "pull",
  "source_key": null,
  "sources_item_id": null,
  "error_code": "pull.error",
  "http_status": null,
  "detail": null
}
Rejected: unknown-origin
{
  "origin": "cron",
  "source_key": null,
  "sources_item_id": null,
  "state": "failed",
  "error_code": "pull.error",
  "http_status": null,
  "detail": null
}

Validate

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