feat(HNT-2887): add crawl domain message and event types - #19
Conversation
c389458 to
5da2693
Compare
Rename the refresh-window message fieldsRename Downstream callers follow the rename rather than living here: the message validators in #20, the publisher-list fixtures in #36, |
Drop
|
| headline?: string; | ||
| authors?: ArticleAuthor[]; | ||
| summary?: string; | ||
| language?: string; |
There was a problem hiding this comment.
Good choice to keep this as a string; Zyte can potentially reply with any of the ISO-standard language codes.
There was a problem hiding this comment.
Let's add a comment here with the ISO format that this field is in based on the Zyte docs
| // worker gates re-fetch and writes its fetch claim against this value. | ||
| // Optional so a rolling deploy does not reject messages enqueued before | ||
| // the field existed; the worker falls back to the configured fetch TTL. | ||
| refresh_interval_minutes?: number; |
There was a problem hiding this comment.
Optional so a rolling deploy does not reject messages enqueued before the field existed
The crawling pipeline is greenfield work and not in production, so we shouldn't worry about breaking existing messages. Perhaps this comment is attributing the reason for the optionality incorrectly? Is it really there because we have a default refresh interval that's not sent along the message?
Would it be better just to send the refresh interval anyway, so this doesn't have to be optional?
| /** | ||
| * Surface and topic a discovered page is crawled for. A page | ||
| * can be crawled for several surfaces, so each discovery job | ||
| * carries one context per (surface, topic) pair. |
There was a problem hiding this comment.
Add an example of a surface (NEW_TAB_EN_US) and topic (BUSINESS?) to make it easier to read for new devs.
mmiermans
left a comment
There was a problem hiding this comment.
✔️ I literally cannot approve pull requests. 😄 This may be something we'll have to address.. In any case, I approve. You can approve as well and merge.
Goal
HNT-2887
Add the discovery-side and agent-side crawl domain types so the validators, handlers, and consumers that follow reason against one shared set of interfaces. This slice introduces
DiscoveryContext,CrawlArticleDiscoveryMessage,LiveArticle, andPublisherListin the messages module,ArticleDiscoveryEventin the events module, and an optionalrefresh_interval_minutesonCrawlArticleMessage, all re-exported from thecrawl-commonbarrel. The shapes to reason about are the discovery job, the discovery event that becomes acrawl.article_discoveriesrow, and the publisher list the agent loads from JSON.See docs/ARCHITECTURE.md in #14 for the message and event contracts these types encode.
Implementation decisions
refresh_interval_minutesoptional onCrawlArticleMessage