daemon status: say running=false when offline; upgrading notes for editable installs - #16
Merged
Merged
Conversation
`DaemonStatus` inherited `omit_defaults=True`, which drops every field equal
to its default — and for a stopped daemon that is every field. The result
encoded to `{}`: human mode printed nothing at all, `--json` printed an empty
object, and `status["running"]` raised a KeyError for the one caller the flag
exists for. The operation that exists to tell you the daemon is down was the
operation that could not say so.
`omit_defaults=False` on the struct, as `WhoAmI` already carries it for the
same reason. The offline result also fills in the socket it would have asked
and the Telethon layer, so "not running" says where it looked, and `version`
is `None` rather than `""` because nobody read a version off a process that
is not there.
`HealthSummary` behind `tlgr status` had the same shape and the same fix: it
is read when nothing works, which is exactly when every answer on it is
false.
The `json-only` tag was the other suspect and is not implicated — `daemon
status` never carried it — but nothing said so. `agent.schema` is the only op
that may, and now a test holds that line.
§2 assumed `pipx upgrade tlgr`, which does nothing for an install made with `pipx install -e <checkout>`: the venv holds a link to that working tree, so the running version is whatever the checkout is on and the upgrade is a `git` command. That is the part worth writing down — moving the branch swaps the code under a running daemon with no install step in between, so §1 and the watchdog it names are load-bearing here rather than housekeeping. The reinstall is conditional and 2.0.0 is the condition: it adds msgspec and pins telethon~=1.44.0, and a `git checkout` puts neither into the pipx venv. `pipx runpip tlgr install -e '<checkout>[fast]'` does, with a note that it replaces the extra set rather than adding to it.
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.
Summary
Two follow-ups found by the final fresh-clone verification of 2.0.0.
daemon statuswith no daemon running printedresult: {}(and therefore nothing useful in human mode):DaemonStatusinheritedomit_defaults=True, so an offline status where every field equals its default encoded to an empty object.DaemonStatusandHealthSummarynow always emit their fields; the offline path fillssocket,layerandsocket_owner. A registry-contract test pinsagent.schemaas the only json-only op, and three tests cover the offline case fordaemon statusand thestatusshortcut.docs/UPGRADING.mdgains the pipx editable-install variant of step 2 (the checkout is the install: stop the daemon and any watchdog first, move the checkout, install the new dependencies into the pipx venv).