Repository navigation
refactor: simplify pass across the codebase - #518
Conversation
Behavior-preserving cleanups from a reuse, simplification, efficiency, and altitude review of the whole tree. - engine/telemetry: build each signal's column SQL once, reuse cached source lists, batch version-rollup inserts, drop the snapshotSource pass-through, and share path, sync, scope, and Parquet-open helpers. - query/pitotql: hoist scan destinations, share flight-leave and request-time helpers, cache vocabulary lookups per compile, hash variables once per check, and reuse existing quoting and grouping. - api/mcp/ingest/alert: decode each MCP body once, use ErrNotFound instead of string matching, delete rules in one query, share audit, ingest resource, and detector helpers, and pass request contexts to user lookups (removing the unused UserStore.GetByID). - ui/site: memoize chat derivations, share query and cache-key definitions, and dedupe teardown, layout, text-measure, copy-button, and HTML-walk helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Walkthrough
Change: Refactor Security architecture risk:
|
Keep the stop teardown ahead of abortRun, look up the shared canvas context on each use so replaced getContext implementations are honoured, and drop an unused import from the site table check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Revert the pitotql vocabulary cache, the remembered MCP body decode, the precomputed engine view SQL, and the chat page memoization. Each adds caching machinery whose benefit has not been measured; they move to a separate change that lands with benchmarks. Rebuild the embedded UI bundles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Behavior-preserving cleanups from a reuse, simplification, efficiency, and altitude review of the whole tree.
cacheBatches; allocate scan buffers once inforAffectedKeys; one multi-rowversion_rollup_batchesinsert; remove thesnapshotSourcepass-through; sharesummaryRelations,scopePredicate,telemetry.SyncDirectory, andopenParquet; useParquetStorepath helpers.resultCache.leaveandrequestTimereplace duplicated blocks; variables hashed once per check;capProblems,sqlString,query.Grouped, andmaps/slicesreplace hand-rolled copies.ErrNotFoundand callers useerrors.Is;DeleteRuleis:execrowswith no pre-read; sharedrecordRequestAudit, ingestresourceIdentity, and detectorreadWindowAnomalies; dashboardGetrunsensureInitialonly on a miss; OAuth user lookups use the request context, so the unusedUserStore.GetByIDis removed.servicesQuery,telemetrySchemaQuery,dashboardKey, anddashboardVersionsKey;endRun,layoutOf,useWindowHeight,measureText,seriesOf, and copy-button components replace duplicates; onehtmlFilesmodule for the site check scripts.Observable differences: a rule-delete database failure reads
store: delete rule: …without(pre-check), and a cancelled MCP request now cancels its user lookup.Left out on purpose: map-based ingest attribute lookup, batching alert lookups per tick, and returning the answer-only flag from
StartRun. Each changes edge-case behavior or reaches well beyond a local cleanup.Caching changes found in the review (pitotql vocabulary cache, single MCP body decode, engine view SQL built at init, chat memoization) are left out pending local benchmarks.
Test plan
just testjust lint,just go-deadcode,just test-names-check, gofmtui/host: lint (tsc), knip,just ui-boundaries-check, vitest (1790 tests)check-canonical,check-social-card,check-tablesui-check, site build, e2e)🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Improvements