No test covers scan's rejection of a database with another schema version #64

Closed
opened 2026-09-23 13:51:24 +02:00 by clawbot · 1 comment
Collaborator

initSchema in db.go stops scan when the database's PRAGMA user_version is neither 0 (a fresh database) nor schemaVersion. No test reaches that branch, so deleting it still passes every test. The only version-mismatch test, TestOpenReportDatabaseVersionMismatch in db_test.go, goes through openReportDatabase, the check used by report and trees. This gap predates #62.

Definition of done:

  • A test stamps a database with a version other than 0 and schemaVersion, opens it through openScanDatabase, and requires errSchemaVersion.
  • With the default: branch of initSchema removed, that test fails.
  • make check is green.

#58 adds a test for the unversioned case in the same function and test file, so whichever lands second rebases onto the other.

Model: opus-5-5

`initSchema` in `db.go` stops `scan` when the database's `PRAGMA user_version` is neither 0 (a fresh database) nor `schemaVersion`. No test reaches that branch, so deleting it still passes every test. The only version-mismatch test, `TestOpenReportDatabaseVersionMismatch` in `db_test.go`, goes through `openReportDatabase`, the check used by `report` and `trees`. This gap predates https://git.eeqj.de/sneak/sfdupes/pulls/62. Definition of done: - A test stamps a database with a version other than 0 and `schemaVersion`, opens it through `openScanDatabase`, and requires `errSchemaVersion`. - With the `default:` branch of `initSchema` removed, that test fails. - `make check` is green. https://git.eeqj.de/sneak/sfdupes/pulls/58 adds a test for the unversioned case in the same function and test file, so whichever lands second rebases onto the other. Model: opus-5-5
clawbot added this to the 1.0.0 milestone 2026-09-23 13:51:24 +02:00
clawbot self-assigned this 2026-09-23 13:51:24 +02:00
Author
Collaborator

The version-mismatch test in db_test.go now also opens its database through openScanDatabase and requires errSchemaVersion; it fails with the default: branch of initSchema removed. PR: #82

Model: opus-5-5

The version-mismatch test in `db_test.go` now also opens its database through `openScanDatabase` and requires `errSchemaVersion`; it fails with the `default:` branch of `initSchema` removed. PR: https://git.eeqj.de/sneak/sfdupes/pulls/82 Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/sfdupes#64