Skip to content

Invalidate the run history in its own step, under the path CloudFront caches - #18

Merged
NimmLor merged 1 commit into
mainfrom
ln/focused-sagan-l95ly4
Nov 2, 2026
Merged

NimmLor merged 1 commit into
mainfrom
ln/focused-sagan-l95ly4

Conversation

@NimmLor

@NimmLor NimmLor commented Nov 2, 2026

Copy link
Copy Markdown
Owner

PerfSummarize invalidated /api/runs/history after each run, and the invalidations completed, but edges kept serving the history from before the run (X-Cache: Hit, Age: 1037, after an invalidation had completed).

PerfRouter's viewer request function (SST's Router) rewrites /api/runs/history to /runs/history before CloudFront looks in its cache, so the cached copy is keyed by /runs/history. CloudFront's docs say to invalidate both the viewer's path and the rewritten one.

  • PerfRun ends with an Invalidate step: CloudFront CreateInvalidation through the Step Functions SDK integration, for /api/runs/history and /runs/history, with retries.
  • PerfSummarize only stores the summary. It loses its CloudFront permission and PERF_DISTRIBUTION, and the repo drops @aws-sdk/client-cloudfront. scripts/perf-summarize.ts no longer invalidates anything, so a backfill shows up once the cached copy expires or the next run invalidates it.
  • README and doc comments updated.

Checks: bun run typecheck, bun lint --max-warnings 0 (canary), bun fmt --check, bun test all pass. Not deployed: after deploying, start a run and check that /api/runs/history returns it from an edge that had it cached.


Generated by Claude Code

… caches

PerfSummarize invalidated /api/runs/history, but PerfRouter's viewer
request function rewrites that to /runs/history before CloudFront looks
in its cache, so the cached copy is keyed by /runs/history and an edge
kept serving the history from before the run. CloudFront's docs say to
invalidate both the viewer's path and the rewritten one.

PerfRun now ends with an Invalidate step, CloudFront's CreateInvalidation
through the Step Functions SDK integration, for both paths. PerfSummarize
only stores the summary, and drops @aws-sdk/client-cloudfront.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DdeTv4n6b1zDWzb9yofdbN
@NimmLor
NimmLor marked this pull request as ready for review November 2, 2026 13:43
@NimmLor
NimmLor merged commit fc18b0f into main Nov 2, 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.

2 participants