Fix Actions cache key attribution - #1
Merged
Merged
Conversation
Match the double SHA-256 behavior used by hashFiles so reports include cache sizes and cleanup removes benchmark entries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the benchmark reporting logic to generate cache keys using the same “double SHA-256” hashing behavior as GitHub Actions hashFiles, improving cache entry attribution so reports can include cache sizes and cleanup can reliably remove benchmark-created cache entries.
Changes:
- Added
hashFilesSingle()to reproducehashFiles-style double hashing for a single marker value. - Switched expected cache key generation from
sha256()tohashFilesSingle()for benchmark-created caches. - Adjusted cache size summarization to avoid treating missing sizes as valid totals.
Show a summary per file
| File | Description |
|---|---|
| scripts/report.mjs | Introduces hashFilesSingle, updates expected cache key hashing, and tweaks cache size aggregation during summary generation. |
| scripts/report.test.mjs | Adds test coverage for the new hashFilesSingle hashing behavior. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Low
Comment on lines
+13
to
+16
| export function hashFilesSingle(value) { | ||
| const contentHash = createHash('sha256').update(value).digest(); | ||
| return createHash('sha256').update(contentHash).digest('hex'); | ||
| } |
Comment on lines
96
to
102
| const versionCaches = caches.filter(cache => cache.version === version); | ||
| const caseTotals = new Map(); | ||
| for (const cache of versionCaches) { | ||
| if (cache.sizeBytes === null) continue; | ||
| const key = `${cache.distribution}-${cache.iteration}`; | ||
| caseTotals.set(key, (caseTotals.get(key) ?? 0) + cache.sizeBytes); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Match the double SHA-256 behavior used by
hashFilesso benchmark reports include cache sizes and cleanup removes benchmark-created entries.Validated against the initial smoke run: all eight cache entries were attributed and removed.