oliver-zehentleitner / maity

web: board readList: one first-wins card merge, and the open-group failure handling out of the read

Sign in to report

tsk-hvxezr925rq5 Proposed

Audit round 4 (tsk-hgnbapyw7hnh), read at 0a1b832e. Kind: duplication / design.

What is wrong

  • readList in web/js/board.js (from 745) merged the groups' cards by id, first one kept, in one place before #2043/#2047; it now does it three times with the same inline loop: board.js:761 (first pages), board.js:785 (withOpen, after a failure) and board.js:796 (all parts).
  • With the first-page draw (#2043) and per-column failure (#2047) the function grew to about 80 lines holding four concerns: the group reads, the first-page race, per-group failure bookkeeping (openFailed, openParts, withOpen) and the reconcile passes. The state it feeds back is spread over openPartial, openFailed, closedPending, closedError in the view (board.js:819-825, reset by hand at 890-893, 1588-1590 and 1611-1617).

Proposal

  • A small mergeById(lists) helper for the three merges.
  • Move the open-group failure handling into its own function that returns { cards, openFailed }, and reset the four column-state variables in one place (one columnState object) instead of at each of the three read outcomes.

Effort / risk: S-M. Medium: the smoke tests for tsk-ywf14h6qd6kq and tsk-qw08c8ds214g pin the behaviour and should pass unchanged. Not the reconcile fallback (tsk-t104rfvhnsft).