events: populate BuildCompletedEvent.DurationMs#46
Conversation
The DurationMs field was declared on BuildCompletedEvent but never set in translateBuildEvent, so every completion event shipped with DurationMs=0 regardless of actual wall-clock duration. Downstream consumers logging this field saw misleading "took 0ms" for builds that ran for minutes. Measure duration in the event bus rather than at each call site: the bus is the single chokepoint where every BuildSource converges (image pull, dockerfile, compose, features, uid_reconcile), so one change covers all sources. BuildChan stamps buildStart on every call (resetting on same-source re-entry so each build is timed independently); translateLoop forwards it to translateBuildEvent, which computes time.Since(start).Milliseconds() on completion. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR adds wall-clock duration tracking to build completion events in the event bus. A per-build ChangesBuild event duration tracking
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Summary
BuildCompletedEvent.DurationMswas declared but never set intranslateBuildEvent, so every completion event shipped withDurationMs=0for allBuildSourcevalues (image pull, dockerfile, compose, features, uid_reconcile).took 0ms, masking the very problem under investigation.buildStartinBuildChan(resetting on every call, including same-source re-entry) and computetime.Since(start).Milliseconds()intranslateBuildEventon completion. Measuring in the bus rather than at each call site means one change covers all five build sources without touchinguseruid.go/up.go/ etc.Test plan
TestBuildCompletedEvent_DurationMs— single-source build records non-zeroDurationMsafter a 20ms sleepTestBuildCompletedEvent_DurationMs_ResetsPerSource— secondBuildChancall resets the timer; second build's duration is not inflated by the first build's elapsed timego test ./...green🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests