feat(status): expose authoritative workflow events - #1137
Open
jonwinton wants to merge 14 commits into
Open
Conversation
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
Replace runner-specific timing and inferred progress with one lifecycle contract owned by
status.Tracker.Tracker.Do(ctx, state, fn)brackets every real migration, move, and datasync attempt and emits synchronous started/finished events.Observers are optional. With no observer attached, runners retain their existing behavior and do not query completed-work totals. The tracker remains zero-value ready; observer delivery is synchronous and panic-isolated, and callback state is copied before invocation so observers can safely replace or remove themselves.
Design
This deliberately does not add a second workflow engine beside Spirit's status machine.
status.Trackerremains the sole source of current state and timing; observation is a thin view of transitions and durable facts. Terminal evidence has its own event because reverse-finalized or ownership-ambiguous outcomes can be established after the final phase bracket closes.Mutation and ownership ambiguity remain distinct facts. A result can require manual recovery without claiming that a durable write was confirmed.
Verification
go test -race -count=1 ./pkg/statusMYSQL_DSN=msandbox:msandbox@tcp(127.0.0.1:8033)/test go test -race -count=1 ./pkg/migrationMYSQL_DSN=msandbox:msandbox@tcp(127.0.0.1:8033)/test go test -race -count=1 ./pkg/movego build ./...go vet ./...Supersedes the observer/lifecycle approach in #1111 and the runner-local timing design merged in #1118. It also consolidates the correctness slices previously proposed in #1112 through #1116.