Skip to content

Fix spy leak and unsafe error cast from PR #32 review#33

Merged
devxoul merged 1 commit intomainfrom
fix/review-feedback-pr32
Mar 5, 2026
Merged

Fix spy leak and unsafe error cast from PR #32 review#33
devxoul merged 1 commit intomainfrom
fix/review-feedback-pr32

Conversation

@devxoul
Copy link
Owner

@devxoul devxoul commented Mar 5, 2026

Summary

Address review feedback from #32 (identified by cubic).

Changes

  • token-extractor.test.ts — Wrap copyFileSyncSpy.mockRestore() in a finally block so the global fs mock cannot leak when the assertion throws.
  • ensure-auth.ts — Use defensive type checks (typeof error === 'object', instanceof Error) in the catch block instead of bare casts, preventing a secondary throw on non-Error objects.

Summary by cubic

Fixes a leaking fs spy in tests and hardens ensureSlackAuth error handling to avoid secondary crashes. Improves test isolation and prevents noisy failures when non-Error values are thrown.

  • Bug Fixes
    • token-extractor.test.ts: Restore copyFileSync spy in a finally block to prevent fs mock leaks on assertion failure.
    • ensure-auth.ts: Use defensive checks for error.code and error.message; only rethrow on EBUSY or “locking the cookie”.

Written for commit 5ab1bbe. Summary will update on new commits.

Wrap copyFileSync spy restore in finally block so the mock cannot leak
when the assertion throws. Use defensive type checks in the catch block
to avoid throwing on non-Error objects.
@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
agent-messenger Ignored Ignored Mar 5, 2026 5:50am

Request Review

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@devxoul devxoul merged commit da84925 into main Mar 5, 2026
5 checks passed
@devxoul devxoul deleted the fix/review-feedback-pr32 branch March 5, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant