Skip to content

perf: batch Vocs page Git history lookup - #911

Open
brendanjryan wants to merge 1 commit into
mainfrom
brendanjryan/vocs-bulk-git-lastmod
Open

brendanjryan wants to merge 1 commit into
mainfrom
brendanjryan/vocs-bulk-git-lastmod

Conversation

@brendanjryan

Copy link
Copy Markdown
Contributor

Motivation

Vocs starts a separate git log process for every page to resolve last-modified dates. On a tracked 990-page Tempo-like fixture, batching that lookup reduced the full build from 3m15s to 2m49s.

Summary

  • Read page commit dates from one Git history query per pages directory.
  • Keep MDX metadata and sitemap dates aligned with the existing per-file lookup.
  • Add representative page-date parity tests.

Key design considerations

  • Recheck Git HEAD during development; reuse one snapshot during production builds.
  • Preserve the existing undefined result outside Git so sitemap mtime fallback still works.

@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tempo-docs Ready Ready Preview Sep 24, 2026 3:48pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T15:29:59.146858Z dc319cf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc319cf3e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread patches/vocs@2.8.5.patch
+ : git(['rev-parse', 'HEAD'], directory)
+ if (!dates || dates.head !== head) {
+ const root = git(['rev-parse', '--show-toplevel'], directory)
+ const log = git(['log', '-z', '--format=%cI%x00', '--name-only', '--', directory], directory)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve merge-commit modification dates

When a page is changed while resolving a merge conflict, the previous per-file git log -1 -- <page> returns the merge commit, but this batched git log --name-only invocation does not emit filenames for merge commits unless a merge-diff mode is requested. The parser consequently skips the merge and assigns the page the date of a parent commit, producing stale page lastModified metadata and sitemap lastmod values; include an appropriate merge-diff mode or otherwise account for merge commits in the batch.

Useful? React with 👍 / 👎.

Comment thread patches/vocs@2.8.5.patch
+ : git(['rev-parse', 'HEAD'], directory)
+ if (!dates || dates.head !== head) {
+ const root = git(['rev-parse', '--show-toplevel'], directory)
+ const log = git(['log', '-z', '--format=%cI%x00', '--name-only', '--', directory], directory)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain other dates when one history path is unreadable

In a partial or offline clone where Git cannot load one historical tree beneath pagesDir, this directory-wide git log exits nonzero and the surrounding catch makes every getLastModified call return undefined, even for pages whose individual history remains readable. This also scans irrelevant files such as API .ts files under src/pages; in the checked-out repository, the batched command fails on a missing old tree while the previous per-file command still returns a date for src/pages/docs/api.mdx. Add a fallback or otherwise avoid making all page dates depend on every historical path being readable.

Useful? React with 👍 / 👎.

This branch was successfully deployed

1 active deployment
Preview — a2a57550 Deployed Sep 24, 2026 by vercel[bot]
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