Repository navigation
OpenConceptLab/ocl_issues#3070 | Rebuild expansion reports a 204 as accepted and a 409 as already running - #112
Conversation
…ccepted and a 409 as already running, and can't fire twice
…n expansion, and its answer closes only that expansion's dialog
snyaggarwal
left a comment
There was a problem hiding this comment.
Review
Verdict: ready to merge. One nit is left for later, and no browser check has been done yet.
What this fixes: re-evaluate/ returns 204 on success, and oclweb3 showed that as "Unable to rebuild expansion." Now:
- Any 2xx is shown as accepted and refreshes the expansions.
- A 409 is an info alert with the API's message, and also refreshes.
- Other statuses are errors, as before.
The request now asks for the raw response, so the status survives on errors. A null token still falls back to the signed-in user's token, as getHeaders already does.
Fixed since the first review pass:
- A late response no longer closes a Rebuild dialog that was reopened for a different expansion (
closeIfShowing). - The pending guard is now per expansion URL (
createRebuildGuard), so one rebuild in flight doesn't disable Rebuild on other expansions. Reopening the dialog for the expansion that is still rebuilding shows "Rebuilding...", instead of a click that silently does nothing. - The guard and the dialog-close rule have tests.
- es and zh now have the whole Rebuild dialog set, which they were missing. The translations are machine-written, so a native speaker should look them over.
Left as is (nit): if the dialog is closed during a rebuild, the version row shows no progress until the response arrives (about 20s), because the row only reads the expansion's processing flag. That's acceptable for now.
Checks: npm run eslint is clean. npm test passes 198/198. Before merging, it's worth a quick click-through in a browser: rebuild HEAD, double-click, then cancel and reopen.
…build as processing and disables its rebuild actions
snyaggarwal
left a comment
There was a problem hiding this comment.
Review (after 9b7f60e)
Verdict: ready to merge. Every finding from the earlier passes is fixed, and this pass found nothing new.
New since the last review: the row shows a pending rebuild.
onRebuildExpansionmarks the expansion as processing as soon as the request goes out. The row's processing flag and the version's "expansions processing" count show it even if the dialog is closed while the request waits (about 20s).- When the response comes back:
- 2xx or 409: the existing refresh plus the processing effect move it to "processed", or keep it processing (and start polling) if the API says it still is.
- Error:
withoutExpansionStatedrops the tracked state, so the row doesn't show a false "processed" chip.
- While it's processing, the expansion menu's actions (Rebuild, Set default, Create similar, Delete) and the inline Rebuild button on an expansion with updates are disabled, with the existing "disabled while processing" tooltip.
Checked:
- The processing effect doesn't depend on
processingStatusByExpansion, so marking an expansion processing doesn't make the effect undo it straight away. buildExpansionMenuItemsis only called from the JSX, aftergetExpansionProcessingStateis defined.- The API sets
is_processingbefore it queues the task, so any refetch during the wait also reads the expansion as processing.
Resolved from earlier passes: a successful 204 now shows as accepted and a 409 as already running; the pending guard is per expansion; a late response only closes its own dialog; the guard and state helpers have tests; es and zh have the Rebuild dialog strings (machine-written, so a native speaker should look them over).
Checks: npm run eslint is clean and npm test passes 199/199. Not yet tried in a browser. Before merging, please click through: rebuild HEAD, double-click, cancel while it waits and watch the row, then reopen.
Fixes OpenConceptLab/ocl_issues#3070
Problem:
POST <expansion>/re-evaluate/returns 204 when the rebuild runs. oclweb3 only accepted 200/201/202, so every successful rebuild showed "Unable to rebuild expansion." The API holds the request for about 20s while the rebuild runs, so users click again and the second click gets a 409, which also showed as an error.Changes
rebuildExpansion.jshelper (getRebuildOutcome):detail(falls back torepo.expansion_rebuild_in_progress), and refreshes so the processing state shows.enandpt-BR.esandzhget the whole Rebuild dialog set, which they were missing.re-evaluate/caller in oclweb3.Tests:
npm run eslintis clean.npm testpasses 194/194, including the newrebuildExpansion.test.js. Not checked in a browser.🤖 Generated with Claude Code