A small module builds a view of report rows for the UI. After a recent change, the result started depending on when the caller reads the data and when the original filter list is modified.
buildView method must return a snapshot of the rows that match the filters at the moment of the call."ready" and with score >= minScore must be included in the result.allowedTeams list is empty, the team must not restrict the selection.items.scala-cli run .
view, the caller clears allowedTeams, and the set of rows changes;items, the already created view starts including it.view.visibleIds should reflect only the rows that matched at the time buildView was called.allowedTeams after the call must not affect the already built result.items collection after the call must not change the already built result.scala-cli 1.5.4buildView(items: mutable.Buffer[ReportRow], minScore: Int, allowedTeams: mutable.Set[String]): ReportViewitems and allowedTeams may be changed by the caller immediately after calling buildViewUse line comments to explain the problem, its impact, the fix and how to test it.