fix: three errors that ended with the wrong exit code
Found compiling the environment-variable table for AGENTS.md: - A REVIEW_GATES_MEM_RESERVE_MB that is no number threw std::invalid_argument, which nothing caught: the process aborted where it should end with a ValueError, exit 1. nan and inf were an unchecked cast. They raise ValueError / OverflowError now; a value past int64 saturates. - An env file that is not UTF-8: `run` ended with exit 1 where its preflight should stop it (exit 3), and `seats` parsed the raw bytes. Both read it as strict UTF-8 text now. - A broker address with a port past 65535 was cut to 16 bits; it is an OverflowError now, uncaught (exit 1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b092d98697
commit
53b7d6de31
9 changed files with 58 additions and 14 deletions
|
|
@ -212,10 +212,13 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"ok","total
|
|||
json.out.substr(0, 600) + json.err);
|
||||
const Process::Captured none = Self({"seats"}, base / "plain", withFake);
|
||||
const Process::Captured noFile = Self({"seats", "--env-file", "missing.env"}, base / "plain", withFake);
|
||||
Check("seats: no seat configured is exit 1 with what it looked for; a missing env file is exit 1 with the read error",
|
||||
Write(base / "plain" / "bad.env", std::string("\xff\n", 2));
|
||||
const Process::Captured badFile = Self({"seats", "--env-file", "bad.env"}, base / "plain", withFake);
|
||||
Check("seats: no seat configured is exit 1 with what it looked for; a missing env file and one that is not UTF-8 are exit 1 with the read error",
|
||||
none.returnCode == 1 && none.out.starts_with("no seat configured (CLAUDE_CODE_OAUTH_TOKEN1..6 / ANTHROPIC_API_KEY1..6; --local probes your own login)")
|
||||
&& noFile.returnCode == 1 && noFile.err.contains("FileNotFoundError: [Errno 2] No such file or directory: 'missing.env'"),
|
||||
none.out + noFile.err);
|
||||
&& noFile.returnCode == 1 && noFile.err.contains("FileNotFoundError: [Errno 2] No such file or directory: 'missing.env'") && badFile.returnCode == 1
|
||||
&& badFile.err.contains("UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte"),
|
||||
none.out + noFile.err + badFile.err);
|
||||
|
||||
// browser: its usage (an install fetches from npm).
|
||||
const Process::Captured noAction = Self({"browser"}, base);
|
||||
|
|
|
|||
Loading…
Reference in a new issue