Record data set opens and executed queries in a local JSONL log#59
Merged
Conversation
Groundwork for the suggestion engine and query history: a new internal/events store appends one JSON line per event — data set opens and executed jq expressions with their compile outcome — to cq/events.jsonl. Appends are single O_APPEND writes, durable immediately and safe when several instances interleave; the log compacts to the newest 1000 events once it passes 2000 lines via a temp-file rename. Corrupt lines are skipped on read and every failure degrades to the diagnostic, so tracking can never disturb the TUI. Query events store the expression text as typed and nothing else. Closes #58 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CS2LZMn2YJdebAiry2jzdP
This was referenced Jul 19, 2026
A scanner error mid-file left read reporting ok with a truncated event slice; compaction would then rewrite events.jsonl from that slice and permanently drop the unread tail. A scan error now reports not-ok, so compact leaves the file untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CS2LZMn2YJdebAiry2jzdP
Member opens inside a PDS were invisible to the usage log even though they are the most specific thing the user reaches for; they now record as DSN(MEMBER). Submitting an invalid expression while a search was running left the old search mutating results behind the error banner; both compile-error paths now stop it first. The events package documents its multi-instance contract explicitly (append-safe; compaction can drop an event landing inside its read-then-rename window; per-instance counters can defer compaction until the next fresh start), countLines streams instead of loading the whole file, and recordOpen's comment states the navigation-not-outcome semantics. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CS2LZMn2YJdebAiry2jzdP
# Conflicts: # internal/compaz/query.go
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.
Closes #58. Stacked on #55 (shares
runQueryin query.go); retarget as the chain merges.New
internal/eventspackage following the favorites-store conventions (injectableUserConfigDir/Now,Diagnosticsink, tolerant load):cq/events.jsonl: one{"kind","time","name"/"query","outcome"}object per line. An event is oneO_APPENDwrite — durable immediately (no debounce window) and safe under interleaved appends from several instances.Hooks:
openSelectionrecords successful PS/PO opens only (migrated warnings and unsupported DSORGs record nothing);runQueryrecords the typed expression witherroron normalize/compile failure,okon a started run. Wired through a nil-ableDependencies.Eventsinterface;cmd/compazconstructs the default store.Verified with package tests (append format, ordering + corrupt-line tolerance, compaction window, silent degradation), compaz hook tests, and a demo-mode terminal run against an isolated
XDG_CONFIG_HOME— the resulting file:(that
erroris real — bare.CUST-IDis a jq syntax error; the quoted form comes from ctrl+space.)The
Events()reader returns the retained window oldest-first for the future suggestion engine and query-history consumers.🤖 Generated with Claude Code
https://claude.ai/code/session_01CS2LZMn2YJdebAiry2jzdP