[GH-ISSUE #2614] fix(sqlite): distinguish missing database paths from malformed content #928

Closed
opened 2026-10-15 18:29:40 +00:00 by bsakaguchi · 0 comments
Owner

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

Summary

Selecting a database path that does not exist returns the structured input reason invalid_format. The message accurately states that the file is absent, but the reason conflates absence with malformed content. The same adapter already classifies native missing-file errors as invalid_value.

Steps to reproduce

  1. On the stated source baseline, choose an absolute path to absent.db in an existing disposable directory and leave the file uncreated.
  2. Instantiate SqliteDatabaseProvider with its default launcher and call inspect({path: databasePath}).
  3. Project the returned error with projectAnalysisError and inspect details.issues[0].
  4. Repeat with absent.db under an uncreated parent directory, then close the provider.

Both absence cases were executed in a focused source test. They fail before worker execution, so no launcher substitution is required.

Expected behavior

An absent selected path should retain a structured invalid-value classification and a message stating that the database does not exist. A file rejected because its content is malformed should retain its format classification. Callers should be able to distinguish these conditions without interpreting message text.

Actual behavior

Both missing-file requests returned an issue on ["path"] with reason invalid_format and the message Selected SQLite database does not exist: <selected absolute path>. A direct control passed an ENOENT error to the same adapter's artifact-read failure mapper and received invalid_value. Another direct control passed a format-specific artifact-reader failure and received invalid_format.

The controls establish mapper behavior. They do not claim execution of a malformed-file inspection through the worker or an automated client's remediation branch.

Evidence

  • Expected source: AGENTS.md, Architecture and Cleanup, requires meaningful failure reasons across boundaries; src/sqlite/SqliteDatabaseFailures.ts:88-93 specifically assigns invalid_value to missing or unreadable paths indicated by ENOENT or ENOTDIR; src/domain/analysisErrorCore.ts:69-79 exposes distinct correction reasons to callers.
  • Failure source: src/sqlite/SqliteDatabaseSnapshot.ts:177-190 converts absent-file state to an artifact-reader path failure; src/sqlite/SqliteDatabaseFailures.ts:69-73 projects that path failure as invalid_format. A focused provider test observed this result for a missing file and missing parent directory.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Restoration check

Repeat both missing-path requests. Each should identify ["path"] with invalid_value and continue to explain that the selected database is absent. Retain invalid_format for actual malformed SQLite content and preserve the existing native-ENOENT classification. Those controls prevent replacing every input reason with a single value.

Runtime or environment

Source baseline 8b181716ac; Node.js v26.10.0, npm 11.19.1, Vitest 5.0.3. Focused source test with normal filesystem reads and the default provider.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: A missing selected database is assigned the same machine-readable reason as a content-format failure, despite a distinct classification already available in the adapter. Clients using the reason can choose an inappropriate correction. No successful inspection result is affected.
  • Workaround status: available
  • Workaround basis: The observed message explicitly states that the selected database does not exist, so the caller can correct the path based on that message.
Originally created by @coygeek on GitHub (Oct 13, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2614 ## Summary Selecting a database path that does not exist returns the structured input reason `invalid_format`. The message accurately states that the file is absent, but the reason conflates absence with malformed content. The same adapter already classifies native missing-file errors as `invalid_value`. ## Steps to reproduce 1. On the stated source baseline, choose an absolute path to `absent.db` in an existing disposable directory and leave the file uncreated. 2. Instantiate `SqliteDatabaseProvider` with its default launcher and call `inspect({path: databasePath})`. 3. Project the returned error with `projectAnalysisError` and inspect `details.issues[0]`. 4. Repeat with `absent.db` under an uncreated parent directory, then close the provider. Both absence cases were executed in a focused source test. They fail before worker execution, so no launcher substitution is required. ## Expected behavior An absent selected path should retain a structured invalid-value classification and a message stating that the database does not exist. A file rejected because its content is malformed should retain its format classification. Callers should be able to distinguish these conditions without interpreting message text. ## Actual behavior Both missing-file requests returned an issue on `["path"]` with reason `invalid_format` and the message `Selected SQLite database does not exist: <selected absolute path>`. A direct control passed an `ENOENT` error to the same adapter's artifact-read failure mapper and received `invalid_value`. Another direct control passed a format-specific artifact-reader failure and received `invalid_format`. The controls establish mapper behavior. They do not claim execution of a malformed-file inspection through the worker or an automated client's remediation branch. ## Evidence - Expected source: `AGENTS.md`, Architecture and Cleanup, requires meaningful failure reasons across boundaries; `src/sqlite/SqliteDatabaseFailures.ts:88-93` specifically assigns `invalid_value` to missing or unreadable paths indicated by ENOENT or ENOTDIR; `src/domain/analysisErrorCore.ts:69-79` exposes distinct correction reasons to callers. - Failure source: `src/sqlite/SqliteDatabaseSnapshot.ts:177-190` converts absent-file state to an artifact-reader path failure; `src/sqlite/SqliteDatabaseFailures.ts:69-73` projects that path failure as `invalid_format`. A focused provider test observed this result for a missing file and missing parent directory. - Evidence provenance: observed - Local verification: reproduced - Reproduction completeness: complete ## Restoration check Repeat both missing-path requests. Each should identify `["path"]` with `invalid_value` and continue to explain that the selected database is absent. Retain `invalid_format` for actual malformed SQLite content and preserve the existing native-ENOENT classification. Those controls prevent replacing every input reason with a single value. ## Runtime or environment Source baseline 8b181716aca2cb467be499cba226abfb5ae19141; Node.js v26.10.0, npm 11.19.1, Vitest 5.0.3. Focused source test with normal filesystem reads and the default provider. ## Triage assessment - Impact level: P2 - Assessment status: supported - Impact basis: A missing selected database is assigned the same machine-readable reason as a content-format failure, despite a distinct classification already available in the adapter. Clients using the reason can choose an inappropriate correction. No successful inspection result is affected. - Workaround status: available - Workaround basis: The observed message explicitly states that the selected database does not exist, so the caller can correct the path based on that message.
bsakaguchi 2026-10-15 18:29:40 +00:00
  • closed this issue
  • added the
    bug
    label
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#928
No description provided.