Skip to content

Add endpoint to list pathogen repos#1307

Open
victorlin wants to merge 1 commit intomasterfrom
victorlin/list-pathogens
Open

Add endpoint to list pathogen repos#1307
victorlin wants to merge 1 commit intomasterfrom
victorlin/list-pathogens

Conversation

@victorlin
Copy link
Member

@victorlin victorlin commented Feb 3, 2026

Description of proposed changes

To be used by Nextstrain CLI.

Related issue(s)

Checklist

To be used by Nextstrain CLI.
Comment on lines +168 to +176
const searchResponse = await fetch("https://api.github.com/search/repositories?q=org:nextstrain+topic:nextstrain+topic:pathogen", {headers});
assertStatusOk(searchResponse);

const searchResults = await searchResponse.json();

const repos = await Promise.all(
searchResults.items.map(repo => repo.name).map(async (repo) => {
// Fetch pathogen registration file
const registration = await fetch(uri`https://api.github.com/repos/nextstrain/${repo}/contents/nextstrain-pathogen.yaml`, {headers});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Very general comments] making fetches like this, even if they can be cached and only require re-validation, seems like sizeable overhead. We've run into this general problem before, and (e.g.) update the datasets in groups every 6 hours, which avoids expensive fetch calls but results in staleness; the entire resource-indexer is another example. I don't know what's best here, but it stuck out to me when scanning the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the first fetch, a GitHub query does not have to be the source of truth since the list doesn't change very often. It could be (yet another) static file similar to manifest_core.json.

For the second fetch, it'll be harder to avoid GitHub as the source of truth, and unfortunately this one is more costly with 1 fetch per matching repo.

Copy link
Member

@jameshadfield jameshadfield Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something basic like a cache that re-validates no more than every n minutes might be fine for starters. Adding webhooks to the repos we control was what I was originally thinking of proposing, but it may not be worth it to start with?

Comment on lines +8 to +9
app.routeAsync("/pathogen-repos")
.getAsync(endpoints.pathogenRepos.listRepos);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd want to use content-negotiation here so only Accept: application/json requests send this response, which allows us to one day have a HTML page at the same URI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants