Repository navigation
Refuse a second apply while a change waits for confirmation; pending banner (#10) - #53
Merged
Merged
Conversation
…UI banner on every page
`apply A --confirm` then `apply B --confirm` before confirming A overwrote the marker: A's timer
exited, and B's rollback only went back to "after A" — A was kept without being confirmed.
- While the marker exists (applying, pending, reverting) `mr apply`, the web UI's apply (409 with
the pending state) and `mr sys restore` are refused: keep it (`mr confirm`) or roll it back
(`mr rollback`) first. `--dry-run` still works. The marker is claimed with O_EXCL.
- `mr rollback` without an argument undoes the pending change; a failed restore leaves it pending.
- API: confirm / revert POST-only with errors; `job` returns the pending state; every answer to a
logged-in client carries X-MR-Pending {state, via, left}.
- Web UI: banner under the header on every page with 回滚 / 保留 and the countdown; 保存并应用 is
blocked while it shows. Mock API emulates it.
- Tests: refusal in every state and path, dry run, confirm lifts it, exclusive claim, failed rollback.
Closes #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/etc/mini-router/confirm-pendingexists (state applying, pending or reverting), every other change is refused —mr apply(not--dry-run), the web UI's apply (HTTP 409 with the pending state) andmr sys restore(checked before any list file is touched) — with "keep it (mr confirm) or roll it back (mr rollback) first". The apply claims the marker withO_EXCL, so two applies started at the same moment cannot both proceed.mr rollbackwith no argument now undoes the pending change (its own snapshot, not simply the newest file in the history); it is refused while an apply runs, and a restore that fails leaves the change pending instead of stuck in "reverting".confirm/revertare POST-only and return errors (409);mr confirmno longer prints into the CGI response;jobincludes the pending state; every answer to a logged-in client carriesX-MR-Pending: {"state","via","left"}.Why
Before,
apply A --confirmfollowed byapply B --confirmoverwrote the marker: A's timer saw it replaced and exited, and B's rollback only went back to the state after A — A stayed without anyone confirming it. The web UI and an agent working at the same time made that easy. (VyOS: "Another confirm is pending".)Verification
tools/ci.shpasses (private and public trees). New tests: a second apply refused in every state through the CLI, the API and restore (no snapshot taken, marker untouched); dry run allowed;mr confirmlifts the block; unreadable marker; exactly one of 8 concurrent applies claims the marker; failed rollback keeps the change pending.Closes #10
https://claude.ai/code/session_01HWeUjo1dmS7gBkCYHrVjCr