Fix safe_items_count missing from cached runs when filtering by workflow_name#21491
Fix safe_items_count missing from cached runs when filtering by workflow_name#21491
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal!
💥 [THE END] — Illustrated by Smoke Claude
pkg/cli/logs_orchestrator.go
Outdated
|
|
||
| processedRun := ProcessedRun{ | ||
| Run: run, | ||
| Run: result.Run, |
There was a problem hiding this comment.
Good fix! Using result.Run instead of the raw run ensures SafeItemsCount (computed during artifact extraction) is persisted to the cache. The original code was silently discarding the computed value.
| if loaded.Run.SafeItemsCount != 4 { | ||
| t.Errorf("SafeItemsCount not persisted: got %d, want 4", loaded.Run.SafeItemsCount) | ||
| } | ||
| } |
There was a problem hiding this comment.
Solid regression test! The test clearly documents the bug and verifies the fix by round-tripping through save/load. The SafeItemsCount: 4 value makes the assertion easy to follow.
There was a problem hiding this comment.
Pull request overview
Fixes a caching bug where SafeItemsCount was computed in-memory but not persisted into run_summary.json, causing subsequent cached/filtered (workflow_name) reads to show safe_items_count=0.
Changes:
- Persist the computed
SafeItemsCountinto cachedRunSummaryby savingresult.Run(processed) instead of the raw APIrun. - Add a regression unit test to ensure
SafeItemsCountround-trips throughsaveRunSummary/loadRunSummary.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/cli/logs_orchestrator.go | Writes processed WorkflowRun (with SafeItemsCount) into the on-disk run summary cache. |
| pkg/cli/logs_summary_test.go | Adds a regression test ensuring SafeItemsCount is persisted and reloaded correctly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
pkg/cli/logs_orchestrator.go
Outdated
|
|
||
| processedRun := ProcessedRun{ | ||
| Run: run, | ||
| Run: result.Run, |
|
@copilot Review comments |
…y using result.Run Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 5b7e13b. The |
When
workflow_namefiltering is applied,safe_items_countis absent from all run objects andtotal_safe_itemsis 0 — even for runs that reported correct counts in unfiltered queries.Root cause
In
downloadRunArtifactsConcurrent,SafeItemsCountis computed and stored onresult.Run, but theRunSummarypersisted to disk was built with the originalrunvariable (the raw API struct,SafeItemsCount=0):On first processing (unfiltered, no cache),
result.Run.SafeItemsCountwas used correctly in-memory for the report. But the cache was written with 0, so any subsequent call — including aworkflow_name-filtered query that hit the cached artifacts — read back 0.Changes
pkg/cli/logs_orchestrator.go: Useresult.Runinstead ofrunwhen constructingRunSummary, soSafeItemsCountis correctly persisted to the on-disk cache.pkg/cli/logs_summary_test.go: AddTestSaveAndLoadRunSummary_SafeItemsCountas a regression test verifying the field round-trips through cache save/load.💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.
✨ PR Review Safe Output Test - Run 23223776723