Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:2giosangmitom Sqmeow nvim View Request Parsing

From Leeroopedia
Knowledge Sources
Domains View_Processing, RPC
Last Updated 2026-10-16 14:00 GMT

Overview

A request parsing principle that decodes structured filter, sort, and column-scope specifications from MessagePack RPC calls into typed engine structures for local result processing.

Description

View Request Parsing is the principle of translating editor grid UI inputs — filter dropdowns, sort columns, column selections, staged edits — from MessagePack arrays and maps into typed engine structures (Filter, Sort, Changes). The parser is strict where wrong input could change behavior or permissions, and lenient where absence is a valid default.

This principle addresses the challenge of bridging the editor's loosely typed Lua tables with the engine's typed Rust structures. Filters carry an optional column index (None = search all columns), an operator (Op enum: Eq, Ne, Gt, Ge, Lt, Le, Contains, StartsWith, IsNull, NotNull), and a value string. Sort carries a column index and descending flag. Column indices are optional (None = all columns). Staged changes distinguish SQL expressions from literal values.

Usage

Use this principle when a grid UI sends filter/sort/edit requests to an engine: parse typed structures from wire format, default sensibly on absence, and reject malformed input that could change behavior.

Theoretical Basis

The principle maps wire-format maps to typed structures:

  1. Filters: Array of {column, op, value} → Vec<Filter>. Column is Option<usize> (None = all). Op is parsed from string name; unknown ops error.
  2. Sort: Array of {column, descending} → Vec<Sort>. Column is required; descending defaults to false.
  3. Indices: Array of u64 → Option<Vec<usize>> (empty/absent = None = all).
  4. Changes: Map with updates, deletes, inserts → Changes. Cells distinguish sql (expression) from value (literal).
# Abstract pattern (NOT real implementation):
def filters(value) -> list[Filter]:
    return [Filter(
        column=item.get("column"),  # None = all columns
        op=Op.parse(item["op"]),    # unknown → error
        value=item.get("value", ""),
    ) for item in value or []]

def changes(value) -> Changes:
    return Changes(
        updates=[(u["row"], parse_cells(u["cells"])) for u in value["updates"]],
        deletes=indices(value["deletes"]),
        inserts=[parse_cells(ins) for ins in value["inserts"]],
    )

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment