On this page
A collector feed lets a remote machine deliver third-party market rankings that have no vendor API. The machine signs each request with its own key, the gateway stores the compressed rows, and a promoter checks them before it writes market_intel_* for every org that subscribes to the feed (ADR 0065).
When to use#
Use a feed when a list is captured in a browser on another machine and must reach MSO Cloud every week or month without anyone uploading a file. A vendor with an API is a connector instead. A one-off file still goes through the upload on the market-intelligence data page.
The contract#
- Package
packages/collector-contract/src: the manifest schema (manifest.ts, strict, no org field), the window checks in Asia/Ho_Chi_Minh (window.ts), the request signature (signature.ts), request and response schemas with error codes (api.ts) and every cap (limits.ts). - A batch is one feed and one closed window. Its parts are dataset kinds; each part is gzip NDJSON chunks of verbatim vendor rows, at most 8 MiB compressed each.
- A row schema is
<kind>@<n>. The server holds the minimum Zod schema (packages/connectors/core/src/collector-row-schemas.ts) and the mapper,mapRowson the source's entry inpackages/connectors/core/src/market-data-registry.ts. Mapping on the server lets a mapper fix replay stored objects without a new crawl.
Steps#
- Add the row schema for the new kind to
COLLECTOR_ROW_SCHEMAS: identity and the primary measure required, everything else passed through. - Extend
mapRowsfor thatrow_schemaso it returns the canonical rowspersistMarketIntelSnapshotwrites, and add the kind's target table toTARGET_TABLEinapps/worker/src/collector/promoter/promote.ts. - Check the quality gate in
apps/worker/src/collector/promoter/gate.tsagainst real captures of the kind (the weekly product dry run is recorded in the ADR) before you change a threshold. Thresholds live inlimits.tswith a row in limits and budgets. - Register the feed and grant it to a collector with
scripts/collector/register.ts(remote collectors runbook). - Subscribe an org: its market-data connector lists the feed key in
config.feeds, and its market-intelligence plugin is on.app_collector_list_feed_targetsinpackages/schema/sql/runtime-service-helpers.sqlis the only reader of that subscription.
Rules that bind#
- §233: the gateway role holds no grant on an org table; the promoter writes only snapshot-scoped
market_intel_*tables through the persister. - Re-delivery writes nothing: the persister keeps a live snapshot with the same source digest, and an older capture never replaces a newer one.
- A breaking contract change is a new
contract_version, added toSUPPORTED_CONTRACT_VERSIONS.
Tests to add#
apps/worker/src/collector/promoter/gate.test.ts: one case per new check, where the bad part passes without it.packages/connectors/core/src/collector-map-rows.test.ts: a field the persister reads survives the mapper.- The
verify:rlslegscripts/audit/rls-collector-isolation.tscovers grants and isolation; extend it when a role gains a table.