Fix #2: pr honours *hush* only for the standard output stream#3
Conversation
The canonical kernel `pr` (kernel/klambda/writer.kl) gates the whole write on `*hush*`, so under `-q` / `(set *hush* true)` even a write to an explicitly-opened file stream was silently dropped, producing zero-byte files. `*hush*` is only meant to silence interactive console chatter. Register a native `pr` override in `register_hot_overrides` (installed after the AOT defun, in both boot paths) that consults `*hush*` ONLY when the target stream is the standard output stream (identified by Rc pointer-equality against the `*stoutput*` global); writes to any other (file) stream always occur. This matches shen-cl / shen-go. Tests: flipped the port-authored cli_launcher assertion that locked in the zero-byte-with-`-q` behavior to assert the file IS written under `-q` (renamed to quiet_does_not_silence_pr_to_file, referencing #2); updated the file-header divergence note. Gates: cargo fmt --check, clippy -D warnings, build, cargo test --workspace (190 passed), and the canonical kernel suite (134/134) all green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Independent agent review (ratatoskr + ShenSpec deep-dive, post-load native override discipline, 134/134 cert preserved) Code Review: #3PR: #3 SummaryThe change implements a targeted native This directly counters the root cause in the canonical kernel: Key verification points (per instructions):
Verdict (1-sentence): The patch is a correct, minimal, well-documented targeted override that fixes the canonical-kernel Issues
No other issues found in error paths, stream variants (In/Out/Closed all handled), clones (minimal and necessary), lock usage, race conditions (none possible), or canonical sources (untouched per PR contract and instructions). cargo fmt/clippy/build/test and 134/134 kernel certification are stated as clean in the PR body and are consistent with the minimal diff. Review path: /tmp/grok-reviews/9ad17548-REVIEW.md Posted automatically by Grok reviewer subagents. See also the PENDING review (if any) for inline comments on the Files tab. |
|
Key findings from independent reviewer subagent (deep ratatoskr dive including KLambda/writer.kl:3 root cause, builders, out-*, identity verification, and load-bearing test flip analysis): Low (robustness)
Info (pre-existing)
Info (documentation)
Subagent verdict: Correct, minimal, right identity check (Rc::ptr_eq on SharedStream), post-AOT in both boot paths, "still silences stdout" half preserved, test flip appropriate. Full detailed review (with ratatoskr analysis) in previous top-level comment. cargo clean + 134/134 confirmed. |
| /// `*hush*` only for the standard output stream (issue #2). Returns the | ||
| /// original string, matching the kernel contract. | ||
| fn hot_pr(interp: &mut Interp, args: &[Value]) -> ShenResult<Value> { | ||
| let s = match args[0].as_str() { |
There was a problem hiding this comment.
Could you add an arity guard before indexing args here? Normal apply paths should pass two arguments, but this hot override is also registered on the direct path, so a malformed/direct call would currently panic on args[0] or args[1] instead of returning a ShenError.
|
CI note: the failing The failing case is I’d track that separately as a shen-rust issue: cap or preflight |
(absvector 100000000000) allocated unbounded and OOM-aborted the process (SIGKILL), uncatchable by trap-error. This also broke the debug `cargo test --workspace` gate (Gate 3): reader_fuzz::corpus_never_panics drives that exact input and was OOM-killed in unoptimized builds (release was fast enough to mask it, which is why it passed under --release). Cap absvector at 2^24 slots (~800x the largest vector the kernel allocates) and raise a catchable Shen error above it, mirroring shen-go and shen-cl (#3). Added regression assertions in primitives_coverage.rs (huge -> err, trap-able; boundary 2^24 and small sizes still ok). Full `cargo test --workspace` green in debug; fmt + clippy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes #2
Problem
The canonical kernel
pr(kernel/klambda/writer.kl) gates the entire write on*hush*. So under-q(or(set *hush* true)), even aprto an explicitly-opened file stream was silently dropped, producing zero-byte files.*hush*is only meant to silence interactive console chatter — shen-cl and shen-go both write to file streams regardless of*hush*.Fix
Register a native
proverride inregister_hot_overrides(installed after the AOT defun, in both boot paths). It consults*hush*only when the target is the standard output stream — identified byRcpointer-equality against the*stoutput*global. Writes to any other (file) stream always occur. Minimal and targeted; no kernel/canonical sources touched.Test change
The port-authored
cli_launcher.rssuite previously locked in the buggy behavior (asserting the-qfile was EMPTY, with an explanatory "divergence" comment). That assertion is flipped to assert the file IS written under-q(test renamed toquiet_does_not_silence_pr_to_file, referencing #2), and the file-header divergence note is updated. The without--qcase is retained.Suite / cert results
cargo fmt --all -- --check: cleancargo clippy --workspace --all-targets -- -D warnings: cleancargo build --workspace: okcargo test --workspace: 190 passed, 1 ignoredscripts/kernel-tests.sh): 134/134, 100%Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com