Repository navigation
fix(cli): tell a missing import file from an unreadable one - #815
Merged
Ishaan Gangwani (ishaan1124) merged 2 commits intoSep 29, 2026
Conversation
ANIRUDDHA ADAK (aniruddhaadak80)
requested review from
Aayam Bansal (aayambansal) and
Ishaan Gangwani (ishaan1124)
as code owners
September 28, 2026 20:39
|
ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/import-malformed-json
branch
from
September 29, 2026 04:40
9ae030f to
092a46c
Compare
The handler collapsed both failures into one message and left the exit code at 0, so a script importing sessions could not tell a typo from a corrupt export. Extract the read into a helper that separates the two, checks the shape, and fails the command.
ANIRUDDHA ADAK (aniruddhaadak80)
force-pushed
the
fix/import-malformed-json
branch
from
September 29, 2026 11:19
092a46c to
da82203
Compare
# Conflicts: # CHANGELOG.md
Ishaan Gangwani (ishaan1124)
merged commit Sep 29, 2026
f389bfa
into
synthetic-sciences:main
8 of 9 checks passed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Eleven lines of
src/cli/cmd/import.tshad three separate problems:.catch(() => {})collapses every failure, so a file that exists but is not valid JSON is reported asFile not found.if (!exportData)block is dead code —Failed to read session datacan never be printed.Why it matters
File not found: /path/you/just/typedsends the user hunting for a path that is right there. The real cause — a truncated export, a merge-conflict marker, a JSONC file — is invisible.The exit code matters more.
importis the natural way to move a session between machines and to script a restore, soopenscience import backup.json && echo doneprintsdoneafter a completely failed import.There's also a quieter third failure: valid JSON that is not a session export.
{"hello": "world"}parses fine, so!exportDatais false, and the next line isexportData.info.id— aTypeErroronundefined.Verification
The read logic is extracted to an exported
readExporthelper so it can be driven from a test without bootstrapping a project; the new test covers five inputs.Confirmed against the original code on this machine:
With the fix:
The malformed case asserts
not.toContain("File not found")as well as the new message, so the two failure modes cannot collapse back into one.The change
and in the handler:
The success path and the write loop are unchanged. Failures go to stderr where a script can capture them, and the dead duplicate branch is gone.
bun run typecheckclean; touched files are Prettier-clean (checked on LF-normalized copies — this checkout hascore.autocrlf=true, which makes Prettier flag every file in the repo).Fixes #814