Skip to content

fix(observable-polyfill): try public promise rejection callback - #7651

Draft
benlesh wants to merge 3 commits into
ReactiveX:masterfrom
benlesh:codex/promise-rejection-fix
Draft

benlesh wants to merge 3 commits into
ReactiveX:masterfrom
benlesh:codex/promise-rejection-fix

Conversation

@benlesh

@benlesh benlesh commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

ColdObservable.from(rejectedPromise) called a polyfill-private Subscriber Symbol that ColdSubscriber does not implement. Use the public contract directly:

(error) => subscriber.error(error)

Related: #7636, #7639. This preserves the simple public-contract design and fixes rejection delivery for ColdObservable. Regression coverage includes multiple direct subscribers, Error/string/undefined reasons, missing handlers, and cancellation.

The added unit test now requires exactly one global report carrying the original reason. It accepts reportError or an ErrorEvent fallback; it no longer forbids the browser's reporting API or imposes source coordinates. Observable's written reference d74bace7cf80200a01c81cfe20961e29ac7fa3d8 routes promise rejection to Subscriber.error (lines 658–675) and uses report-an-exception as its default error algorithm (447–450). HTML reportError invokes that algorithm; source coordinates are implementation-defined.

Draft: strict WPT conformance remains unresolved. The actual browser suite ran at a229d06b8f8e22bc9eadba09ee103af78d983564, contrary to the earlier PR description: WPT job, artifact 11761724197. It passed 523/525 upstream subtests. Both window and worker failed observable-from.any.js with Error lineno is 0 expected 0 but got 266; the column assertion was not reached. The pinned assertions remain unchanged, with no skips, allowlists, or relaxed gate.

A fresh disposable window/worker probe in pinned Chrome 150.0.7871.126 confirms native Observable.from rejection reports 0:0. An ordinary script's promise.catch(reason => reportError(reason)) preserves the reason but reports 12:34 in that probe. Both emit exactly one global error and no unhandledrejection. Thus there is a real native compatibility difference despite the spec allowing implementation-defined coordinates; local unit success does not establish WPT conformance.

Validation for the test/docs correction: all 55 polyfill tests and all 14 ColdObservable tests pass; both affected packages build and their public type checks pass. Fresh pushed-head WPT still fails the same window/worker coordinate assertions: 523/525 upstream subtests pass, 52/52 URLs complete, and 52/52 RxJS identity attestations pass (artifact 11771553903). All checks on the pushed head are terminal. All Node 22.13/24/26 package gates, repository checks, TypeScript-latest CI, CodeQL, dependency review, and full release-readiness checks (including mobile and desktop Safari, Chrome/Firefox/WebKit, Webpack, performance, Bun, and Deno) pass. The two WPT failures still say Error lineno is 0 expected 0 but got 266; neither reached the column assertion. Local strict WPT was attempted but could not produce valid conformance evidence: its HTTP server could not bind occupied port 8000, leading to executor timeouts; logs are retained and the task's runner was stopped without disturbing the existing server. The separate OSV policy failure on this head is outside this PR's scope. No dependencies, workflows, security policy, or AbortController behavior change.

@benlesh
benlesh marked this pull request as draft October 12, 2026 17:23
@benlesh benlesh changed the title fix(observable-polyfill): deliver promise errors to custom subscribers fix(observable-polyfill): try public promise rejection callback Oct 12, 2026

This branch has not been deployed

No deployments
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.

1 participant