Repository navigation
fix(store): typed observation and belief reads; recall and contradict work on SQLite (1.10.0) - #142
Merged
Merged
Conversation
… work on SQLite (1.10.0) recall and contradict read observations and beliefs through the generic collection API. On SQLite and JSON that is a separate store from the typed tables observe/wonder/speculate/believe write, so recall always answered 0 and contradict always answered "not found" (#122, #123). Firestore keeps both in one collection, which is why it went unseen. The same read blinded predict, ruminate, the PE-saturation metric and four CLI reports. The store gets typed reads (getObservation, queryObservations, getBelief), following the signals precedent: SQLite and JSON fall back to rows written generically (old notice rows, Firestore-migrated belief revisions), and getBeliefHistory merges the latter. notice now writes the typed table. Generic range filters compared numbers only, so every date filter on SQLite/JSON matched nothing; they now compare timestamps. Closes #122 Closes #123 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On the SQLite and JSON stores,
recallalways answeredcount: 0(#122) andcontradictanswered "not found" for everyobservation_idfromobserve/wonder/speculateand everybelief_idfrombelieve(#123). Both tools read through the generic collection API (query/geton'observations'/'beliefs'), but those writers use the typed tables. On SQLite and JSON these are two separate places to store rows. Firestore keeps one collection per kind, so the split never showed there.The same generic read also left these unable to see any typed observation:
predict's recent context,ruminate's recent observations, the PE-saturation metric, and thehealth,report,anomaliesandvitalsCLI commands.A second bug sat underneath. The generic
query()range operators compared numbers only, so every date filter on SQLite/JSON (updated_at >= <Date>on threads, traces, …) matched nothing.What
getObservation(id),queryObservations({ since, until, content_type, processed, has_prediction_error, order, limit })andgetBelief(id). They follow the precedent signals already set, including the fallback: SQLite and JSON also return rows written generically, meaning oldernoticeobservations and Firestore-migrated belief revisions.getBeliefHistorymerges the legacy belief revisions too. A NULLcontent_typereads asdeclarative.noticewrites throughputObservation, which leaves one observations table. Noticed rows now enter consolidation on the local stores, as they already did on Firestore; the create phase embeds them.stores/_generic.ts).Verification
src/stores/typed-observation-reads.test.ts(16 tests, runs on both SQLite and JSON). Its four tool-level repros fail against master'srecall/contradict/noticeand pass with this change.tscclean, build clean.queryObservationsreturns all 3,226 rows (recallreturned 0 before).threadsdate filter returns 16 rows (0 before).Not in this PR
fozikio memory maintain --collection observationsstill reads and updates observations through the generic API, so it needs a typed update.vitalsstill queriesedgesgenerically. Both are filed separately.Closes #122
Closes #123
🤖 Generated with Claude Code