feat(HNT-2899): load and validate the agent publisher list - #36
Draft
mmiermans wants to merge 1 commit into
Draft
Conversation
mmiermans
force-pushed
the
claude/hnt-2086-agent-config
branch
from
July 6, 2026 17:09
17d7d43 to
6bad473
Compare
mmiermans
force-pushed
the
claude/hnt-2086-publisher-list
branch
from
July 6, 2026 17:09
9c08d05 to
57f2332
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
HNT-2899
Add a
publisher-listmodule so the crawl agent has a validated set of pages and live articles to enqueue.loadPublisherListreads and validates the committed JSON file and samples it down to the configured page limit, andfetchLiveArticlesreads the currently scheduled section items from the Corpus API when that source is configured.It builds on earlier slices for the crawl domain message types and validators, the Corpus section-items read, and the agent config. See docs/ARCHITECTURE.md in #14 for where the agent's page and live-article sources sit in the system.
Implementation decisions
loadPublisherListthrows when the file is missing, unparseable, or failsvalidatePublisherList.fetchLiveArticlesvalidates each Corpus item on its own and skips the malformed ones with a warning, while letting client and transport errors propagate.ApprovedItemmodel typespublisheras a non-null string with no default, so a blank publisher does not arise from production data. Accepting a blank is defensive robustness against malformed or dev-seeded input rather than a legitimate production state, and it is harmless because the crawler only echoes the value back unchanged. The validator reused from an earlier slice therefore permits a blank publisher and reserves skipping for an item missing a truly required field such as the title.limitPagesmaps each output slot tofloor(i * total / limit)rather than taking the first N or striding by a fixed integer.ceil(total/limit)over-strides and returns fewer thanlimitpages when the limit does not divide the total, and taking the first N collapses to one corner of the alphabetically sorted list and loses publisher and language variety.Promise.allover the configured surfaces, then flatten and de-duplicate by URL.Promise.allpreserves surface order, so the cross-surface dedup deterministically keeps the first occurrence of each URL.