tests: #807 — async-context tracking harness (ALS + async_hooks)#824
Merged
Conversation
…nc_hooks) Eight independent sections probing the propagation rules Perry's `AsyncLocalStorage` / `async_hooks` need to follow: 1. Sync `run()` store baseline. 2. Single `await` to a separately-named async fn. 3. Chained awaits (depth 8). 4. `queueMicrotask` callback inside `run()`. 5. `setTimeout(fn, 0)` callback inside `run()`. 6. Nested `run()` with an await in each layer (sync outer / inner). 7. Concurrent `Promise.all` of two runs (isolation, no cross-pollination). 8. `createHook` lifecycle + `executionAsyncId` API shape. Node baseline (verified on Node v25.8): 16 stable lines, all sections PASS. Perry today (v0.5.912): - Sections 1, 6, and 7 already pass — sync nested runs and concurrent runs whose `getStore()` is called inline in the run body propagate correctly. - Sections 2/3/4/5 print `undefined` instead of the trace — the store evaporates when the await continuation is in a separately-named async function, or when the resume comes from queueMicrotask / setTimeout. - Section 8 — `createHook` returns undefined; the API is a name-only stub today. `known_failures.json` adds an entry pointing at #788 (AsyncLocalStorage real tracking) and #789 (async_hooks createHook lifecycle). Each section flips to PASS independently as those land.
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.
Summary
New
test-files/test_harness_async_context.tscovers the propagation rulesAsyncLocalStorage+async_hooksneed to follow, with eight independent sections each printingsection: result:run()store baseline.awaitto a separately-named async fn.queueMicrotaskcallback insiderun().setTimeout(fn, 0)callback insiderun().run()with an await in each layer.Promise.allof two runs (isolation, no cross-pollination).createHooklifecycle +executionAsyncIdAPI shape.What it surfaces today
Verified against
node --experimental-strip-types(16 stable lines, all sections PASS). Perry v0.5.912 has partial support:getStore()is called inline in the run body, and concurrent isolation holds.getStore()returns undefined.createHookreturns undefined; API is name-only today.That partial picture is itself the useful signal — the gap isn't all-or-nothing.
known_failures.json
Adds
test_harness_async_contextlinked to #788 (AsyncLocalStorage real tracking) and #789 (async_hooks createHook lifecycle). Each section flips to PASS independently as those land.Test plan
node --experimental-strip-typesproduces 16 stable lines.perry compile && /tmp/outruns end-to-end, exits 0 (it doesn't crash — it just printsundefinedfor the failing sections), and the diff pins exactly which propagation rules are missing.known_failures.jsonentry prevents the parity gate from flagging this as a new regression.Closes #807.