Repository navigation
The load's abort checks: one step instead of 22 by hand - #328
Merged
Merged
Conversation
abortable(signal) gives each function of a load a step(value), written step(await …), that throws the abort in the turn the await resumes in, in place of 22 hand-placed signal.aborted checks. Two were missing: supplyParts and supplyLibraries' fallback set the bundle and state of the load that replaced theirs.
alekswebnet
force-pushed
the
fix/load-abort-steps
branch
from
December 3, 2026 06:36
c3d4c9f to
349c049
Compare
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Closes #327.
src/abortable.ts:abortable(signal)returns astep(value), writtenstep(await …), that hands the awaited value on, or throws the signal's reason once the load is aborted. Every await instartLoad,downloadAndIndex,index,supplyPartsandsupplyLibrariesis written that way.signal.abortedchecks become 7, each one deciding something: acatchthat stops retrying once aborted,startLoad's silence for a replaced load, and thetryBootguard.supplyPartssetinternalLibraryBundle, andsupplyLibraries' fallback set the state, the held package andinternalLibraryBundle, each after an await with no check.design/element.md: new rule Every await of a load is writtenstep(await …).Changed after my review of the first version
step(promise)was a promise of its own, awaited asawait step(…), so the load resumed one turn after the answer. A newsrcset in that turn was missed, and the replaced load wrote its state on: the kind of bug this pull request is here to end. The check now runs in the turn the await resumes in, as the hand-placed checks did; a test holds that turn.main; the long steps (a download, the warm, the pack's parts) settle on the abort themselves.supplyPartscalls,supplyLibraries, itsprobeSource, andpartPkgId.Tests:
tests/unit/abortable.test.ts(4); the player's whole suite passes locally (633). Under #326's config the changed files lint clean but for oneawait-thenable, onif (attempt) step(await attempt): the finding #326 disables on that line. The two conflict there, so after #326 merges I'll rebase this one and keep its comment.Summary by cubic
Replaces the load path's 22 hand-placed
signal.abortedchecks with oneabortable(signal)helper fromsrc/abortable.ts. Every await in the load now goes throughstep(promise), which settles as the promise does or rejects with the signal's reason the moment the load is aborted — so nothing after an await runs for a replaced load.Also fixes two spots where a replaced load wrote over its successor:
supplyPartssetinternalLibraryBundle, andsupplyLibraries' fallback set the state, held package, andinternalLibraryBundleafter an await with no check.Notes
catchthat stops retrying once aborted,startLoad's silence for a replaced load, and thetryBootguard.tests/unit/abortable.test.tsand a rule indesign/element.mdthat every await of a load goes through itsstep.Written for commit 349c049. Summary will update on new commits.