Skip to content

Test the citation fetch's whole run - #137

Merged
bits-bytes-nn merged 1 commit into
mainfrom
refactor/citation-fetch-run
Nov 17, 2026
Merged

bits-bytes-nn merged 1 commit into
mainfrom
refactor/citation-fetch-run

Conversation

@bits-bytes-nn

Copy link
Copy Markdown
Owner

This picks up the minor review findings that were deferred after #135 and #136.

  • CitationFetch.run: the script's main block is now a function, and these tests cover it (6 cases):

    • writing the counts and naming the missing papers
    • a refused key, then a keyless retry
    • falling back to the published counts
    • published counts more than 7 days old being reported as an error
    • an unusable answer
    • nothing to write

    The main block now only reads the posts and calls run.

  • note moved into CitationFetch, so requiring the script in tests no longer defines a method on Object.

  • A wording test keeps the count's wording in _layouts/post.html and js/citations.js in step: the aria-label, the title and the link. A mutation check confirmed that changing the JS wording makes it fail.

The behaviour is unchanged. Not done, since the gain is small for the churn: unifying the entry field names across Ruby, JSON and JS, and making a stale citation_ids.yml key a warning instead of fatal (the PR gate already catches it).

Verification:

  • unit tests (215), post lint, actionlint, strict build, htmlproofer and validate-site.sh all pass
  • a real fetch counted 33 of 34 papers after two 429 retries

- CitationFetch.run holds what the script's main block did (fetch, the
  keyless retry, the fallback, the stale check, the write), so it is
  unit-tested; the main block only reads the posts and calls it.
- note moves into CitationFetch instead of a top-level method.
- A test holds the layout's and js/citations.js's wording of the count
  ("N citations on Semantic Scholar", title, link) to each other.
@bits-bytes-nn
bits-bytes-nn merged commit 5a93f34 into main Nov 17, 2026
3 checks passed
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.

1 participant