chore: checkpoint uncommitted work before session store fix

Pre-existing work-in-progress in the tree: karakeep, snippets,
skills-health and redaction ingesters, the opencode.db session sweep,
gossip and metrics changes. Checkpointed as-is so the adapter fix in the
next commit stays reviewable on its own.
This commit is contained in:
2026-11-01 13:33:36 -08:00
parent bb852faa27
commit 0b8ac34aee
43 changed files with 6771 additions and 419 deletions
+9 -5
View File
@@ -27,6 +27,8 @@ type GossipObservation struct {
IngesterVersion string
Trigger string
Provenance string
ContentHash string `json:"content_hash,omitempty"`
Content string `json:"content,omitempty"`
}
// PushObservations inserts gossip rows idempotently. Rows whose (node_id, hcl)
@@ -58,11 +60,11 @@ func (k *KnoxDB) PushObservations(rows []GossipObservation) (int, error) {
`INSERT OR IGNORE INTO observations
(fingerprint, source_id, source_path, project, content_type, title, summary,
collected_at, created_at, line_start, line_end, confidence, ingester_version, trigger, provenance,
node_id, hcl)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
content_hash, content, node_id, hcl)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
o.Fingerprint, o.SourceID, o.SourcePath, o.Project, o.ContentType, o.Title, o.Summary,
o.CollectedAt, o.CreatedAt, o.LineStart, o.LineEnd, o.Confidence, o.IngesterVersion, o.Trigger, o.Provenance,
o.NodeID, o.HCL,
o.ContentHash, o.Content, o.NodeID, o.HCL,
)
if err != nil {
return inserted, fmt.Errorf("push observation: %w", err)
@@ -84,7 +86,8 @@ func (k *KnoxDB) ObservationsAfter(nodeID string, after int64, limit int) ([]Gos
COALESCE(content_type,''), COALESCE(title,''), COALESCE(summary,''),
COALESCE(collected_at,''), COALESCE(created_at,''),
COALESCE(line_start,0), COALESCE(line_end,0), COALESCE(confidence,0.5),
COALESCE(ingester_version,''), COALESCE(trigger,''), COALESCE(provenance,'{}')
COALESCE(ingester_version,''), COALESCE(trigger,''), COALESCE(provenance,'{}'),
COALESCE(content_hash,''), COALESCE(content,'')
FROM observations WHERE node_id=?`
args := []any{nodeID}
if after > 0 {
@@ -105,7 +108,8 @@ func (k *KnoxDB) ObservationsAfter(nodeID string, after int64, limit int) ([]Gos
var o GossipObservation
if err := rows.Scan(&o.NodeID, &o.HCL, &o.Fingerprint, &o.SourceID, &o.SourcePath,
&o.Project, &o.ContentType, &o.Title, &o.Summary, &o.CollectedAt, &o.CreatedAt,
&o.LineStart, &o.LineEnd, &o.Confidence, &o.IngesterVersion, &o.Trigger, &o.Provenance); err != nil {
&o.LineStart, &o.LineEnd, &o.Confidence, &o.IngesterVersion, &o.Trigger, &o.Provenance,
&o.ContentHash, &o.Content); err != nil {
return nil, err
}
out = append(out, o)