Skip to content

test: 🧪 Add CredentialsResetCommand unit tests#219

Merged
Hardonian merged 2 commits into
mainfrom
test-add-credentials-reset-command-unit-tests-10927024497053695683
May 31, 2026
Merged

test: 🧪 Add CredentialsResetCommand unit tests#219
Hardonian merged 2 commits into
mainfrom
test-add-credentials-reset-command-unit-tests-10927024497053695683

Conversation

@Hardonian

Copy link
Copy Markdown
Owner

🎯 What: Added comprehensive unit tests for CredentialsResetCommand and refactored the credential reset logic into a dedicated, testable module (src/cli/commands/credentials/reset.ts).

📊 Coverage: The new tests cover missing/invalid arguments, bridge provider edge cases, confirmation prompt workflows (accepted and declined), the --yes flag bypass, and error handling for gateway removal failures (including environment variable hints).

Result: Improved test coverage and reliability of the credentials reset command by decoupling the OCLIF interface from the internal gateway execution details.

Signed-off-by: Jules jules@example.com


PR created automatically by Jules for task 10927024497053695683 started by @Hardonian

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@kilo-code-bot

kilo-code-bot Bot commented May 29, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The changes look good. The refactoring extracts resetProviderCredentials into a dedicated module for better testability, and the new unit tests cover the key scenarios including validation, user prompts, --yes flag, and error handling.

Files Reviewed (3 files)
  • src/cli/commands/credentials/reset.ts - New testable module for credential reset logic
  • src/lib/commands/credentials/reset.test.ts - Comprehensive unit tests for CredentialsResetCommand
  • src/lib/commands/credentials/reset.ts - Refactored to use the extracted function

@kilo-code-bot

kilo-code-bot Bot commented May 29, 2026

Copy link
Copy Markdown

Code Review Summary

Status: Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 1
Issue Details (click to expand)

CRITICAL

File Line Issue
src/cli/commands/credentials/reset.ts 1 Architecture violation: New CLI command module is in src/cli/commands/ but AGENTS.md Section 69 states CLI behavior should be under src/lib/. This creates a cross-project boundary in a known fragile area (TypeScript/CJS seams). The file should be in src/lib/commands/credentials/reset.ts to follow the established contract.
Other Observations (not in diff)

The src/cli/commands/credentials/reset.ts file appears to be a utility module extracted for testability, not a CLI entry point. If this is intentional: (1) it should be renamed to avoid misleading developers about its purpose, and (2) it should live in src/lib/commands/credentials/ per the architecture contract. The current location violates the canonical boundary that "runtime truth in TypeScript sources" should be under src/lib/ for CLI behavior.

Files Reviewed (3 files)
  • src/cli/commands/credentials/reset.ts - New module for credential reset logic
  • src/lib/commands/credentials/reset.test.ts - Comprehensive unit tests for CredentialsResetCommand
  • src/lib/commands/credentials/reset.ts - Refactored command to use extracted function

@kilo-code-bot kilo-code-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Architecture concern: The new resetProviderCredentials function in src/cli/commands/credentials/reset.ts creates a reverse dependency. The src/lib/commands/credentials/reset.ts command now imports from src/cli/commands/credentials/reset.ts, which violates the established contract where src/lib/ is the canonical location for CLI runtime logic (per AGENTS.md Section 69).

Comment thread src/cli/commands/credentials/reset.ts
@kilo-code-bot

kilo-code-bot Bot commented May 29, 2026

Copy link
Copy Markdown

Code Review Summary

Status: Issues Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 1
Issue Details (click to expand)

WARNING

File Line Issue
src/cli/commands/credentials/reset.ts 1 Architecture concern: This utility function creates a reverse dependency. The src/lib/commands/credentials/reset.ts command imports from this file, but src/lib/ is the canonical location for CLI runtime truth per AGENTS.md Section 69. Consider moving this to src/lib/commands/credentials/reset-utils.ts or adding it to the existing common.ts.
Other Observations

The functionality and test coverage look good. The refactoring improves testability by extracting resetProviderCredentials. The only concern is the placement - while this works, it creates an unusual dependency direction where src/lib/ depends on src/cli/. The codebase convention (established in AGENTS.md and evidenced by src/commands/credentials/reset.ts which is just a thin wrapper that imports from src/lib/commands/credentials/reset.ts) suggests utility functions should live in src/lib/.

Files Reviewed (3 files)
  • src/cli/commands/credentials/reset.ts - New module for credential reset logic (architectural issue)
  • src/lib/commands/credentials/reset.test.ts - Comprehensive unit tests for CredentialsResetCommand
  • src/lib/commands/credentials/reset.ts - Refactored command to use extracted function

Reviewed by laguna-m.1-20260312:free · 7,019,890 tokens

@Hardonian
Hardonian merged commit 931d67e into main May 31, 2026
5 of 10 checks passed
@Hardonian
Hardonian deleted the test-add-credentials-reset-command-unit-tests-10927024497053695683 branch May 31, 2026 15:29
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