Fix: read instances with null projection for provider-version robustness
All checks were successful
CI / ci (push) Successful in 5m16s

On-device smoke test (tasks.org, which bundles an older OpenTasks provider)
hit SQLITE_ERROR 'no such column: is_recurring' — that column and
distance_from_current don't exist in every provider version. Query all
columns (projection=null) and let the by-name mapper read what's present
(absent -> null); the repository re-sorts, so no provider sort column is
needed either. Verified live: reads the real tasks.org/DAVx5 provider
(1 list, 0 open tasks) with zero errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Luc Makiola
2026-06-17 22:04:00 +02:00
parent bfcfc50cf4
commit 529a596d17

View File

@@ -71,7 +71,12 @@ class AndroidTasksDataSource @Inject constructor(
private fun queryInstances(selection: String?, args: Array<String>?): List<Task> { private fun queryInstances(selection: String?, args: Array<String>?): List<Task> {
val uri = TasksContract.instancesUri(authority()) val uri = TasksContract.instancesUri(authority())
return resolver.query(uri, TaskProjections.INSTANCES, selection, args, Instances.INSTANCE_DUE_SORTING) // projection = null (all columns): the instances view differs across
// provider versions (e.g. tasks.org's bundled OpenTasks has no
// `is_recurring` / `distance_from_current`). The by-name mapper reads
// whatever is present and nulls the rest; the repository re-sorts, so we
// don't depend on a provider sort column either.
return resolver.query(uri, null, selection, args, null)
?.use { c -> ?.use { c ->
val reader = CursorColumnReader(c) val reader = CursorColumnReader(c)
buildList { while (c.moveToNext()) add(TaskMapper.task(reader)) } buildList { while (c.moveToNext()) add(TaskMapper.task(reader)) }