Repository navigation
Conversation
Keep published failures separate from proposed computation status so held rejection, retry and recovery obey the selected frame's publication rules. Preserve successful memo history and loading seeds independently of accessor outcomes, including first failures and captured snapshots. Apply terminal delivery gates to both promise outcomes, share effect execution and projection failure notification, and preserve original thrown causes when diagnostic formatting fails. Follow next's first-load direction rule for both successful and failed answers created over a live hold. Add regressions for outside reads, latest derivations, same-value recovery, first-outcome timing, snapshots, projections, promise delivery and error data.
🦋 Changeset detectedLatest commit: 7b5d641 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will degrade performance by 18.34%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | build + consume |
280.3 µs | 604.2 µs | -53.6% |
| ❌ | construct |
32 µs | 33.7 µs | -5.1% |
| ❌ | construct |
31.8 µs | 33.5 µs | -5.06% |
| ⚡ | ownKeys |
266.9 µs | 250.9 µs | +6.39% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing GabbeV:fix/latest-settled-error (7b5d641) with next (e799cbd)
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.
@ryansolid I started investigating a issue with AI and found that error and value results are handled inconsistently. Trying to fix that found additional issues and I think the PR might have grown a bit out of hand in the end. Please feel free to reuse or discard any parts of this PR that makes sense but I think the tests and description might be useful. I could also ask my AI to decompose into issues if you prefer.
The rest of this description is by the AI:
Summary
Successful and failed results do not consistently follow the same publication and recovery rules in the signals core. A derivation can discover either result before reveal, but the result observed by an effect or an ordinary outside read should belong to the selected observable frame. Currently an error can bypass that selection, and recovery can be lost when the successful payload equals the last good value.
The investigation started with a
latest()derivation retaining an obsolete success after its source rejects. For example,createMemo(() => latest(source) + 1)can keep returning its old value after every request has settled, even though bothsource()andlatest(source)throw. It also reports that it is no longer pending.Following the outcome through the package exposed several related problems:
resolve,untilandrefreshrejection can bypass the foreign-frame delivery gate; async comparator failure can retain unobserved lazy readers; and a direct write to a failed writable derivation can leave its old error in place. Diagnostic formatting can also replace the original thrown value if coercion throws.This change stores published failures separately from working computation status and publishes success or failure at the selected frame's commit. Proposed failures still throw during derivation; effect callbacks wait for reveal.
isPendingincludes held outcome transitions in both directions, and recovery is an outcome change even when its successful payload is unchanged. The other paths above reuse the existing status, publication, flight-error and callback machinery.There is an explicit contract change for
loadingValue: a revealed failure ends the initial seed window, so a pending retry retains that failure instead of serving the placeholder again. The last successful payload, including the seed, remains the derivation'sprev; errors never becomeprevvalues.Successful payloads remain unboxed. Two error references are added to the lazy node extension; snapshots reuse their captured slot with an error tag. Fulfilled
Errorobjects remain ordinary data,NotReadyErrorremains pending control flow, and stack capture is unchanged. This does not redefine next's existing proposed-view behavior for imperative reads of latest/optimistic lanes. The outcome audit documents those distinctions.How did you test this change?
Rebased onto
next@d231b991(including #3882 and #3885), then rebuilt and reran:cd packages/signals && pnpm exec vitest run --maxWorkers=2).cd packages/solid && pnpm exec vitest run test --maxWorkers=1).The new regressions cover held rejection/recovery, same-value recovery, latest derivations, projections, snapshot outcomes, first-flight/seed behavior, promise delivery, comparator cleanup, writable outcomes, arbitrary thrown causes and fulfilled Error data. Upstream failure reproductions used unmodified
nextsource; the loading-seed rule is identified above as a contract change rather than an existing upstream guarantee.Earlier connected-Chromium checks cover compiled JSX and held DOM/outside-read correspondence. They were not rerun after this final rebase, and the older harness uses a pinned runtime with selected outcome-file overlays; it is not full current-next browser validation. Native-compiler web suites were not run because the local native binding is unavailable. No formal proof, memory saving or throughput improvement is claimed.