Skip to content

feat(site): generate the home page "Recently added" list from git history#40

Open
benjibromberg wants to merge 1 commit into
mainfrom
feat/recent-from-git
Open

feat(site): generate the home page "Recently added" list from git history#40
benjibromberg wants to merge 1 commit into
mainfrom
feat/recent-from-git

Conversation

@benjibromberg

Copy link
Copy Markdown
Member

What & why

The home page "Recently added" panel was silently stale — frozen on mid-May content while ~37 papers, ~15 software tools, and several datasets/databases merged afterward never appeared.

Root cause: RecentlyAdded.astro imported a hand-maintained, committed recent.json. Unlike every other file in site/src/content/data/, the parser never generated it and .gitignore never excluded it — so the build/deploy just shipped whatever was last committed (last touched May 28). The "View the full changelog →" link was live; only the curated teaser rotted.

Fix

Turn recent.json into a build-time generated artifact derived from git log, so it refreshes on every pnpm parse/build/deploy and can't go stale again. It mirrors the existing git-momentum snapshot in metrics.ts:

  • recent.tsbuildRecentModel() runs one guarded git log over the canonical content files (Papers.md, Software.md, Databases.md, Datasets, OtherResources.md), maps Conventional-Commit scope → kind, filters to addition-verb subjects (so reorg/relabel commits stay out of a list titled "Recently added"), and applies a keyword heuristic for the research-area dot (falling back to tooling).
  • --no-merges (not --first-parent) so PR-merged additions surface — this repo merges via merge commits, which --first-parent would hide.
  • Graceful degradation: the git call is wrapped so a shallow clone / tarball build yields an empty list (the panel then renders just the changelog link) rather than failing the build. (The deploy runner already sets fetch-depth: 0, so the live list is complete.)
  • recent.json moves into site/.gitignore (now a regenerated build artifact); RecentEntrySchema/RecentSchema added to types.ts; structure-only recent.test.ts added (git-derived, so no exact-count ground truth).

No component change — the generated shape already matches RecentlyAdded.astro ({ date, kind, title, area }). No canonical-content edits.

Verification

  • pnpm --dir site parserecent.json (5 entries) — the June 11–12 adds (Pando, Context7, GGTA1 bovine deposit, Tac burger paper) + a field-gap add, newest-first, with sensible kind/area (the burger paper lands on sensory, matching its actual matrix cell).
  • pnpm --dir site test304 passing (incl. new 8-test recent.test.ts).
  • pnpm --dir site build → 38 pages; built dist/index.html renders the five June entries and the stale May entries are gone.

…tory

The home page "Recently added" panel imported a hand-maintained, committed
recent.json that — unlike every other file in site/src/content/data/ — the
parser never generated and .gitignore never excluded. It silently went stale
(frozen on mid-May content), so none of the additions merged afterwards showed.

Replace it with a build-time generated artifact derived from `git log` over the
canonical content files, mirroring the momentum snapshot in metrics.ts: a
guarded git() wrapper that degrades to an empty list on a shallow clone rather
than failing the build. Selection uses --no-merges (so PR-merged additions
surface; --first-parent would hide them) and an addition-verb filter (so
reorg/relabel commits stay out of a list titled "Recently added"); commit scope
maps to kind and a keyword heuristic maps to the research-area dot.

- add recent.ts (buildRecentModel) + RecentEntrySchema/RecentSchema in types.ts
- wire build/validate/write of recent.json into generate-data.ts
- move recent.json into site/.gitignore (now a regenerated build artifact)
- add structure-only recent.test.ts (git-derived, so no exact-count ground truth)
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