Skip to content

Table Query and Diff Engine

Andrew Paolucci edited this page Dec 2, 2026 · 3 revisions

Table Query & Diff Engine (guap-table)

guap-table (#![forbid(unsafe_code)]) standardizes how every GUAP suite represents, queries, sorts, paginates, and compares forensic and system telemetry records.


1. Core Data Model

  • TableSchema & ColumnDef (ColumnType): Declares typed columns (String, numeric, boolean, timestamp, bytes) with display widths, visibility defaults, and alignment.
  • CellValue & Row: Preserves structured typed cell values alongside optional detail_json metadata and raw-byte slices for inspector/hex panes without lossy stringification.
  • TableProvider Trait: Downstream crates implement a single trait exposing schema metadata, row generation, and is_read_only() declaration.

2. GuapQuery Filter, Sort, Projection & Pagination Engine

GuapQuery provides uniform CLI --filter, --sort, --columns, --limit, and --offset behavior across every suite:

  • Comparison Operators: ==, !=, <, <=, >, >=, case-insensitive contains, and regex ~.
  • Boolean Logic & Safety Bounds: Combines clauses with AND, OR, NOT and parenthesized grouping while enforcing recursion/nesting caps against adversarial expressions and preserving exact integer precision above $2^{53}$ (u64/i64 comparisons do not truncate to f64).
  • Sorting & Projection: Supports multi-column sort specifications (e.g., "timestamp:desc,event_id:asc" or "-pid") and explicit column subsets (--columns).

3. TableTextCompare Deterministic Diffing

Used by suite diff / data diff commands (for example comparing two offline registry snapshots, process captures, or CSV/TSV/JSONL exports):

  • Compares baseline vs. target row sets keyed by primary columns.
  • Rejects duplicate keys deterministically before diffing so silent collisions cannot mask tampered records.
  • Classifies rows cleanly into Added, Removed, Modified (with per-column deltas), and Unchanged.

4. Shared Cockpit Shell & SuiteWorkbenchHost (guap_table::shell)

guap_table::shell provides the headless 5-zone cockpit state machine (GuapShellState) and plug-in trait (SuiteWorkbenchHost) consumed by guap-gui-win32, guap-gui-iced, and flagship GuapFlagshipHost:

  • Policy & Forensic Posture: UiPolicyPosture (ReadOnlyOnly, DryRunOnly, AllowMutating), TargetEnvironment (LiveHost, OfflineArtifact, UsbForensics, ConnectedDevice), and ForensicCaseLock (effective_policy() forces ReadOnlyOnly when locked or in UsbForensics mode).
  • Approval Card Lifecycle Hooks: SuiteWorkbenchHost::stage_mutating_action(), approve_mutating_card(&self, card_id, actor), and undo_executed_card(&self, card_id, actor) drive GuapShellAction::ApproveCard and GuapShellAction::UndoExecutedCard across both Win32 and Iced cockpits.