Repository navigation
fix(cli): escape terminal controls in import error messages #1242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cameri
merged 2 commits into
cameri:main
from
Priyanshubhartistm:fix/import-escape-terminal-controls
Nov 28, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'nostream': patch | ||
| --- | ||
|
|
||
| fix(cli): show control characters in `nostream import` error messages as escapes | ||
|
|
||
| When a line of an import file could not be parsed, `nostream import` printed the parser's message as it is, and that message quotes part of the file. A file with a terminal escape sequence in a malformed record could therefore change the operator's display or, where the terminal allows it, replace the clipboard. The per-line errors, the failure message and an error that quotes the input path (for example a file that does not exist) now show control characters as visible escapes (for example `\x1b`), so the context stays readable and nothing is sent to the terminal. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { expect } from 'chai' | ||
|
|
||
| import { runImport } from '../../../src/cli/commands/import' | ||
|
|
||
| describe('runImport', () => { | ||
| it('shows control characters of a rejected import as visible escapes', async () => { | ||
| const file = 'missing-\u001b]52;c;ZXZpbA\u0007.jsonl' | ||
|
|
||
| try { | ||
| await runImport({ file }, []) | ||
| expect.fail('Expected the import to reject') | ||
| } catch (error) { | ||
| const message = error instanceof Error ? error.message : String(error) | ||
| expect(message).to.include('Input file does not exist') | ||
| expect(message).to.include('missing-\\x1b]52;c;ZXZpbA\\x07.jsonl') | ||
| expect(message).to.not.match(/[\u0000-\u001f\u007f-\u009f]/) | ||
| } | ||
| }) | ||
| }) |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.