• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cameri / nostream / 46198618658
81%

Build:
DEFAULT BRANCH: main
Ran 28 Nov 2026 10:54PM UTC
Jobs 2
Files 353
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Nov 2026 10:50PM UTC coverage: 80.641% (+0.07%) from 80.567%
46198618658

push

github

web-flow
fix(cli): escape terminal controls in import error messages (#1242)

## Description

`nostream import` printed the message of a line error as it is:

```ts
console.warn(`[line ${lineNumber}] ${reason}`)
```

For a record that is not valid JSON, `reason` is the parser's message,
and Node's message quotes part of the input (for example `Unexpected
token '\u001b', "{"a":\u001b]52;c;...}" is not valid JSON`). The final
`Import failed: ...` message does the same for an unreadable JSON array.

- the per-line error and the `Import failed:` message in
`src/import-events.ts` now go through `escapeForTerminal`, the helper
added for `nostream info` in #1239, so control characters (C0, DEL and
C1) are shown as `\xNN`;
- `runImport` (`src/cli/commands/import.ts`), which `nostream import`
actually calls, escapes the message of a rejected import, such as a
missing input path that holds control characters, before the shared CLI
error boundary prints it. The shared printer is left alone, because
escaping there would also turn the newlines of other commands'
multi-line errors into `\x0a`;
- the text of the message is otherwise unchanged, so the parser context
stays readable;
- new tests: in `test/unit/cli/import.runtime.spec.ts` a line error that
holds an OSC 52 sequence is printed as `\x1b]52;c;ZXZpbA\x07` with no
control character left, and in `test/unit/cli/import-command.spec.ts` a
rejected import with a control character in the path is shown escaped.
Both fail without the change.

## Related Issue

Partly addresses #1022 (F-024). The other findings in that issue are
handled separately.

## Motivation and Context

The operator runs the importer on a file that may come from another
relay or a backup. A malformed record with a terminal escape sequence
can change what the operator sees or, in a terminal that allows OSC 52
writes, replace the clipboard. CodeRabbit's scan did not establish
reachability, so I checked the code and confirmed that Node's JSON error
message ... (continued)

6341 of 8481 branches covered (74.77%)

Branch coverage included in aggregate %.

8 of 9 new or added lines in 2 files covered. (88.89%)

12821 of 15281 relevant lines covered (83.9%)

709.55 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
82.0
3.61% src/import-events.ts
Jobs
ID Job ID Ran Files Coverage
1 Unit - 46198618658.1 28 Nov 2026 10:56PM UTC 353
78.65
GitHub Action Run
2 Integration - 46198618658.2 28 Nov 2026 10:54PM UTC 353
36.58
GitHub Action Run
Source Files on build 46198618658
  • Tree
  • List 353
  • Changed 4
  • Source Changed 2
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #46198618658
  • 75b375ce on github
  • Prev Build on main (#46197882440)
  • Next Build on main (#46268687258)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc