fix: the event stream carries the stale flag like list and inspect - #244
Merged
Merged
Conversation
vm status --event -o json reconciles a dead VMM to stopped exactly as list and inspect do, but its envelope still carried the bare record, so the one JSON path that watches for changes could not tell a crash-reconciled stop from a clean one. The envelope now wraps the same vmOutput, so all three JSON renderers share one shape.
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.
Why
#238 gave
vm list -o jsonandvm inspectastaleflag for a record that still readsrunningwhile its VMM is gone.vm status --event --format jsonreconciles the same way (a dead VMM shows asstopped) but its envelope still carried the bare record, so the one JSON path that watches for changes could not tell a crash-reconciled stop from a clean one; the table view of the same command shows(stale). No consumer reads the flag today (vk-cocoon's watcher keys onstateandpid), so this is about the three JSON renderers sharing one shape rather than documenting an exception.What
The event envelope's
vmfield is the samevmOutputwrapper list and inspect use: identical record fields plus"stale": truewhen the reconcile fired, no key otherwise. One line in the states table names the third command.Evidence
GOWORK=off go build ./...on darwin and linux,go test ./cmd/vm/ok,make lint0 issues on both platforms,aslclean; no comment added.{"event":"MODIFIED","vm":{"id":"v1",...,"state":"stopped","stale":true}}and nostalekey on a live record.