fix(daemon): differentiate multi-profile state in status output (#1575)#1593
Open
Chen17-sq wants to merge 1 commit into
Open
fix(daemon): differentiate multi-profile state in status output (#1575)#1593Chen17-sq wants to merge 1 commit into
Chen17-sq wants to merge 1 commit into
Conversation
6df17a1 to
ff062d1
Compare
Author
|
Self-review: tightened the patch.
Diff went from +148/-7 to +91/-3. Test count went from 16 to 14 (4 state-coverage tests + 10 pre-existing). |
ff062d1 to
70e1398
Compare
…wener#1575) ``opencli daemon status`` rendered ``Extension: disconnected`` for three structurally different states — zero profiles (accurate), 2+ profiles connected with no default selected (misleading), and a requested profile that vanished (misleading). Users in case 2 (a common setup: work + personal Chrome profiles both running with the OpenCLI extension installed) read "disconnected" and started reinstalling extensions / restarting Chrome / restarting the daemon — when the actual one-command fix was ``opencli profile use <name>``. The status JSON already differentiates ``profileRequired`` and ``profileDisconnected`` flags (see ``daemon.ts:259-260``); this patch teaches the CLI formatter in ``src/commands/daemon.ts`` to mirror that distinction inline in ``daemonStatus()``. JSON payload is unchanged — only the human-readable label gains the three-state discrimination. Closes jackwener#1575. Test plan --------- Added ``describe`` block ``daemonStatus extension label states (jackwener#1575)`` to ``src/commands/daemon.test.ts``. Four tests covering all label branches via the public ``daemonStatus()`` output: * 2+ profiles with no default → "N profiles connected, none selected" * 1 profile with no default → singular grammar * requested profile disconnected → routable hint * zero profiles → plain "disconnected" (unchanged) All 14 daemon tests pass (4 new + 10 pre-existing) via ``npx vitest run src/commands/daemon.test.ts``.
70e1398 to
dce4120
Compare
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.
Linked issue
Closes #1575.
Summary
opencli daemon statusrendered the lineExtension: disconnectedfor three structurally different states:Users hitting case 2 (a common setup: work + personal Chrome profiles both running with the OpenCLI extension installed) read "disconnected" and start reinstalling extensions / restarting Chrome / restarting the daemon — when the actual one-command fix is
opencli profile use <name>.The daemon JSON has carried
profileRequired/profileDisconnectedflags for a while (seedaemon.ts:259-260). This PR teaches the CLI formatter to mirror that distinction.Implementation
src/commands/daemon.ts:formatExtensionLabel(status: DaemonStatus): string(exported for direct unit testing).connected (vX.Y.Z)— single profile selected, extension OK (unchanged).N profile(s) connected, none selected — run \opencli profile use `` — covers the 2+ profile no-default case AND the single-orphan-profile case where the user hasn't picked one yet. Grammar adjusts on count.requested profile not connected — open that Chrome profile, or pick another with \opencli profile use `— coversprofileDisconnected`.disconnected— true zero-profile case (unchanged).Imported
DaemonStatustype fromdaemon-client.jsto type the helper signature.The JSON payload does not change. The CLI text is the only user-visible surface that needed the three-state distinction.
Why this matters
A new user with a work + personal Chrome profile setup runs
opencli daemon status, sees "Extension: disconnected", and goes down the reinstall-everything debug path. With this change they instead see:— which is both diagnostic AND actionable in a single line.
Test plan
Added two
describeblocks tosrc/commands/daemon.test.ts:formatExtensionLabel — multi-profile state differentiation— covers all four label branches plus singular/plural grammar at the 1-profile-no-default edge.daemonStatus output for issue #1575 fix— asserts the end-to-end formatter never emits the bareExtension: disconnectedline in the 2-profiles-no-default case, and that theProfiles:follow-up line still lists both profile names.Local test run
5 new tests; 11 pre-existing tests still pass.
Checklist
getDaemonHealth()state machine.