feat(db): persist r_compression and c_norm on distillations (schema v12)#116
Merged
feat(db): persist r_compression and c_norm on distillations (schema v12)#116
Conversation
Store context health metrics directly in the distillations table so they can be queried retroactively without LORE_DEBUG=1 log parsing. - Migration v12: adds nullable r_compression REAL and c_norm REAL columns - storeDistillation() accepts and persists both metrics - distillSegment() computes metrics before storing (moved from post-store) - loadForSession() and loadGen0() return the new fields - Distillation type updated with nullable r_compression and c_norm - Tests verify NULL for legacy rows, correct values for new rows - opencode test helper restoreDistillationTables() updated for schema parity 586 tests pass, 0 fail. Build clean across all 3 packages.
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.
Summary
Persist
r_compressionandc_normcontext health metrics directly in thedistillationstable, replacing theLORE_DEBUG=1-gated log lines that were invisible by default.Why
The diagnostic logging added in #113 used
log.info()which is suppressed unlessLORE_DEBUG=1— making the diagnostics effectively invisible in normal operation. Storing metrics in the DB makes them queryable retroactively without env vars or log parsing.Changes
REALcolumns (r_compression,c_norm) ondistillationsrCompressionandcNormparams, writes to new columnsstoreDistillation()(was after), passes them inr_compression: number | nullandc_norm: number | nullrestoreDistillationTables()updated for schema parityVerification
ALTER TABLE ADD COLUMNstatements (idempotent for new DBs, safe for existing)