Skip to content

fix: compare v:shell_error to number 0 instead of string '0' for enterprise version fetch#518

Open
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774984741-fix-shell-error-comparison
Open

fix: compare v:shell_error to number 0 instead of string '0' for enterprise version fetch#518
staging-devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774984741-fix-shell-error-comparison

Conversation

@staging-devin-ai-integration
Copy link
Copy Markdown

Summary

Fixes a type comparison bug in the enterprise version fetching logic in autoload/codeium/server.vim.

In commit 9ff8d32, the condition if v:shell_error (which was inverted — entering the success branch on failure) was changed to if v:shell_error == '0'. While this fixed the logic direction, it compares against the string '0' instead of the number 0.

v:shell_error is a Vim Number type. Every other v:shell_error check in this file (lines 42, 54, 66) and across the codebase correctly compares to the number 0. This fix aligns the enterprise version fetch condition with the rest of the codebase.

Review & Testing Checklist for Human

  • Verify that enterprise customers with a portal_url configured (not matching .windsurf.com or dstart.com) can still fetch the version from their portal's /api/version endpoint

Notes

While Vim's legacy script type coercion means 0 == '0' evaluates to true (so this likely worked in practice), the string comparison is inconsistent and could cause issues in Vim9 script or confuse future contributors.

Link to Devin session: https://localhost:3000/sessions/d2808c12089f43bba7d6f5cbad1fd923
Requested by: @Mokshit06

In commit 9ff8d32, the enterprise version fetch condition was changed
from 'if v:shell_error' to 'if v:shell_error == "0"', comparing
against a string instead of a number. While Vim's type coercion makes
this work in legacy script, it's inconsistent with every other
v:shell_error check in the codebase (lines 42, 54, 66) which all
compare to the number 0. Fix by using the correct numeric comparison.

Co-Authored-By: Staging-Devin AI <166158716+staging-devin-ai-integration[bot]@users.noreply.github.com>
@staging-devin-ai-integration
Copy link
Copy Markdown
Author

Original prompt from Mokshit

fix

Context: A potential bug was found in Exafunction/windsurf.vim (commit 9ff8d32): Heads up - I found a logic error in the version fetching for enterprise customers. In commit 9ff8d32, the condition for using the fetched version is inverted - it's setting the version when v:shell_error equals 0 (success) but the code structure suggests it should only set the version on success, not failure.

@staging-devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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