Skip to content

fix: live query entry mix-up with equal items, racy view tests, and README for 7.0 - #422

Merged
glennawatson merged 5 commits into
mainfrom
fix-view-convergence-tests
Dec 2, 2026
Merged

glennawatson merged 5 commits into
mainfrom
fix-view-convergence-tests

Conversation

@glennawatson

@glennawatson glennawatson commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

What this does

Fixes two tests that failed in the Windows SonarCloud job on main (run 46818962879), fixes a live query bug that a third test found on this PR, and brings the README up to date for 7.0.

Live query bug: wrong entry removed among equal items

OrderedList_SubscriptionsBalanceAfterAnyMutations timed out on macOS on this PR's first run. It uses random scripts, and one rare script hit a real fault.

When a source held two items that were equal by value but were different instances, removing one could drop the other one's entry from an unordered live query. The query then tracked an item that was no longer in the source. An in-place change to the remaining item was not seen, so a SelectMany subscription stayed attached after its item left the filter.

The projection now looks for the entry that holds the same source item instance first, and falls back to the search by value. Value type sources are unchanged. New tests cover the case directly and the comparer on its own.

README

  • The README now describes only the library as it is today. The upgrade notes moved to docs/migration-v6-to-v7.md, which also lists the 7.0 breaking changes: sealed classes, no quaternary base class, Reactive2DList<T> not deriving from ReactiveList<ReactiveList<T>>, filtered view order, and parameter names.
  • Adds badges for CodeQL, the SonarCloud quality gate, the OpenSSF Scorecard and the ReactiveList.Reactive package, in the same style as the existing ones.
  • Adds the Queries namespace to the import lists, with a table of what each namespace holds.
  • Adds sections for deferred notifications, versioned snapshots, source options and the view BatchResetLimit.
  • Corrects the Reactive2DList<T> description and extends the API overview, thread safety and performance tables.
  • The new code samples were compiled and run against the library.

SortedView_Throttled_ConvergesToSortedSource

The test waited until the view held the last item written, then compared the view with the source. The view changes on its scheduler thread, and the last item sorts ahead of the others, so it can show before the rest of the items are in place. The failing run saw 3 of 6 items.

The test now waits until the view holds exactly the source items, then checks the order. The grouped and throttled filtered fuzz tests used the same wait, so they get the same change.

QueuedBurst_PreservesAllCurrentKeysAndValues

The test waited for the first queued callback, ran the queue once, then asserted. The dictionary delivers a burst from a background reader, so the first callback can cover only part of the burst. The failing run saw the value from update 60 of 100.

QueuedViewSequencer gains RunUntilAsync, which runs the queue until a condition holds or a timeout passes. The test uses it to wait until the view matches the source.

Verification

  • Strict Release build of the solution: 0 warnings, 0 errors.
  • ReactiveList.Tests (2,488) and ReactiveList.Reactive.Tests (2,518) pass on Linux.
  • A standalone program reproduced the live query fault every time before the fix and passes after it.
  • The 196 fuzz tests in ReactiveList.Tests pass three times in a row on Linux, and the sorted view tests pass with the failing seed e4Yk7-44vIob.
  • ReactiveListTestApp.Tests targets Windows only. It builds on Linux but cannot run there, so the Windows CI job is the check for that test.

- Sorted, grouped and throttled filtered fuzz tests waited only for the last item written, which can show while the view is still changing on its scheduler thread.
- The dictionary index burst test ran the queue once, but the dictionary delivers a burst from a background reader.
- Both now wait, within a timeout, until the view holds exactly what the source holds.
- Add the Queries namespace to the import lists and a table of what each namespace holds.
- List the 7.0 breaking changes in the migration section.
- Add sections for deferred notifications, versioned snapshots, source options and the view batch reset limit.
- Correct the Reactive2DList description and extend the API overview.
@glennawatson glennawatson changed the title test: wait for views to match the source before asserting test: wait for views to match the source, and update the README for 7.0 Dec 2, 2026
- The README describes the library as it is today.
- The upgrade steps, namespace table and breaking changes are in docs/migration-v6-to-v7.md.
- Add CodeQL, SonarCloud quality gate, OpenSSF Scorecard and ReactiveList.Reactive package badges.
- The README is packed into the NuGet package, where a relative link does not resolve.
- AGENTS.md named a slow-path method that does not exist.
- Removing one of two equal items that are different instances could drop the other one's entry from an unordered live query.
- The query then missed an in-place change to the remaining item, so a SelectMany subscription stayed attached.
- The projection now finds the entry that holds the same source item instance before it searches by value.
@glennawatson glennawatson changed the title test: wait for views to match the source, and update the README for 7.0 fix: live query entry mix-up with equal items, racy view tests, and README for 7.0 Dec 2, 2026
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e3cfe0e) to head (157354f).

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #422      +/-   ##
===========================================
+ Coverage   99.98%   100.00%   +0.01%     
===========================================
  Files         151       152       +1     
  Lines        7611      7619       +8     
  Branches     1478      1481       +3     
===========================================
+ Hits         7610      7619       +9     
+ Misses          1         0       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@glennawatson
glennawatson merged commit 501e94b into main Dec 2, 2026
18 checks passed
@glennawatson
glennawatson deleted the fix-view-convergence-tests branch December 2, 2026 07:55
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