Repository navigation
Description
Area
area: nvx (host::cli::output and host::cli::sandbox::state, feature cli).
Base and confirmed scope
Base revision: b67d11964c7523e088ba7ff9c7ebcc399f5d868c.
The CLI already has one helper that turns text into a host line:
output::line
translates every \n to the host's line separator and then appends that separator.
sandbox::state::write_json
re-implements the same rendering inline:
let text = format!("{text}\n").replace('\n', LINE_SEPARATOR);That ad hoc expression is the only reason the
state.rs import
needs LINE_SEPARATOR, and therefore the only reason
LINE_SEPARATOR
is pub(crate). Every other use is inside output:
line,
line_end_after,
and
output's tests,
which reach private items through use super::*.
The confirmed callers of write_json are production
provision
and two restore tests,
one
and
two,
which need no change.
Proposed change and benefit
- Make
write_jsonrender its text withoutput::line(text)instead of repeating the line-ending logic. - Remove
pub(crate)fromLINE_SEPARATOR, making it private tohost::cli::output, the least visibility that its remaining uses require.
This leaves one implementation of the CLI's host line rendering and keeps the line-separator detail inside the module that owns standard-stream and line-ending behavior.
Why behavior is unchanged
For any text:
- the current expression renders
text.replace('\n', LINE_SEPARATOR)followed byLINE_SEPARATOR, because the appended newline is translated too; output::line(text)renders exactly the sametext.replace('\n', LINE_SEPARATOR)and then pushesLINE_SEPARATOR.
The temporary-file creation, private permissions, flush, rename, cleanup, error codes and messages, JSON content, and line separators on Linux and Windows remain unchanged. The visibility narrowing changes no public API: host::cli is hidden, and both items are crate-private already.
Acceptance criteria
write_jsonusesoutput::line, andLINE_SEPARATORis private tohost::cli::output.- The public API snapshots in
nvx/public-api/, protocol bytes, and golden fixtures stay unchanged. - Existing tests stay unchanged, including
host::cli::output::tests::lines_end_as_python_prints_themand the sandbox state/restore tests. Record that the affected tests pass at the base revision. - No new abstraction is introduced; if implementation unexpectedly needs one, it gets a focused unit test.
git diff --shortstatreports fewer than 1000 changed lines in total, including tests and docs.- The gates that the change selects pass, including the applicable
check-nvxgates. Any unavailable hardware or cross-platform gate is reported as left to CI.
Follow-ups
None found in the surveyed CLI output and sandbox-state code.
Activity
ppenna commentedon Nov 17, 2026
Assignment to Pedro Henrique Penna (@ppenna) is verified. Native In Progress could not be set: GitHub reports status=null and viewerCanSetStatus=false, and both repository and organization planningStatuses are null. Explicit invocation of nvx-fix-issue for #1709 was rejected because the skill sets disable-model-invocation: true. No substitute workflow was started: no code, tests, public-API snapshots, or pull request were changed or created.
ppenna commentedon Nov 17, 2026
Duplicate of #1708, which proposes the same change. This issue's additional evidence is now on #1708: #1708 (comment). That covers why LINE_SEPARATOR can become private, the full list of write_json callers, the unit test that must stay unchanged, and why there is no public API change. The comment also links an existing fix branch for #1708.