Repository navigation
Commit 67ade9d
run_json: reserve the report channel, so strategy output on fd 1 cannot corrupt a report
The harness printed the report or a typed failure on fd 1, but the strategy
library it loads runs in the same process and could write to fd 1 as well: one
native printf corrupted a successful report.
- The host saves the caller's stdout as a private report descriptor before it
parses arguments or loads any strategy, redirects native fd 1 to stderr, and
writes the report and every typed failure through the saved descriptor.
Failed-report discard now discards that descriptor.
- A publication guard shared by the main handler and the cleanup keeps a fault
after a published result or failure from printing a second document; the
exit status stays nonzero and the late diagnostic goes to stderr.
- FD sink mode keeps the native NDJSON stream on its caller-supplied stream. A
sink or phase descriptor, or the arena slot, that collides with the report
channel is refused with the existing run_request_invalid failure.
- docker/entrypoint.sh sends ordinary transpile, compile and bind subprocess
output to diagnostics; the explicit transpile-only mode keeps stdout.
- The documentation states the limit: the loaded library inherits the saved
descriptor, so this isolates ordinary native writes and is not a security
boundary.
- tests/test_run_json_stdout.py with tests/test_run_json_stdout_strategy.cpp
loads a stub strategy that writes a marker to fd 1 through the real harness:
clean runs print exactly the expected report with the marker only on stderr,
a failing run prints exactly one failure document, a fault after publication
prints no second document, and colliding descriptors are refused.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>1 parent 482b000 commit 67ade9d
8 files changed
Lines changed: 689 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
150 | 161 | | |
151 | 162 | | |
152 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
0 commit comments