-
Notifications
You must be signed in to change notification settings - Fork 0
fix: feedback timeout 15s + honest UNCONFIRMED on expired deadline #117
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,6 +138,17 @@ describe('submit', () => { | |
| expect(result.status).toBe('error') | ||
| expect((result as { error: string }).error).toContain('ENOTFOUND') | ||
| }) | ||
|
|
||
| it('a timeout is UNCONFIRMED, not an error — the server finishes in-flight requests', async () => { | ||
| const fetchImpl = (async () => { | ||
| const e = new Error('aborted') | ||
| e.name = 'TimeoutError' | ||
| throw e | ||
| }) as unknown as typeof fetch | ||
| const result = await submit({}, fetchImpl) | ||
| expect(result.status).toBe('unconfirmed') | ||
| expect((result as { error: string }).error).toContain('may have been recorded') | ||
| }) | ||
| }) | ||
|
|
||
| describe('feedback command', () => { | ||
|
|
@@ -162,6 +173,16 @@ describe('feedback command', () => { | |
| }) as unknown as typeof fetch | ||
| await expect(feedback({ ...valid, json: true }, { interactive: false, cliVersion: 'x', fetchImpl })).resolves.toBeUndefined() | ||
| }) | ||
|
|
||
| it('an unconfirmed timeout does not throw either', async () => { | ||
| const fetchImpl = (async () => { | ||
| const e = new Error('aborted') | ||
| e.name = 'TimeoutError' | ||
| throw e | ||
| }) as unknown as typeof fetch | ||
| await expect(feedback({ ...valid, json: true }, { interactive: false, cliVersion: 'x', fetchImpl })).resolves.toBeUndefined() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: This test gives false confidence: it asserts only 'does not throw' and exitCode 0, but the PR's whole point is the JSON output status. After afterEach() resets process.exitCode to 0, the exitCode assertion is trivially true, so a regression that printed {status:'error'} (or the success shape) in the unconfirmed --json path would pass this test. Capture stdout and assert the printed JSON contains status 'unconfirmed' and the 'may have been recorded' message. Prompt for AI agents |
||
| expect(process.exitCode ?? 0).toBe(0) | ||
| }) | ||
| }) | ||
|
|
||
| describe('redact', () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: When headers arrive before 30s but the response body is still streaming,
res.json()throwsTimeoutErrorand the inner catch reportsreceived. Catch deadline expiry during body parsing and returnunconfirmedso the CLI does not claim a receipt when persistence is unknown.Prompt for AI agents