Flip LoggingMiddleware default to type-name-only and tighten selected-events signatures#514
Merged
Merged
Conversation
…-events signatures
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR changes the UI logging middleware to default to type-name-only logging, adds explicit summary logging for several high-volume actions, and narrows two event-selection action payload types to IReadOnlyCollection<T> so count access is O(1).
Changes:
- Simplified
LoggingMiddlewareso most actions now log only their type name by default, with explicit count-based summaries for large event payloads. - Tightened
EventLogAction.SelectEventsandSetSelectedEventsfromIEnumerable<DisplayEventModel>toIReadOnlyCollection<DisplayEventModel>. - Added a test logger utility and updated one test assertion to use
.Countinstead of.Count().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/EventLogExpert.UI/Store/LoggingMiddleware.cs | Reworks action logging behavior and adds summary logging for large event collections. |
| src/EventLogExpert.UI/Store/EventLog/EventLogAction.cs | Narrows public action record parameter types for selected-event collections. |
| src/EventLogExpert.UI.Tests/TestUtils/LoggerUtils.cs | Adds a test fake logger that records rendered interpolated log messages. |
| src/EventLogExpert.UI.Tests/Store/EventLog/EventLogStoreTests.cs | Updates a test to match the tightened collection type usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bill-long
approved these changes
May 4, 2026
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
Flips the Fluxor
LoggingMiddlewarepolicy from "default = JSON-serialize unknown actions, allowlist = type-only" to "default = type-name only (safe), opt-in = rich diagnostics", and tightens the twoEventLogActionselection records so the middleware can read.Count(property) instead of.Count()(LINQ).Why
The original switch had a
default:branch that JSON-serialized the entire action payload todebug.logon every dispatch, with a per-case allowlist for type-only logging. Four high-volume actions silently fell through to the default JSON path:EventTableAction.AppendTableEvents(carriesIReadOnlyList<DisplayEventModel>)EventTableAction.AppendTableEventsBatch(carriesIDictionary<int, IReadOnlyCollection<DisplayEventModel>>)EventLogAction.LoadEventsPartial(carriesIReadOnlyList<DisplayEventModel>)EventLogAction.SetSelectedEvents(carries the user's full selection)Result: every dispatch of these actions wrote a multi-kilobyte JSON blob to disk on the dispatch hot path. User caught it in the wild via
Action: EventLogExpert.UI.Store.EventTable.EventTableAction+AppendTableEventslog lines that should never have included payload at all.Changes
LoggingMiddleware.cs(-43 / +19):default:branch now logs onlyaction.GetType()._serializerOptionsfield (no longer reachable on the hot path; onlyStatusBarAction.SetEventsLoadingstill serializes and its payload is small/bounded — guid + 2 ints).addEventsAction→addEventAction(action isAddEvent, singular).EventLogAction.cs(+2 / -2): TightenedSelectEvents.SelectedEventsandSetSelectedEvents.SelectedEventsfromIEnumerable<DisplayEventModel>toIReadOnlyCollection<DisplayEventModel>. Every call site already passesList<T>orT[](verified via repo-wide grep); the broader type was fiction. Tightening unlocks.Count(property, O(1)) on the dispatch hot path.EventLogStoreTests.cs(+1 / -1):.Count()→.Counton the tightened signature for sibling-consistency with the other 5.Countsites in the file.LoggerUtils.cs(new):RecordingTraceLoggertest fake atsrc/EventLogExpert.UI.Tests/TestUtils/LoggerUtils.cs. NSubstitute can't cleanly capture interpolated string handler structs (ITraceLogger.Debug([InterpolatedStringHandlerArgument(""")] DebugLogHandler handler)); the fake callshandler.ToStringAndClear()synchronously and stores per-levelList<string>for assertions.Verification
.Count()→.Countoutlier inEventLogStoreTests.cs:190) was applied.