mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 16:14:31 +00:00
fix(hooks): add network errors to noRetryPatterns, update E2E test
- Add ENOTFOUND, ENETUNREACH, EAI_AGAIN to noRetryPatterns to prevent infinite retries on network errors - Update E2E test to expect exit code 2 (block) when CLIProxy unavailable - Fix debug message expectation in test
This commit is contained in:
1 parent
51b719ef34
commit
1201b4bb4b
2 files changed
+15
-7
No files matched your search
@@ -468,7 +468,7 @@ describe('Image Analyzer Hook', () => {
|
||||
resetMockState();
|
||||
});
|
||||
|
||||
it('should pass through when CLIProxy is unavailable', async () => {
|
||||
it('should block when CLIProxy is unavailable to prevent context overflow', async () => {
|
||||
// Force hook to use a port that's definitely not running
|
||||
const result = invokeHook(
|
||||
{
|
||||
@@ -483,9 +483,13 @@ describe('Image Analyzer Hook', () => {
|
||||
}
|
||||
);
|
||||
|
||||
// Should pass through (exit 0) when CLIProxy not available
|
||||
expect(result.code).toBe(0);
|
||||
expect(result.stderr).toContain('CLIProxy not available');
|
||||
// Should block (exit 2) when CLIProxy not available to prevent context overflow
|
||||
expect(result.code).toBe(2);
|
||||
const output = JSON.parse(result.stdout);
|
||||
expect(output.decision).toBe('block');
|
||||
expect(output.hookSpecificOutput.permissionDecisionReason).toContain(
|
||||
'CLIProxy unavailable'
|
||||
);
|
||||
});
|
||||
|
||||
it('should analyze PNG via mock CLIProxy and return analysis', () => {
|
||||
@@ -634,7 +638,7 @@ describe('Image Analyzer Hook', () => {
|
||||
|
||||
// Should output debug info to stderr
|
||||
expect(result.stderr).toContain('[CCS Hook]');
|
||||
expect(result.stderr).toContain('Analyzing');
|
||||
expect(result.stderr).toContain('Starting image analysis');
|
||||
});
|
||||
|
||||
it('should handle API error response gracefully (pass through)', () => {
|
||||
|
||||
Reference in new issue
Block a user