Skip to content

OpenConceptLab/ocl_issues#3070 | Rebuild expansion reports a 204 as accepted and a 409 as already running - #112

Merged
snyaggarwal merged 4 commits into
mainfrom
issues-3070-rebuild-expansion-204
Nov 24, 2026
Merged

snyaggarwal merged 4 commits into
mainfrom
issues-3070-rebuild-expansion-204

Conversation

@snyaggarwal

@snyaggarwal snyaggarwal commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

  • New rebuildExpansion.js helper (getRebuildOutcome):
    • Any 2xx: success. Shows "Expansion rebuild accepted." and refreshes the expansions.
    • 409: info alert with the API's detail (falls back to repo.expansion_rebuild_in_progress), and refreshes so the processing state shows.
    • Anything else: error, as before.
  • The rebuild request now asks for the raw response, so the status is still there on errors.
  • Only one rebuild request can be in flight. The dialog's Rebuild button shows a spinner and "Rebuilding..." and Create Similar is disabled while it waits.
  • New strings in en and pt-BR. es and zh get the whole Rebuild dialog set, which they were missing.
  • This is the only re-evaluate/ caller in oclweb3.

Tests: npm run eslint is clean. npm test passes 194/194, including the new rebuildExpansion.test.js. Not checked in a browser.

🤖 Generated with Claude Code

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  • onRebuildExpansion marks 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: withoutExpansionState drops 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.
  • buildExpansionMenuItems is only called from the JSX, after getExpansionProcessingState is defined.
  • The API sets is_processing before 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.

@snyaggarwal
snyaggarwal merged commit e5f197a into main Nov 24, 2026
2 checks passed
@snyaggarwal
snyaggarwal deleted the issues-3070-rebuild-expansion-204 branch November 24, 2026 02:19
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.

oclweb3: Rebuild Expansion reports failure when the rebuild succeeded (204 treated as error)

1 participant