fix(daemon): reuse cached service binary on startup#896
Conversation
|
Worried about impact? Review this PR in Change Stack to explore blast radius before you approve or request changes. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRefactors manifest-based service-binary cache validation into a reusable helper with launch-specific matching; updates prepareBinary to delegate cache lookups and prune caches on hit; adds tests covering cache reuse behavior; and instruments service startup with timing/debug logs. ChangesService Binary Caching Refactor and Startup Instrumentation
Sequence DiagramsequenceDiagram
participant prepareBinary
participant cachedServiceBinaryFromManifest
participant matchesServiceMetadataForLaunch
prepareBinary->>cachedServiceBinaryFromManifest: call with launchValidation=true
cachedServiceBinaryFromManifest->>cachedServiceBinaryFromManifest: validate manifest source metadata
cachedServiceBinaryFromManifest->>cachedServiceBinaryFromManifest: check ServicePath equals cache path
cachedServiceBinaryFromManifest->>cachedServiceBinaryFromManifest: validate ServicePath is cache-contained
cachedServiceBinaryFromManifest->>matchesServiceMetadataForLaunch: check cached binary metadata
matchesServiceMetadataForLaunch-->>cachedServiceBinaryFromManifest: metadata match result
alt Cache hit
cachedServiceBinaryFromManifest->>cachedServiceBinaryFromManifest: ensure executable, log cache usage
cachedServiceBinaryFromManifest-->>prepareBinary: return cached path
else Cache miss
cachedServiceBinaryFromManifest->>cachedServiceBinaryFromManifest: log metadata mismatch details
cachedServiceBinaryFromManifest-->>prepareBinary: return no cache hit
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/service/daemon/daemon_test.go`:
- Around line 256-280: The test TestStart_CacheMissLaunchesCachedCopy currently
overwrites the source script at sourcePath but never verifies that the cached
copy is still used; after writing the new contents to sourcePath, either call
svc.Restart() (or svc.Start() again) and assert the running service still logs
the original "started:" entry in eventLog and/or the PID from svc.Pid() remains
from the cached binary, or assert that the eventLog does not contain the string
"replaced" to prove the new source was not executed; update assertions
accordingly to validate cached-copy behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 09ba3f7c-fcf5-4592-ae0b-8f8d246f9f68
📒 Files selected for processing (3)
pkg/service/daemon/daemon.gopkg/service/daemon/daemon_test.gopkg/service/service.go
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Checked
Summary by CodeRabbit
Bug Fixes
Chores
Tests