fix(zapscript): apply system launcher defaults to path launches#897
Conversation
|
Need an answer fast? Review this PR in Change Stack to ask focused questions about the PR or a changed range. 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 (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds launcher-resolution and path-based inference, then applies resolved/inferred system-default launchers across launch-related command handlers and title handling, with tests validating inferred defaults, explicit overrides, and group-to-system resolution. ChangesSystem default launcher resolution
Sequence DiagramsequenceDiagram
participant cmdLaunch as cmdLaunch/cmdRandom/cmdSearch/cmdLaunchLast
participant apply as applySystemDefaultLauncher
participant resolve as resolveLauncherRefForSystem
participant infer as inferLauncherForPath
participant launch as LaunchMedia
cmdLaunch->>apply: invoke after system/media selection or path resolution
apply->>resolve: resolve system-default reference to concrete launcher ID
apply->>infer: infer launcher from path/URI when applicable
apply->>launch: call LaunchMedia with resolved/inferred launcher
launch-->>cmdLaunch: return launch result
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 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/zapscript/launch_test.go`:
- Around line 164-318: Add positive tests that exercise the new launcher-default
selection branches for launch.random's filesystem fallback and cmdLaunchLast:
create fixtures with multiple platforms.Launcher entries (including
grouped/default and explicit alternatives), stub mockPlatform.Launchers and
mockPlatform.RootDirs/Settings as needed, then call launch.random (or trigger it
via cmdLaunch with arguments that force random selection) and call cmdLaunchLast
with an absolute-path target to verify the chosen launcher ID (use
mockPlatform.On("LaunchMedia", ..., mock.MatchedBy(func(l *platforms.Launcher)
bool { return l != nil && l.ID == "<expected-id>" })) to assert selection).
Ensure tests cover both the filesystem fallback case and the DB-backed random
path so the branches in cmdLaunch and cmdLaunchLast that resolve default/group
launchers are exercised and assertions check result.MediaChanged and
mockPlatform.AssertExpectations.
In `@pkg/zapscript/launch.go`:
- Around line 97-101: The loop that returns a launcher ID currently ignores
SystemID and may return a launcher from the wrong system; update the resolution
in the code that iterates over launchers (the block using launchers, ref) to
only accept a match when either launchers[i].SystemID equals the intended target
system ID (e.g. a local systemID variable) or when launchers[i].SystemID is
empty (truly generic); do not fall back to the first global ID match, and ensure
the function returns no match (false) if no launcher for the target system or a
generic one is found.
🪄 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: 8b2d9cbd-7fda-454c-976b-d5d0cb87d058
📒 Files selected for processing (3)
pkg/zapscript/launch.gopkg/zapscript/launch_test.gopkg/zapscript/titles.go
Summary
Verified locally with go test ./pkg/zapscript/, go test ./pkg/api/methods/, and task lint-fix.
Summary by CodeRabbit
New Features
Tests