prerender-v0.8.2 — @harperfast/prerender
Fixes queue resume, which reported the opposite of what it did in v0.8.1. Anyone on 0.8.0 or 0.8.1 should upgrade — see PR #33.
The bug
setPause writes the intent and then re-resolves it in the same request. A row deleted earlier in that request is still visible to the read, so a resume re-read the row it had just deleted, resolved straight back to "paused", and returned that as the outcome:
POST /prerender_admin/queue {"scope":"localhost","paused":null}
-> local: { status: 'paused', paused: true, source: 'node' } # reports still-paused
GET /queue_control/ -> [] # the row WAS deleted
POST (identical call, second request) -> { paused: false, source: 'default' } # correct
v0.8.1's projection bug had been masking this. The node did recover on the next status-sync tick (~1m), so the practical damage was an API that lied about the outcome — and an operator retrying a resume that looked stuck.
Fix
The just-written scope is passed to getDesiredPause as pending, substituting that value instead of reading it back; the other scope is still read normally since the write didn't touch it. This removes the dependency on write visibility for both put and delete rather than special-casing the delete. The value threaded through is the normalized intent.paused, so the resolved and persisted states are identical by construction.
Also dedupes knownScopes, which listed all twice whenever a cluster control row existed.
Verified against a live instance
The full matrix, on a real Harper instance rather than only in tests:
| Action | Result |
|---|---|
| pause node | paused: true, source: node |
claim |
[] |
resume node (paused: null) |
paused: false, source: default ← was paused: true, source: node |
claim |
jobs returned |
| cluster pause | paused: true, source: cluster |
claim |
[] |
node override paused: false |
paused: false, source: node — runs through the cluster pause |
| clear node override | paused: true, source: cluster — falls back correctly |
Plus all three validation rejections (unknown scope, all + null, non-boolean).
Tests
160 pass. The new read-side suite uses fakes that reproduce Harper's projection and write-visibility behavior, so both defects fixed across 0.8.1/0.8.2 are now pinned: with either fix reverted, 4 cases fail.
Unaffected
Read-only surfaces are unchanged and were verified live: the admin page and its CSP headers, session/login, effective config with secret redaction, the overview (counts, node list, due histogram), and the URL explainer.