Repository navigation
fix(web): stop double-publishing live dashboard events - #474
Open
Master-Norna wants to merge 1 commit into
Open
Master-Norna wants to merge 1 commit into
Master-Norna wants to merge 1 commit into
Conversation
With --serve and watch dirs configured, Dashboard.Start registers the in-process session and feeds it from the BroadcastLogger. The watcher then discovers the same progress file, sees it locked by this process, activates the session and starts a tailer from byte zero, so every live line was published a second time: output, section headers and task boundaries. Mark the in-process session as live output before registration and keep the tailer and loader paths away from it. The mark is cleared when the run ends or when a new run rewrites the same progress file, so a later run of the same plan is served by the ordinary tailer path again. RefreshStates now also refreshes the live session, so a finished run does not stay marked active, and BroadcastLogger forwards completion diff stats as a DIFFSTATS line: a live session has no tailer to read it back from the file. Co-Authored-By: Agent-Yan <352840372+Agent-Yan@users.noreply.github.com>
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
With
--serveand watch dirs configured, the dashboard runs in multi-session mode.Dashboard.Startregisters the in-process session and feeds it from theBroadcastLogger; the watcher then discovers the same progress file, sees it locked by this process, and starts aTailerfrom byte zero. Every live line was read back from the file and published a second time — output, section headers, and task boundaries.Mark the in-process session as live-output before registration.
StartTailingandReactivatenow leave it without a tailer, and the one-shot loader skips it. The mark is cleared when the run ends or when a new run rewrites the same progress file, so a later run of the same plan is served by the ordinary tailer path again.RefreshStatesnow also refreshes the live session, andBroadcastLoggerforwards completion diff stats as aDIFFSTATSoutput line — a live session has no tailer to read that line back from the file.Validation
TestDashboard_Start_MultiSessionDoesNotDuplicateLiveEventsstarts a real dashboard with watch dirs, waits for discovery, and publishes one line through the broadcast logger: 2 deliveries on the baseline, 1 with the fix.TestSessionManager_LiveSessionNotTailedAndStateRefreshed: discovery leaves the live session untailed and active; after the run closes, the refresh marks it completed and clears the live mark.TestSessionManager_LiveSessionAllowsNextRun: after the live run ends, a later run of the same plan path is tailed again. Without clearing the mark, the new run stays empty.TestBroadcastLogger_LogDiffStatsandTestDisplayStats/diff_stats_reach_broadcast_session: the live session records{4,12,3}and{2,3,1}; routing the same call through the base logger leaves the session stats nil.go test ./pkg/web: passed;go test ./cmd/ralphexhas the same five platform-specific failures as the unchanged baseline.golangci-lint v2.13.0 run --max-issues-per-linter=0 --max-same-issues=0: 0 issues;go vet ./...,gofmt, andgit diff --check: passed.go test ./...on this Windows environment has the same failures as the unchanged baseline (permission, symlink, shell/process tests);-racecannot link here (missingWaitOnAddress/WakeByAddress*), CI runs it on Linux.Agent Yan assisted participation