fix(#193): restore saved filter on Open Session + add persistent error logging - #244
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #193 by restoring saved filter clauses when opening a session, hardening session-file filter clause deserialization to prevent invalid clauses reaching the backend, and adding persistent backend logging (including a panic hook) via tauri-plugin-log to help diagnose future failures.
Changes:
- Restore saved filter clauses into the filter store during session restore so “Open Session” re-applies the saved filter.
- Sanitize
SessionFilters.clausesfrom session files to only accept validFilterClauseshapes/values, with new unit tests. - Register
tauri-plugin-logto persist backend logs to the OS log directory with rotation, and add a panic hook.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lib/session.ts | Types clauses as FilterClause[] and sanitizes session-loaded clauses before use. |
| src/lib/session.test.ts | Adds tests verifying malformed filter clauses are dropped during session validation. |
| src/lib/session-restore.ts | Repopulates the filter store clauses after restoring session files so filters persist across “Open Session”. |
| src/lib/session-restore.test.ts | Adds a test ensuring restoreSession writes saved clauses into the filter store. |
| src-tauri/src/lib.rs | Registers persistent backend logging and adds a panic hook to emit a line on crash. |
| src-tauri/Cargo.toml | Adds tauri-plugin-log dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+85
to
+92
| if ( | ||
| (FILTER_FIELDS as readonly string[]).includes(c.field as string) && | ||
| (FILTER_OPS as readonly string[]).includes(c.op as string) && | ||
| typeof c.value === "string" | ||
| ) { | ||
| return [{ field: c.field as FilterField, op: c.op as FilterOp, value: c.value }]; | ||
| } | ||
| return []; |
Save Session persisted the filter clauses, but Open Session only re-applied highlight/find state and never wrote the clauses back into the filter store (which clearTabs() had just cleared), so the filter came back empty every time. Restore the clauses into the filter store after files load, which re-applies the filter to the loaded entries and refreshes the toolbar badge, status bar, and Filter dialog. Also type and sanitize SessionFilters.clauses as FilterClause[] so a malformed or hand-edited session file can't inject a clause into the backend apply_filter. Refs #193 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The app used the `log` facade throughout the backend but never registered a logger backend, so error/diagnostic messages went nowhere and there was no file for users to attach to a crash report (issue #193, part 3). Register tauri-plugin-log to write to the OS app-log directory (cmtrace-open.log) with a 5 MB size cap and single-file rotation, keeping stderr for dev. Add a panic hook so a hard crash (e.g. the reported out-of-memory) leaves a line in the log. Backend-only: no frontend log capability is added, so no tauri.conf.json capability change is required. Lockfile update is deferred to the in-progress workspace/Cargo.lock consolidation; CI builds from src-tauri/ and resolves the new dependency without --locked. Refs #193 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
adamgell
force-pushed
the
fix/193-filter-restore-and-logging
branch
from
July 11, 2026 02:13
e92be2d to
eadecac
Compare
adamgell
added a commit
that referenced
this pull request
Jul 11, 2026
Document the user-facing work merged since the 1.3.2 release: log error navigation (#192), Teams MSIX log collection (#242), session filter restore + error logging (#244), tail truncation/rotation reset (#243), and the Tauri 2.11 / build repair (#240). Dependency bumps, CI-internal changes, and README-only docs are intentionally omitted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
adamgell
added a commit
that referenced
this pull request
Jul 11, 2026
….3.2 (#247) * chore(deps-dev): upgrade TypeScript 6 -> 7 (native compiler, GA) TypeScript 7.0.2 -- the native Go compiler, GA'd 2026-07-09 -- is a clean drop-in for this frontend. No source changes were required: - `tsc --noEmit`: 0 errors - `tsc && vite build`: passes - vitest: 123/123 tests pass Type-checking is ~5.5x faster: `tsc --noEmit` drops from ~3.79s to ~0.69s (macOS, warm). vite and vitest transpile via esbuild and are unaffected; tsc is used only for the type-check gate (CI "TypeScript Check" and the `frontend:build` script), so both simply get faster. The lockfile grows because the native compiler ships as per-platform binary packages (@typescript/typescript-<os>-<arch>) via optionalDependencies, resolved per-platform on install -- the same model as esbuild/swc. linux-x64, win32-x64 and darwin binaries are all present, so `npm ci` resolves correctly on every CI platform. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(changelog): note TypeScript 7 upgrade (#247) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(changelog): catch up [Unreleased] with changes since 1.3.2 Document the user-facing work merged since the 1.3.2 release: log error navigation (#192), Teams MSIX log collection (#242), session filter restore + error logging (#244), tail truncation/rotation reset (#243), and the Tauri 2.11 / build repair (#240). Dependency bumps, CI-internal changes, and README-only docs are intentionally omitted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
5 tasks
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.
Addresses the three items in #193. Rebased onto current
main(post #240 workspace/lockfile repair).1. Out of Memory
Root-caused to the log-tailing bug fixed separately in #243 (rotated/truncated logs accumulated entries without bound). The persistent logging added here makes future OOM reports diagnosable.
2. Filter not restored on Open Session (fixed here)
Save Session persisted the filter clauses, but Open Session only re-applied highlight/find text and never wrote the clauses back into the filter store — and
clearTabs()actively cleared any existing filter during load — so the filter came back empty every time.session-restore.tsnow restores the saved clauses into the filter store after files load, which re-applies the filter to the loaded entries and refreshes the toolbar badge, status bar, and Filter dialog.session.tsnow types and sanitizesSessionFilters.clausesasFilterClause[], so a malformed or hand-edited session file can't inject a bogus clause into the backendapply_filter.session.test.ts(validation drops malformed clauses) andsession-restore.test.ts(Open Session repopulates the filter store).3. "Does it log errors, and where?" (added here)
Today: no — the backend uses the
logfacade throughout but no logger backend was registered, so nothing was written to disk.This registers
tauri-plugin-logto write to the OS app-log directory (cmtrace-open.log; on Windows%LOCALAPPDATA%\com.cmtrace.open\logs\) with a 5 MB cap + single-file rotation, and adds a panic hook so a hard crash leaves a line. Backend-only — no frontend log capability, so notauri.conf.jsonchange is needed.Cargo.toml+ the rootCargo.lockare both updated (additive:tauri-plugin-logand its transitive deps).Closes #193.
🤖 Generated with Claude Code