Skip to content

Report unreadable session topics as a database error - #175

Draft
MoonCaves wants to merge 3 commits into
mainfrom
fix/topics-session-query-errors
Draft

MoonCaves wants to merge 3 commits into
mainfrom
fix/topics-session-query-errors

Conversation

@MoonCaves

Copy link
Copy Markdown
Owner

A session can resolve successfully while its topic rows are unreadable. Previously, a failure to prepare that query made rawclaw topics --session <id> print “no topics tagged” and exit successfully. The command now returns the underlying SQLite error. Projects that have never created the optional topic table still get the ordinary empty result.

The store compares the exact missing-table diagnostic from the pinned driver. This preserves errors for a missing column, a closed database, and a view whose missing backing table has a similar name. The query, session resolution, ordering, and lookup fallback are unchanged.

Verification

  • The committed store test covers an absent optional table, a broken view, and a closed database.
  • An independent test exercised the registered CLI command against SQLite. Main returned a successful empty result for both a missing column and a broken view. The same calls on this revision returned their respective errors. A normal session retained both tags in insertion order, and an absent optional table still returned success.
  • Pure-Go build, vet, lint, and the store race suite passed locally.

Related to #103. The lookup-miss indexing work remains open.

SQLite reports unrelated SQL and view-resolution failures under the same
generic error code. Match the exact diagnostic from the pinned driver.
Return the original error to the caller on all other query failures.

The missing-table, broken-view and closed-database checks exercise the
store API. Ordered results are covered by existing session topic tests.

Prior-Art: grafana/grafana pkg/services/sqlstore/migrator/sqlite_dialect.go L167-L173 (AGPL-3.0) @71ceb636f6405679f02c5f57c7fe222c801cad3b -> internal/store/topics.go
Prior-Art: modernc-org/sqlite conn.go L626-L640 (BSD-3-Clause) @b8975b7dcf269f7c09929073c1feb64701066f41 -> internal/store/topics.go
Prior-Art: sqlite/sqlite src/build.c L457-L467 (public domain) @c2aa8e3875907d84540af7624534e326b26b82ee -> internal/store/topics.go
Prior-Art: sqlite/sqlite test/view.test L83-L99 (public domain) @c2aa8e3875907d84540af7624534e326b26b82ee -> internal/store/topics_test.go
Prior-Art: MoonCaves/rawclaw internal/store/topics_test.go L192-L203 (MIT) @2e391b6af9901fb2e260a7552f05b68621437719 -> internal/store/topics_test.go
Prior-Art: MoonCaves/rawclaw internal/store/topics_test.go L247-L259 (MIT) @2e391b6af9901fb2e260a7552f05b68621437719 -> internal/store/topics_test.go
Prior-Art: MoonCaves/rawclaw internal/store/topics.go L138-L155 (MIT) @2e391b6af9901fb2e260a7552f05b68621437719 -> internal/store/topics.go
Prior-Art: MoonCaves/rawclaw internal/store/verdict.go L135-L152 (MIT) @2e391b6af9901fb2e260a7552f05b68621437719 -> internal/store/topics.go
Prior-Art: autobrr/netronome internal/database/user.go L199-L202 (GPL-2.0-or-later) @200757072afce58ca0e0442984cff6860fa4360d -> internal/store/topics.go

Prior-Art: autobrr/netronome internal/database/user.go L34-L38 (GPL-2.0-or-later) @200757072afce58ca0e0442984cff6860fa4360d -> internal/store/topics.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant