git.iko.soy/parseable-macos
on master help sign in
Fix 2 bugs: phantom retention policy, dangling autocomplete quote
commit895b35744989a51f127c9a5bf6a5e7b97bff8263 authoriko <mail@iko.soy> dateSun 21 Jun 2026, 14:01 (3 months ago) parente7a0ef6
2 files changed+15−9
ParseableViewer/Services/ParseableClient.swift+6 ParseableViewer/Views/SQLEditorView.swift+9−9
ParseableViewer/Services/ParseableClient.swift+6
@@ -394,6 +394,12 @@ final class ParseableClient: Sendable {
394394 }
395395 do {
396396 let single = try Self.jsonDecoder.decode(RetentionConfig.self, from: data)
397+ // RetentionConfig decodes every field with `try?`, so any JSON object
398+ // (including `{}` or an error body) decodes to an all-nil config. Treat
399+ // an empty config as "no retention" rather than a phantom policy entry.
400+ guard single.description != nil || single.duration != nil || single.action != nil else {
401+ return []
402+ }
397403 return [single]
398404 } catch {
399405 throw ParseableError.decodingError("Unexpected retention response format")
ParseableViewer/Views/SQLEditorView.swift+9−9
@@ -223,15 +223,15 @@ struct SQLEditorView: NSViewRepresentable {
223223 }
224224 }
225225
226− // A table completion carries its own quotes; absorb a directly
227− // preceding opening quote the user typed (e.g. `FROM "my`) so the
228− // inserted `"name"` replaces it instead of producing `""name"`.
229− if item.kind == .table, wordStart > 0,
230− nsText.character(at: wordStart - 1) == 0x22 {
231− wordStart -= 1
232− // Mirror on the trailing side: if a matching closing quote follows
233− // the word (caret inside an already-quoted `FROM "my|"`), absorb it
234− // too so the inserted `"name"` doesn't leave a dangling `"name""`.
226+ // A table completion carries its own quotes; absorb any double-quote the
227+ // user typed directly around the word so the inserted `"name"` replaces
228+ // it instead of leaving a stray quote. Leading and trailing are handled
229+ // independently: a closing quote can exist without an opening one (e.g.
230+ // `FROM my"`), which would otherwise produce a dangling `"name""`.
231+ if item.kind == .table {
232+ if wordStart > 0, nsText.character(at: wordStart - 1) == 0x22 {
233+ wordStart -= 1
234+ }
235235 if wordEnd < nsText.length, nsText.character(at: wordEnd) == 0x22 {
236236 wordEnd += 1
237237 }