Skip to content

[P1/arch] History records only editor queries; app-generated SQL is invisible #586

Closed

Description

@EVWorth

Context

Only resultStore.doExecuteQuery calls historyStore.addEntry. These call api.executeQuery directly and are never recorded:

  • grid cell edits — the START TRANSACTION; UPDATE…; COMMIT; batch at src/components/grid/ResultsGrid.tsx:449
  • admin — CREATE USER, GRANT, password changes, user drops (src/components/admin/*)
  • import (src/components/import/ImportDialog.tsx:206) and restore (src/components/backup/RestoreDialog.tsx:146)
  • backup generation (src/lib/backup-generator.ts:149)

The designer’s ALTER is recorded, but only incidentally: it was moved onto the store for the production gate (#393) and history came along for the ride.

Problem

The panel silently omits writes the app made on the user’s behalf. A user who changed three cells in the grid and later asks "what did I run against prod" gets an incomplete answer, with no indication anything is missing. Which statements appear is an accident of refactoring history, not a decision.

Expected

Every statement the app sends is recorded, tagged with where it came from — editor, grid, designer, admin, import, restore, internal. The panel filters to user-originated entries by default with a control to show the rest, so an import does not bury the day’s work. Internal reads (SHOW CREATE TABLE during backup) are tagged internal and hidden unless asked for.

This is what DBeaver’s Query Manager does with its query-type column, and it is the only way to make coverage a policy rather than an accident.

Proposed fix

Route the direct api.executeQuery call sites through a store method that takes an origin tag. See also the safety half of this in the gate-bypass issue.

Acceptance

A grid cell edit, an admin GRANT and an import all appear in history with the right origin; the default view shows neither the import’s statements nor internal reads; a filter reveals them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/historykind/archseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions