[GH-ISSUE #6604] [Bug] SQLite application-collation failures label a healthy WITHOUT ROWID database malformed #3988

Closed
opened 2026-10-31 00:45:50 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @coygeek on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/6604

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

Selecting rows from a healthy WITHOUT ROWID table whose primary key uses an application collation returns invalid_request, path/invalid_format, and Selected SQLite database is invalid (no query solution). Recovery tells the caller to correct the input contract. The same file passes an integrity check with its collation registered, and REA reads its complete schema. Refusing rows when the collation is unavailable is reasonable; diagnosing a malformed database is the defect.

Reproduction

With the prepared source CLI and pinned Node available, create the synthetic fixture:

work_dir="$(mktemp -d)"
python3 - "$work_dir" <<'PY'
import sqlite3, sys
from pathlib import Path
db = sqlite3.connect(Path(sys.argv[1]) / 'custom-without-rowid.db')
db.create_collation('LOCALIZED', lambda a,b: (a>b)-(a<b))
db.execute('CREATE TABLE items(name TEXT COLLATE LOCALIZED PRIMARY KEY, value INTEGER) WITHOUT ROWID')
db.execute('INSERT INTO items VALUES (?,?)', ('alpha', 1))
db.commit()
print(db.execute('PRAGMA integrity_check').fetchall())
print(db.execute('SELECT name,value FROM items').fetchall())
db.close()
PY
node scripts/rea.mjs inspect-sqlite-database "$work_dir/custom-without-rowid.db" --table items --json

The producer prints [('ok',)] and [('alpha', 1)]. The CLI exits 1 with the error below. The executed self-contained probe also called the production application service: schema-only inspection succeeded, while both all-column selection and columns: ["value"] failed. Controls using a rowid table with the same collation and a WITHOUT ROWID table with built-in NOCASE returned the expected row. All source fixture digests remained unchanged.

Expected behavior

Return an accurately attributed provider/query limitation with the SQLite reason and selected table context. Explain that this connection lacks an application dependency and that schema-only inspection remains possible. Do not direct callers to repair a healthy path. No extension loading, invented replacement collation, or successful row result is requested. The worker's correction mapping explicitly intends to identify the argument requiring correction.

Impact and scope

P2: the demonstrated compatibility refusal has incorrect structured attribution and recovery. It reproduced in both production-service selections and the CLI. Schema-only inspection is a verified alternative for schema facts, but does not recover the requested rows. An application export may help; that recovery was not tested. Real-world frequency, other collations/platforms, and MCP transport remain untested. No source mutation or lost data was observed.

REA version

Package version 6.7.0; audited main source aee249b1ddb3e643b22ce049909160f0ce37a63e, with its prepared built CLI. Release 6.7.0 at 27dc42d10249f0410904a75c0997842eb03b931c retains the same generic-error-to-format classification chain by source inspection; the release package was not executed.

Runtime and platform

Node.js v24.22.1; Linux x86_64; built-in SQLite 3.53.4. Python 3.14.8 produced the fixtures. No external analysis provider.

Target and artifact context

Synthetic quiescent 8 KiB SQLite database with one ordinary WITHOUT ROWID table, one row, an application primary-key collation, and no generated columns or virtual tables.

Interface

CLI

Earliest failure stage

Transport or result projection

Relevant output or evidence

Observed CLI stdout subset; stderr was empty:

{"code":"invalid_request","category":"invalid_input","details":{"issues":[{"path":["path"],"reason":"invalid_format","message":"Selected SQLite database is invalid (no query solution): /artifacts/custom-without-rowid.db"}]},"recovery":{"kind":"inspect_input_contract","operation":"inspect_sqlite_database"}}

The production-service controls returned columns: ["name", "value"], text alpha, integer 1, and one row. On the failing file, schema-only inspection returned the stored declaration, both column definitions, and rows: null.

Typed outcome or recovery expected

A typed unavailable-capability/query refusal identifying the missing collation dependency, preserving schema-only recovery and distinguishing genuine malformed databases.

Analysis or suspected cause

Source-derived: selected-row error attribution only recognizes failing generated columns. This table has none, so SQLite error code 1 survives. The worker fallback maps it to format, which the parent attributes to the database path.

Additional context

Open/closed searches for sqlite collation, collation, no query solution, and WITHOUT ROWID found no matching report. Related closed #5719 concerns unavailable functions in generated columns; its current special handling does not cover this input. Open #6292 concerns result-column capacity, not a missing collation. No last-known-good version was established. Verification finished before this draft was written; the bug was not rerun afterward.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: The observed CLI and production service label a healthy, schema-readable database malformed and recommend correcting its input contract for an unavailable query dependency.
  • Workaround status: unverified
  • Workaround basis: Schema-only inspection succeeds but does not preserve the requested rows; obtaining a consistent application export with a supported schema was not tested.
Originally created by @coygeek on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6604 ## Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ## Area Evidence, artifacts, or reconstruction ## Observed behavior Selecting rows from a healthy `WITHOUT ROWID` table whose primary key uses an application collation returns `invalid_request`, `path`/`invalid_format`, and `Selected SQLite database is invalid (no query solution)`. Recovery tells the caller to correct the input contract. The same file passes an integrity check with its collation registered, and REA reads its complete schema. Refusing rows when the collation is unavailable is reasonable; diagnosing a malformed database is the defect. ## Reproduction With the prepared source CLI and pinned Node available, create the synthetic fixture: ```sh work_dir="$(mktemp -d)" python3 - "$work_dir" <<'PY' import sqlite3, sys from pathlib import Path db = sqlite3.connect(Path(sys.argv[1]) / 'custom-without-rowid.db') db.create_collation('LOCALIZED', lambda a,b: (a>b)-(a<b)) db.execute('CREATE TABLE items(name TEXT COLLATE LOCALIZED PRIMARY KEY, value INTEGER) WITHOUT ROWID') db.execute('INSERT INTO items VALUES (?,?)', ('alpha', 1)) db.commit() print(db.execute('PRAGMA integrity_check').fetchall()) print(db.execute('SELECT name,value FROM items').fetchall()) db.close() PY node scripts/rea.mjs inspect-sqlite-database "$work_dir/custom-without-rowid.db" --table items --json ``` The producer prints `[('ok',)]` and `[('alpha', 1)]`. The CLI exits 1 with the error below. The executed self-contained probe also called the production application service: schema-only inspection succeeded, while both all-column selection and `columns: ["value"]` failed. Controls using a rowid table with the same collation and a `WITHOUT ROWID` table with built-in `NOCASE` returned the expected row. All source fixture digests remained unchanged. ## Expected behavior Return an accurately attributed provider/query limitation with the SQLite reason and selected table context. Explain that this connection lacks an application dependency and that schema-only inspection remains possible. Do not direct callers to repair a healthy path. No extension loading, invented replacement collation, or successful row result is requested. The worker's correction mapping explicitly intends to identify the argument requiring correction. ## Impact and scope P2: the demonstrated compatibility refusal has incorrect structured attribution and recovery. It reproduced in both production-service selections and the CLI. Schema-only inspection is a verified alternative for schema facts, but does not recover the requested rows. An application export may help; that recovery was not tested. Real-world frequency, other collations/platforms, and MCP transport remain untested. No source mutation or lost data was observed. ## REA version Package version 6.7.0; audited main source `aee249b1ddb3e643b22ce049909160f0ce37a63e`, with its prepared built CLI. Release 6.7.0 at `27dc42d10249f0410904a75c0997842eb03b931c` retains the same generic-error-to-format classification chain by source inspection; the release package was not executed. ## Runtime and platform Node.js v24.22.1; Linux x86_64; built-in SQLite 3.53.4. Python 3.14.8 produced the fixtures. No external analysis provider. ## Target and artifact context Synthetic quiescent 8 KiB SQLite database with one ordinary `WITHOUT ROWID` table, one row, an application primary-key collation, and no generated columns or virtual tables. ## Interface CLI ## Earliest failure stage Transport or result projection ## Relevant output or evidence Observed CLI stdout subset; stderr was empty: ```json {"code":"invalid_request","category":"invalid_input","details":{"issues":[{"path":["path"],"reason":"invalid_format","message":"Selected SQLite database is invalid (no query solution): /artifacts/custom-without-rowid.db"}]},"recovery":{"kind":"inspect_input_contract","operation":"inspect_sqlite_database"}} ``` The production-service controls returned `columns: ["name", "value"]`, text `alpha`, integer `1`, and one row. On the failing file, schema-only inspection returned the stored declaration, both column definitions, and `rows: null`. ## Typed outcome or recovery expected A typed unavailable-capability/query refusal identifying the missing collation dependency, preserving schema-only recovery and distinguishing genuine malformed databases. ## Analysis or suspected cause Source-derived: [selected-row error attribution](https://github.com/morluto/rea/blob/aee249b1ddb3e643b22ce049909160f0ce37a63e/src/sqlite/SqliteDatabaseInspection.ts#L471) only recognizes failing generated columns. This table has none, so SQLite error code 1 survives. The [worker fallback](https://github.com/morluto/rea/blob/aee249b1ddb3e643b22ce049909160f0ce37a63e/src/sqlite/SqliteDatabaseWorker.ts#L33) maps it to `format`, which the parent attributes to the database path. ## Additional context Open/closed searches for `sqlite collation`, `collation`, `no query solution`, and `WITHOUT ROWID` found no matching report. Related closed #5719 concerns unavailable functions in generated columns; its current special handling does not cover this input. Open #6292 concerns result-column capacity, not a missing collation. No last-known-good version was established. Verification finished before this draft was written; the bug was not rerun afterward. ## Triage assessment - Impact level: P2 - Assessment status: supported - Impact basis: The observed CLI and production service label a healthy, schema-readable database malformed and recommend correcting its input contract for an unavailable query dependency. - Workaround status: unverified - Workaround basis: Schema-only inspection succeeds but does not preserve the requested rows; obtaining a consistent application export with a supported schema was not tested.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3988
No description provided.