Repository navigation
feat(spored): loud pre-stop failure/timeout notifications (#186) - #189
Merged
Merged
Conversation
A pre-stop hook that failed or timed out logged at the same level as success and was otherwise silent — the #184 data-loss shape (aws s3 sync against the wrong dir "succeeded" copying nothing). Now runPreStop tees the hook's stdout/stderr to a bounded tail buffer and, on error/timeout, emits a terminal-state notification (pre_stop_failed / pre_stop_timeout) carrying the output tail, plus a wall/msg warning to logged-in users. Still best-effort: shutdown always proceeds. SMS formatter (pkg/sms) gains the two events; spore-bot Slack/Teams/Discord formatting ships separately in spore-host. Tests: tailBuffer retains the tail; preStopDetail composes summary + tail. Refs #186
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Implements #186 (follow-up to #184/#63).
Problem
A
--pre-stophook that failed or timed out was logged at the same level as success and was otherwise silent — the #184 data-loss shape (aws s3 syncagainst the wrong dir "succeeded" copying nothing, instance terminated, ephemeral data gone, user found out later).Change
runPreStopnow tees the hook's stdout/stderr to a bounded tail buffer and, on the error/timeout branch, emits a terminal-state notification:pre_stop_timeout— hook killed at the timeout (the multi-GB-sync case)pre_stop_failed— hook exited non-zeroBoth carry the output tail (e.g.
fatal error: Unable to locate credentials, or anaws s3 syncsummary) and broadcast awall/msgwarning to logged-in users. Still best-effort — shutdown always proceeds; pre-stop never blocks the lifecycle action.pkg/smsformats the two new events.spore-bot Slack/Teams/Discord formatting ships in the paired spore-host PR.
Tests
tailBufferretains the tail (not head) and bounds memory;preStopDetailcomposes summary + tail.pkg/agentgreen; builds linux/darwin/windows; vet clean.Refs #186. Paired: spore-host PR (notifier formatting).