Clear resolved patch errors after discard - #325
Closed
juanmaguitar wants to merge 0 commit into
Closed
Conversation
juanmaguitar
force-pushed
the
juanmaguitar/explain-disabled-discard
branch
from
August 13, 2026 06:01
43b7e75 to
b0cf395
Compare
juanmaguitar
force-pushed
the
juanmaguitar/clear-apply-error-after-discard
branch
from
August 13, 2026 06:01
0ee9870 to
b64ddd1
Compare
juanmaguitar
force-pushed
the
juanmaguitar/explain-disabled-discard
branch
from
August 13, 2026 08:17
b0cf395 to
ea04712
Compare
juanmaguitar
force-pushed
the
juanmaguitar/clear-apply-error-after-discard
branch
from
August 13, 2026 08:22
b64ddd1 to
d302c5f
Compare
juanmaguitar
added a commit
that referenced
this pull request
Aug 13, 2026
## Why After a contributor chooses **Discard this ticket to its base** from a failed Revert, the discard succeeds but the old red patch error remains on screen. The checkout is clean, yet the interface still claims the operation failed. The original #325 belonged to the stale stack that GitHub closed while #324 was being recovered, so this PR lands the already approved fix directly on `trunk`. ## What changes After a successful discard, clear the stale apply error and related preview state. If discard fails, retain all of that state so the contributor can still understand and recover from the failure. ## How to test this **Platforms:** macOS and Windows. **Starting state:** ticket #65819 linked, PR #13017 applied, with this contributor edit on an applied line in `tests/phpunit/tests/customize/widgets.php`: ```php $this->assertIsCallable( $args['sanitize_callback'], 'sanitize_callback is callable' ); // Mi cambio. ``` 1. Click **Revert this patch**. Revert must be rejected, the checkout must remain unchanged, and the red error must offer **Save a copy of your work** and **Discard this ticket to its base**. 2. Click **Discard this ticket to its base**. 3. The applied PR, contributor edit, applied-layer card, and red error must all disappear. Ticket #65819 must remain linked. **What must not have happened:** - A failed discard must not clear the error or preview state. - The ticket itself must not be unlinked. - No unrelated ticket work may be removed. This flow passed in the approved integration artifact at commit `012d7df` on macOS and Windows. ## Risks and limitations The final Git tree is exactly the tree manually approved for the release candidate. Self-review: 0 [fix here] · 0 [follow-up]. ## Related Replacement landing for #325. Follow-up to #318 and #330. --- <details> <summary>Design decisions and alternatives considered</summary> The cleanup is derived in the existing pure reducer and only committed after `outcome.ok`. Keeping failure state unchanged avoids hiding recovery information after an unsuccessful destructive operation. A standalone PR avoids reusing the closed stack topology that caused #324 not to land on `trunk`. </details> <details> <summary>Review outcome (required — see AGENTS.md)</summary> 0 [fix here] · 0 [follow-up]. Lint, 1010/1010 tests, and `git diff --check` pass. The branch resolves to approved tree `d3904782d5e434df8591e99d3ccf2a49a52ebcc9`. </details> <details> <summary>Implementation notes</summary> Recovery head before squash: `6a88a26`. It contains one commit directly on #330's squash commit. </details> <details> <summary>Screenshots or recording</summary> The user-visible flow was manually validated on both target platforms in the approved integration artifact. </details>
Collaborator
Author
|
This PR was closed when its stale stack base was retired. Its single approved commit was rebased directly onto actual |
9 tasks
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.
Why
After Revert this patch failed because the contributor had edited an applied PR, Discard this ticket to its base successfully reset the checkout but left the old red failure banner on screen. The confirmation and terminal said the discard succeeded while the page still said the checkout was unchanged.
What changes
A successful discard now clears the applied layer, apply error, conflict breakdown and any older apply notice together. A failed discard preserves all of that feedback because the contributor still needs it.
How to test this
Platforms: any — this changes renderer feedback after the existing cross-platform discard operation.
Starting state: ticket #65819 with PR #13017 applied.
assertIsCallable()lines introduced by the PR.Expected: Revert fails without changing the checkout and shows the red conflict banner.
Expected: “All changes discarded” appears; the red banner and applied-layer card disappear.
tests/phpunit/tests/customize/widgets.php.Expected: the original
assertTrue()lines are restored.Expected: its work is unchanged.
What must not have happened: a failed discard must not hide the Revert failure or release the applied-patch slot; only a successful discard clears that feedback.
The regression was reproduced against the parent branch before the fix and now passes in
test/discard-apply-state.test.cjs.Risks and limitations
The Git reset itself was already correct and is unchanged. This only synchronizes renderer feedback with its successful result. The fixed flow needs confirmation in the next signed integration artifact.
Related
Follow-up to #318 and #324.
Design decisions and alternatives considered
The feedback transition lives in the existing pure renderer module so both success and failure can be tested without introducing a DOM harness for the large
index.jsxcomponent.Review outcome (required — see AGENTS.md)
1 [fix here] · 0 [follow-up] — fixed. The first source-scan regression could stay green without proving the behavior, so it was replaced with a pure state transition that proves success clears and failure preserves. Re-review: 0 [fix here] · 0 [follow-up].
npm run lint,npm test(990/990) andnpm run test:electron(990/990) pass.Implementation notes
applyFeedbackAfterDiscard()returns the complete apply-feedback state after the operation. The component applies it only afteroutcome.ok; the existing early return keeps failure feedback intact.Screenshots or recording
The screenshot from the manual test shows the pre-fix contradiction: “All changes discarded” while the failed-Revert banner remains. The after state will be captured from the signed integration artifact.