Repository navigation
Exit non-zero on publish request/status errors - #468
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR468Version: 🤖 Updated on each push. |
PR Review: Exit non-zero on publish request/status errorsReviewed by: automated review (claude-sonnet-4-6) CriticalNone. ImportantMissing bogus-key test for The fix adds The three existing Suggested addition to test("publish resend with invalid api key exits non-zero (issue #94)", async () => {
const ctx = createTestContext();
setTestConfig(ctx, {
apiKey: "nemar_invalid_key_for_exit_code_test_xxxxxxxxxxxx",
apiUrl: TEST_CONFIG.apiUrl,
username: "test-user",
});
const { exitCode } = await runCli(["dataset", "publish", "resend", "nm000104"], ctx);
expect(exitCode).toBe(1);
});SuggestionsBogus-key
Scope creep rationale should be in commit message or PR description The original issue (#94) called out only Nice-to-havesNone. False positivesNone. VerdictThe core fix is correct and minimal. All three catch blocks now have One important gap: the |
Adds the missing unconditional test for publish resend (mirrors the existing status/request bogus-key tests). Also changes nm000104 to nm099999 in the two existing bogus-key tests (test convention).
|
Addressed review findings:
Commit: 42de81c |
Closes #94
Summary
nemar dataset publish request,publish status, andpublish resendallcalled
spinner.fail()in their catch blocks and then returned with exit code0, masking failures from any caller that checked
$?. Every other command insrc/commands/dataset.tsexits 1 on error; these three were the outliers.Added
process.exit(1)at the end of each catch block so failures propagatecorrectly. Test coverage:
publish status/request/resend for non-existent dataset returns errortests intest/publish-workflow.test.tsto alsoassert
exitCode === 1(these only run whenTEST_USER_API_KEYis set).isAuthenticated()passes but the API call fails. Verifies the catchbranch exits 1.
Test plan
bun test test/publish-workflow.test.ts(20 pass, 0 fail)bun run tsc --noEmit(passes)bun run build(passes)