Skip to content

fix: avoid empty autocomplete input panic - #189

Open
rupayon123 wants to merge 1 commit into
tursodatabase:mainfrom
rupayon123:fix/empty-autocomplete-input-20260928
Open

rupayon123 wants to merge 1 commit into
tursodatabase:mainfrom
rupayon123:fix/empty-autocomplete-input-20260928

Conversation

@rupayon123

Copy link
Copy Markdown

Description

Autocomplete on an empty prompt currently panics because SuggestCompletion indexes currentInput[len(currentInput)-1] before checking its length. Return no suggestions for empty input, which lets the shell remain at the prompt. A regression test reproduces the index-out-of-range panic before the change and passes afterward.

Validation: go test -p 1 ./... -count=1, go vet -p 1 ./..., go build -p 1 ./..., gofmt -l on changed files, and git diff --check pass locally with Go 1.27.1. The repository's Go 1.22.1 binary cannot run tests on this macOS host (dyld: missing LC_UUID load command), so CI should verify the pinned toolchain. The local tests did not exercise an external sqld server.

Related Issues

Visual reference

Not applicable to this CLI crash; the before/after evidence is the regression test.

AI assistance was used to investigate, implement, and test this change; I reviewed the diff and validation results.

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.

Autocomplete on empty input panics

1 participant