Repository navigation
wpfacts: a stream write keeps no reference to its chunk or callback - #16048
Merged
Merged
Conversation
perry's stdout / stderr `write` copies the chunk's bytes before it returns and keeps no reference to the chunk or the callback (stdin's `write` does nothing), so neither escapes. Beside foreign code the member called may be unknown code's replacement, which gets every argument: that hand-off is a foreign-only escape (`Model::foreign_only_reason`), which the solver's escape() / escape_at() drop in a program without foreign code. Test expectation (amp_loop k2d_keep_foreign_code_writes_a_contract_hand_off): its program imports `./unseen`, which the test compiled as an unresolved import. Rule UNRES-IMPORT (owner 2026-11-29): an unresolved import runs no code and writes nothing, so that program has no foreign code and the store `o.f` is decided. The test means an unseen module: it now loads one (`tests::foreign_code`), and the store stays undecided there. Fixture amp_k3 stream_write_beside_top_keeps_the_literal_store: the chunk is written from a node that also holds ⊤, without foreign code (skelpo src/main.ts:234); the old unconditional escape fails it.
proggeramlug
marked this pull request as ready for review
December 4, 2026 00:59
|
Caution Review failedThe pull request is closed.
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.
perry's
process.stdout.write/process.stderr.writecopy the chunk's bytes before they return and keep no reference to the chunk or the callback (with_write_bytes,schedule_write_callback; stdin'swritedoes nothing). The model no longer treats the chunk and callback as "kept by the stream" (a contract escape that, beside ⊤, made the chunk ⊤).Beside foreign code (an unseen module or another unit), the member called may be unknown code's replacement, which gets every argument. That hand-off is now a foreign-only escape (
Model::foreign_only_reason). The solver'sescape()/escape_at()drop it in a program with no foreign code.Stacked on the node:diagnostics_channel PR (branch cwn-topseedp7, head c869e47).
Test changes
k2d_keep_foreign_code_writes_a_contract_hand_off: the test program imports./unseenbut was compiled with that import unresolved. Rule UNRES-IMPORT (owner 2026-11-29): an unresolved import runs no code, so the program had no foreign code and the storeo.fis correctly decided. The test is meant to cover an unseen module, so it now loads one (tests::foreign_code). The expectation (store undecided) is unchanged.stream_write_beside_top_keeps_the_literal_store: the chunk is written from a node that also holds ⊤, with no foreign code (the skelpo src/main.ts:234 shape).Gate (head 2ff6e0e777 vs base c869e47)
Effect
skelpo STOP_ON_TOP gets past
process.stdout.write(bytes)(main.ts:234). The next first ⊤ is thehttp.createServercallback at src/core/http.ts:216.