Skip to content

fix(web): stop double-publishing live dashboard events - #474

Open
Master-Norna wants to merge 1 commit into
umputun:masterfrom
Master-Norna:fix-web-live-session-double-tail
Open

Master-Norna wants to merge 1 commit into
umputun:masterfrom
Master-Norna:fix-web-live-session-double-tail

Conversation

@Master-Norna

Copy link
Copy Markdown
Contributor

Summary

With --serve and watch dirs configured, the dashboard runs in multi-session mode. 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, and starts a Tailer from 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. StartTailing and Reactivate now 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. RefreshStates now also refreshes the live session, and BroadcastLogger forwards completion diff stats as a DIFFSTATS output line — a live session has no tailer to read that line back from the file.

Validation

  • TestDashboard_Start_MultiSessionDoesNotDuplicateLiveEvents starts 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_LogDiffStats and TestDisplayStats/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/ralphex has 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, and git diff --check: passed.
  • go test ./... on this Windows environment has the same failures as the unchanged baseline (permission, symlink, shell/process tests); -race cannot link here (missing WaitOnAddress/WakeByAddress*), CI runs it on Linux.

Agent Yan assisted participation

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>
@Master-Norna
Master-Norna requested a review from umputun as a code owner November 8, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant