Skip to content

fix(doc): apply redirects to git history at load time#655

Open
caugner wants to merge 2 commits intomainfrom
247-apply-redirects-to-git-history
Open

fix(doc): apply redirects to git history at load time#655
caugner wants to merge 2 commits intomainfrom
247-apply-redirects-to-git-history

Conversation

@caugner
Copy link
Copy Markdown
Contributor

@caugner caugner commented Apr 30, 2026

Description

Update git_history, applying redirects at load time so moved pages resolve to a real history entry instead of the 1970-01-01 default.

  • Relocate GIT_HISTORY / git_history() from rari-types to a new rari-doc::git_history module.
  • For each (old_url, new_url) redirect, copy the old path's history entry to the new path (preserving any existing entry at the new path).

Motivation

Prevent the build from falling back to 1970-01-01 for translated docs that sync-translated-content moved locally during the build.

Additional details

Related issues and pull requests

Fixes #247

caugner added 2 commits April 30, 2026 16:15
Move the `GIT_HISTORY` static and `git_history()` accessor from
`rari-types::globals` into a new `rari-doc::git_history` module.
`HistoryEntry` stays in `rari-types`. Both existing call sites are
already in `rari-doc`, so this is a pure relocation with no behavior
change.

Sets up a follow-up that needs to compose `git_history` with
`rari-doc::redirects` at load time.
When `sync-translated-content` moves a translated doc to match an
updated en-US slug, the move is local to the build environment and is
never committed back to translated-content. As a result, the doc's new
path has no entry in `_git_history.json`, the build pipeline's lookup
misses, and the page footer shows `1970-01-01T00:00:00.000Z` for the
last-modified date and an empty hash for the last-commit URL.

Compose `git_history` with `redirects` at load time: for every
`(old_url, new_url)` pair, if the corresponding old file path has a
history entry and the new path doesn't, copy the entry under the new
key. Entries that already exist at the new path (e.g. from a `content
move` whose new location is committed) are preserved.
@github-actions
Copy link
Copy Markdown
Contributor

1fd8fbe was deployed to: https://rari-pr655.review.mdn.allizom.net/

@caugner caugner marked this pull request as ready for review May 4, 2026 18:15
@caugner caugner requested a review from a team as a code owner May 4, 2026 18:15
@caugner caugner requested a review from LeoMcA May 4, 2026 18:15
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.

Modified date of moved page (sync-translated-content) is 1970-01-01

2 participants