Skip to content

Commit ad28074

Browse files
Fix authentication type errors and REPL interference
- Change function signature to accept AbstractString instead of String - Explicitly convert readline() output to String to avoid SubString issues - Add better user guidance to avoid REPL code interpretation - Handle environment variable types more robustly - Add clearer error messages for input issues Fixes MethodError: no method matching test_github_authentication(::SubString{String}) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent cd112c6 commit ad28074

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/LinearSolveAutotune/src/telemetry.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Returns authentication object if successful, nothing if setup needed.
99
function setup_github_authentication()
1010
# Check if GITHUB_TOKEN environment variable exists
1111
if haskey(ENV, "GITHUB_TOKEN") && !isempty(ENV["GITHUB_TOKEN"])
12-
return test_github_authentication(ENV["GITHUB_TOKEN"])
12+
return test_github_authentication(String(ENV["GITHUB_TOKEN"]))
1313
end
1414

1515
# No environment variable - provide setup instructions and get token
@@ -32,17 +32,18 @@ function setup_github_authentication()
3232
println(" • Repository access: 'Public Repositories (read-only)'")
3333
println("4️⃣ Click 'Generate token' and copy it")
3434
println()
35-
println("🔑 Paste your GitHub token here:")
35+
println("🔑 Paste your GitHub token here (just the token, not as Julia code):")
3636
print("Token: ")
3737
flush(stdout)
3838

39-
# Get token input
39+
# Get token input with better REPL handling
4040
token = ""
4141
try
4242
sleep(0.1) # Small delay for I/O stability
43-
token = strip(readline())
43+
token = String(strip(readline())) # Convert to String explicitly
4444
catch e
4545
println("❌ Input error: $e")
46+
println("💡 Make sure to paste the token as a string, not Julia code")
4647
continue
4748
end
4849

@@ -84,12 +85,12 @@ function setup_github_authentication()
8485
end
8586

8687
"""
87-
test_github_authentication(token::String)
88+
test_github_authentication(token::AbstractString)
8889
8990
Test GitHub authentication with up to 3 attempts to handle connection warmup issues.
9091
Returns authentication object if successful, nothing otherwise.
9192
"""
92-
function test_github_authentication(token::String)
93+
function test_github_authentication(token::AbstractString)
9394
max_auth_attempts = 3
9495

9596
println("🔍 Testing GitHub authentication...")

0 commit comments

Comments
 (0)