C3 — InputQuery has never been handed a cursor row by any test #137

Closed
opened 2026-08-27 03:06:42 +00:00 by JMR-dev · 0 comments
JMR-dev commented 2026-08-27 03:06:42 +00:00 (Migrated from github.com)

Child 3 of 7 decomposing #132 — item 3 there. Depends on C0 (#134) (the FakeSafProvider misbehaviour knob).

Why this exists

app/src/main/java/org/libremediaconverter/convert/InputQuery.kt:88-108

Every line that reads a real cursor row is cold: firstRow's body (:90), displayNameOrNull
(:104-105), sizeOrNull (:107-108).

UnknownInputSizeTest is the sibling for this file but not for this path — its own comments say
so:

No provider is registered for this authority, so the metadata query returns null and
openFileDescriptor throws FileNotFoundException.

So the suite has driven the no-provider case and the measure(...) fallback thoroughly, and has
never handed InputQuery a row
. What that leaves untested:

  • display name resolution, and the FALLBACK_DISPLAY_NAME when the column is absent or null
  • size from OpenableColumns.SIZE
  • both isNull guards
  • the missing-column guard (getColumnIndex returning -1)
  • the negative-size rejection at :108 — statSize-style -1, which InputQuery:97-98
    documents as "a pipe, or a provider streaming its answer", and which must fall through to
    measure(...) rather than be reported as a size

That last one carries the most weight. InputQuery exists to end the conflation of zero with
unknown — hasSpaceFor(0) is only "is there 128 MB free" — and :108 is one of the two places
that distinction is actually enforced.

Scope

A new InputQueryCursorTest in org.libremediaconverter.convert, driving C0 (#134)'s provider states
through InputQuery.describe(...) and InputQuery.sizeOf(...).

Done means

A row with a name and a size · a row whose columns are absent · a row whose SIZE is null · a row
whose SIZE is negative, falling through to measure · a cursor with no rows. Each asserted on the
InputFile that comes back, not on the cursor.

Mutation: drop .takeIf { it >= 0 } from :108 and the negative-size test must go red — and it
must go red on the size, not on a display name that happens to differ.

_Child 3 of 7 decomposing #132 — item 3 there. **Depends on C0 (#134)** (the `FakeSafProvider` misbehaviour knob)._ ### Why this exists ``` app/src/main/java/org/libremediaconverter/convert/InputQuery.kt:88-108 ``` Every line that reads a real cursor row is cold: `firstRow`'s body (`:90`), `displayNameOrNull` (`:104-105`), `sizeOrNull` (`:107-108`). `UnknownInputSizeTest` is the sibling for this *file* but not for this *path* — its own comments say so: > No provider is registered for this authority, so the metadata query returns null and > `openFileDescriptor` throws `FileNotFoundException`. So the suite has driven the no-provider case and the `measure(...)` fallback thoroughly, and **has never handed `InputQuery` a row**. What that leaves untested: - display name resolution, and the `FALLBACK_DISPLAY_NAME` when the column is absent or null - size from `OpenableColumns.SIZE` - both `isNull` guards - the missing-column guard (`getColumnIndex` returning `-1`) - **the negative-size rejection at `:108`** — `statSize`-style `-1`, which `InputQuery:97-98` documents as "a pipe, or a provider streaming its answer", and which must fall through to `measure(...)` rather than be reported as a size That last one carries the most weight. `InputQuery` exists to end the conflation of *zero* with *unknown* — `hasSpaceFor(0)` is only "is there 128 MB free" — and `:108` is one of the two places that distinction is actually enforced. ### Scope A new `InputQueryCursorTest` in `org.libremediaconverter.convert`, driving C0 (#134)'s provider states through `InputQuery.describe(...)` and `InputQuery.sizeOf(...)`. ### Done means A row with a name and a size · a row whose columns are absent · a row whose `SIZE` is null · a row whose `SIZE` is negative, falling through to `measure` · a cursor with no rows. Each asserted on the `InputFile` that comes back, not on the cursor. **Mutation:** drop `.takeIf { it >= 0 }` from `:108` and the negative-size test must go red — and it must go red on the *size*, not on a display name that happens to differ.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JMR-dev/LibreMediaConverter#137