Skip to content

Carry a file's timestamps into its prerendered rendering - #5986

Merged
backspace merged 4 commits into
mainfrom
cs-12678-percy-cached-index-last-modified
Sep 4, 2026
Merged

Carry a file's timestamps into its prerendered rendering#5986
backspace merged 4 commits into
mainfrom
cs-12678-percy-cached-index-last-modified

Conversation

@backspace

@backspace backspace commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This is meant to address this recently-common Percy diff:

s 2026-09-02 at 14 58 09@2x

This will still have some variability but CS-12770 is for overriding now in the tests to prevent that.

Claude: The FileDef shells render "· 4y ago" from meta.lastModified, but the resource the fileRender pass hydrates its FileDef from is the extract's, and that resource never carried timestamps. A live file-meta read stamps them from the index row, so a file's prerendered HTML omitted the modified time that the same file's live render showed. Any surface that can show either — the search sheet falls back to a live item while a row's HTML is still pending — read differently depending on whether the HTML was there yet.

Thread the row's lastModified / resourceCreatedAt through the render options into the extract, the route the content hash and size already take, and stamp them onto the resource through fileMetaTimestamps like every other file-meta producer. Both visits forward them: the fused index visit and the standalone prerender-html visit. An extract that fetched the file itself (the store's in-render fallback, a room attachment) reads them off the response's last-modified / x-created headers instead.

The FileDef shells render "· 4y ago" from `meta.lastModified`, but the
resource the fileRender pass hydrates its FileDef from is the extract's,
and that resource never carried timestamps. A live file-meta read stamps
them from the index row, so a file's prerendered HTML omitted the
modified time that the same file's live render showed. Any surface that
can show either — the search sheet falls back to a live item while a
row's HTML is still pending — read differently depending on whether the
HTML was there yet.

Thread the row's `lastModified` / `resourceCreatedAt` through the render
options into the extract, the route the content hash and size already
take, and stamp them onto the resource through `fileMetaTimestamps` like
every other file-meta producer. Both visits forward them: the fused index
visit and the standalone prerender-html visit. An extract that fetched
the file itself (the store's in-render fallback, a room attachment) reads
them off the response's `last-modified` / `x-created` headers instead.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files  ± 0      1 suites  ±0   2h 28m 2s ⏱️ - 8m 51s
4 616 tests +11  4 602 ✅ +11  14 💤 ±0  0 ❌ ±0 
4 631 runs  +11  4 617 ✅ +11  14 💤 ±0  0 ❌ ±0 

Results for commit c5a50c2. ± Comparison against earlier commit 5656129.

Realm Server Test Results

    1 files  ±0    190 suites  ±0   1h 6m 52s ⏱️ - 1m 24s
2 526 tests +8  2 526 ✅ +8  0 💤 ±0  0 ❌ ±0 
2 565 runs  +8  2 565 ✅ +8  0 💤 ±0  0 ❌ ±0 

Results for commit c5a50c2. ± Comparison against earlier commit 5656129.

@backspace
backspace marked this pull request as ready for review September 3, 2026 15:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 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 ⚠️ Failed 2026-09-03T15:12:37.436534Z 52da383 Draft marked ready
ℹ️ 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.

Empty commit. The modified segment this branch adds is rendered with
Intl.RelativeTimeFormat against the clock at snapshot time, so a build of
identical code is the test for whether those labels are stable: a clean run
means the timestamps behind them are fixed, and any diff means a snapshot's
metadata moves on its own and would keep doing so after merge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@backspace
backspace requested a review from a team September 3, 2026 22:20

@lukemelia lukemelia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Claude Code 🤖] Reviewed the timestamp-parity mechanism end to end: the epoch-seconds form threaded through RenderRouteOptions, the serialize/parse roundtrip (both keys gated behind fileExtract), the four file-meta producers now agreeing on the resourceCreatedAt key mapping via fileMetaTimestamps, and both the fused index-visit and standalone-prerender paths into buildFileResource. Did not re-run Percy.

No blocking issues. The fused index path and a live file-meta read now stamp the same meta.lastModified / resourceCreatedAt, and the header fallback covers the interactive extract (the store's extractFileMetaDirectly).

  1. One non-blocking follow-up: the standalone prerender-html visit lacks the index visit's unixTime(Date.now()) floor for a null fileRef.lastModified, so in that narrow case the baked HTML can still omit a modified time the row would show — see the inline note on visitForPrerenderedHtml.

Comment thread packages/runtime-common/index-runner/prerender-html-visit.ts Outdated
The standalone prerender visit left `fileLastModified` off its render options
when the adapter reported no mtime, while the index visit floors that case to
`unixTime(Date.now())` and writes the floor to the row. Since this visit runs
after that one, the row already held a modified time the baked HTML did not —
the disagreement between the two channels this path exists to remove, reached
by the one input that had no floor.

The extract's `last-modified` header fallback cannot cover it here: forwarding
the content hash and size is what lets the extract skip its own fetch, so no
response header is read.

Reaching for the row instead would be the exact fix, and is not available
cheaply — `realm_file_meta` carries createdAt, contentHash and contentSize but
not lastModified, and the only batch accessor for modified times is
realm-wide. The two floors are therefore separate `Date.now()` reads rather
than one value, which both shells render at day granularity.

Narrow: it needs an adapter that reports no mtime together with a recorded
content hash and size.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@backspace
backspace merged commit 4657860 into main Sep 4, 2026
72 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.

2 participants