Skip to content

fix(app-space): prefer COMPLETED record when a task has multiple TaskRecords - #2938

Merged
jung-thomas merged 3 commits into
DEVfrom
worktree-fix-recordmap-status-pref
Oct 26, 2026
Merged

jung-thomas merged 3 commits into
DEVfrom
worktree-fix-recordmap-status-pref

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Summary

getAppSpaceProgress + getEventProgress collapsed a user's TaskRecords to one per (taskType, taskLegacyId) with a plain last-write-wins loop over an unordered query. A user who reset a tutorial holds both a COMPLETED row and SUPERSEDED row(s) (#600 has-ever-completed). Whichever the query returned last won nondeterministically — a SUPERSEDED/reset row landing last made a completed tutorial render as not-done.

Reported: app-space showed "2 of 4" ABAP tutorials complete after the reporter reset + re-completed them; never-reset single-record tracks were fine.

Fix: buildRecordMap(userRecords) collapses deterministically — prefer COMPLETED > SUPERSEDED > other, ties broken by latest completionDate. Used at both call sites. The #2866 in-window downgrade still applies to the surviving record.

Verification

  • Ran the real getAppSpaceProgress resolution against PROD data for the reporter's ABAP track → 4/4 COMPLETED, deterministic.
  • New unit test test/lib/build-record-map.test.js (status preference, date tie-break, per-key separation). 29 tests pass locally.

Test plan

  • After deploy, confirm app-space shows reset-then-recompleted tutorials as complete

release: promote event display track-grouping fix (DEV \u2192 main)
release 1.41.5: event-display track grouping + counting fixes
…Records

getAppSpaceProgress + getEventProgress collapsed a user's TaskRecords to one
per (taskType, taskLegacyId) with a plain last-write-wins loop over an UNORDERED
query. A user who RESET a tutorial holds both a COMPLETED row and SUPERSEDED
row(s) for it (#600 has-ever-completed). Whichever the query returned last won
nondeterministically — when a SUPERSEDED/reset row landed last, a genuinely
completed tutorial rendered as not-done. Reported: app-space showing "2 of 4"
ABAP tutorials complete after the reporter had reset + re-completed them, while
other (never-reset, single-record) tracks were fine.

Add buildRecordMap(userRecords): collapse deterministically, preferring
COMPLETED > SUPERSEDED > other, ties broken by latest completionDate. Use it at
both call sites (developer-service.js:603, :714). The #2866 in-window downgrade
still applies to whichever record survives.

Verified: running the real getAppSpaceProgress resolution against PROD data for
the reporter's ABAP track now returns 4/4 COMPLETED deterministically. New unit
test (test/lib/build-record-map.test.js) covers status preference + date
tie-break + per-key separation.
@jung-thomas

Copy link
Copy Markdown
Contributor Author

Confirmed this fix also covers a second report: the first CAP tutorial ("Set up a self-contained development environment for CAP Node.js", lid 10000030) showed complete in its own view but app-space blocked progress. Reporter's records for it:

  • COMPLETED 2026-10-26T21:35 (in-window)
  • SUPERSEDED 2026-09-22 (the pre-reset completion)

Same mechanism — the unordered last-write-wins map could keep the SUPERSEDED reset row. buildRecordMap prefers the COMPLETED one. The pattern across both reports: every track the user had to reset+recomplete during TechEd rendered wrong; never-reset tracks were fine. One fix covers all of them.

@jung-thomas
jung-thomas merged commit b32cac2 into DEV Oct 26, 2026
4 of 5 checks passed
@jung-thomas
jung-thomas deleted the worktree-fix-recordmap-status-pref branch October 26, 2026 21:44
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