Skip to content

Keep quick star and unstar taps in the order you made them - #100

Merged
simonhamp merged 3 commits into
NativePHP:mainfrom
sulimanbenhalim:fix/keep-star-taps-in-order
Oct 28, 2026
Merged

simonhamp merged 3 commits into
NativePHP:mainfrom
sulimanbenhalim:fix/keep-star-taps-in-order

Conversation

@sulimanbenhalim

Copy link
Copy Markdown
Contributor

star a commit and quickly unstar it and both writes leave the outbox at once
the background lane runs up to 4 tasks side by side (poolSize = 4 in AsyncTaskExecutor.swift and 4 threads on Android) so the two can reach devnull and answer in either order

  • if the unstar answers first the star's older answer lands after it and the commit shows starred again even though the last tap was unstar since starsAfter() only sees later writes that haven't answered yet
  • if the unstar reaches devnull first there's nothing to remove yet and the star lands after it so the commit stays starred on devnull too

now a star or unstar waits while one for the same commit is on its way and goes as soon as that one answers or gets turned down

  • Outbox::starOnItsWay() and Outbox::nextStar() find them and a write left over from before the app closed doesn't count as on its way so it can't hold the next one back
  • the waiting one takes what devnull said to the one before it (PendingWrite::wasStarred()) so if it's turned down too the commit goes back to how devnull has it and not to the opposite of the last tap
  • a turned down tap that devnull already had as you left it puts nothing back and shows no Retry toast
  • finishRefreshes() can hand answers back newest first like the lane can

six new tests in OutboxTest cover answers coming back newest first plus the turned down and leftover cases
each fails when its part of the change is taken out and php artisan test and pint --dirty pass

one thing it can't fix: a star stuck behind a photo upload on its slot can time out at 30s while it still runs and then the next tap goes alongside it

Screenshots

  • No visible change

@simonhamp
simonhamp merged commit 43f0101 into NativePHP:main Oct 28, 2026
2 checks passed
@simonhamp

Copy link
Copy Markdown
Member

cool

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.

2 participants