Skip to content

Feat/ledger explorer - #223

Open
barisakcam wants to merge 8 commits into
COVESA:mainfrom
barisakcam:feat/ledger-explorer
Open

barisakcam wants to merge 8 commits into
COVESA:mainfrom
barisakcam:feat/ledger-explorer

Conversation

@barisakcam

Copy link
Copy Markdown

Add ledger exploration

Reads a user-supplied SQLite ledger entirely in the browser via sql.js,
with no backend endpoints involved.

- Workspace selector separates Schema (Explorer/Insights) from Ledger
- Left sidebar loads a ledger and summarises active/total counts per table
- Raw Tables: table dropdown, search, kind and status filters, pagination
- Explore: one search across every table, results grouped per table
- Query: predefined queries plus editable read-only SQL, enforced by
  PRAGMA query_only
- Details sidebar shows a record's Concept -> Revision -> Contract ->
  Binding context with expandable nodes and record-to-record navigation
- Table order, level links and record identity are derived from the
  database's declared foreign keys
Add case-sensitive, whole-word and regex search across Raw Tables and
Explore, backed by a registered SQLite regex function, plus kind and
status filter dropdowns.

Give the details pane record actions that navigate to any record a row
references, and to that record's page in Raw Tables. Add a mermaid ER
diagram of the ledger shape behind a button in the sidebar.

Replace the query presets with simpler ones that exercise these paths.

Fix chain resolution to link levels by foreign key rather than by table
order or table name, so a sibling table or an irregular plural no longer
hides a subtree, and bound the walk so a wide ledger cannot freeze the
tab. Keep a loaded ledger when an import fails, report the reason, and
close a superseded import instead of leaking it.
Show each table's columns and the relationship diagram in all three
ledger views, not only in Query. Drop the collapsible wrapper, the
empty-state text and the separator from the ledger file list, which
holds one file at most.

In the query toolbar, remove the read-only hint and move the selected
preset's description below the selector, keeping its line reserved so
the toolbar does not change height.

Hide the Explorer and Insights tabs until a schema is loaded, replacing
the prompt that was duplicated into both tab bodies.

Fix the theme flashing to the system setting when switching workspaces:
ThemeToggle is remounted each time and read its stored value one render
too late.
Derive the ModL model from one declaration and fall back to it when the
uploaded database declares no keys, so the chain, the table order and the
page ordering survive a file exported without constraints. Take the shape
from modl/ledger.py, and make the table icons and status tones exhaustive
over it.

Fix the correctness findings: a second ledger no longer inherits the
first one's details, matches and query result; a failed import leaves the
loaded ledger alone and says why; a superseded import closes its own
database; chain levels link by the foreign key that declares them rather
than by table order or name; search folds case for non-ASCII text in
every mode; a repeated column name no longer highlights the wrong row.

Split the four largest files along the seams their signatures already
drew: introspect into sql, schema, rows, query and search; the slice and
the saga into one per concern; chain into a pure derivation and a
database walk. Extract the shared details-pane shell, the search input,
the record list and actions, the table footer and filter selects, and the
two help panels. Dissolve constants.ts into the modules that read them.

Reduce the repeated work each read did: two queries per page instead of
three, one count per table instead of two, and one pass over the chain
instead of one per node.

Style the record details as bordered rows with tinted column names, to
match the insights detail views.
Match the ledger file row to the Schema file list: the same container
padding and list spacing, and a placeholder in the leading slot so the
name and the row height line up with a list that has a drag handle and a
per-row remove button.

Give the table list and the relationships button the same width as the
file row, which the container's wider horizontal padding had held back.

Drop the status badge from the details title, and move the tint in Record
details from the column name to the value, which is what a reader scans
for.
Two review findings whose earlier fixes had not landed: the quoted
identifier was still built inside the columnPredicate call, and the
per-column predicate was still bound as `one` in both the join and the
loop.
Keep the scroll-into-view effect from firing on every render: the call
sites build selectedValues inline, so the effect now keys on the values
rather than the array's identity.

Clear the rows on a failed reload, which the split had dropped, so the
previous page's footer no longer sits under an error banner.

Pass the profiled tables into searchLedger. Building the list there again
skipped the ModL fallback, so Explore ordered a keyless file
alphabetically while the sidebar showed chain order.

Compare blob values by content rather than by length alone: two rows
differing only in same-length blob content both highlighted.

Also pass bodyKey so ledger navigation animates as Insights does, merge
LedgerErrorBanner's className instead of replacing it, move a doc comment
that stayed behind in schema.ts, drop one that stayed behind in
RawTablesView, and name the two values in the row comparison.
The pane wrote its own centred, muted div for the "no card selected"
state. LedgerDetailsPane and LedgerTab already render the shared
EmptyState for the same thing, so this was the last of the three copies
the ledger style review named.

Drop the div's p-5 and text-center rather than passing them through
className: EmptyState centres with flex already, and neither ledger site
adds padding, so all three placeholders now look alike.
@barisakcam
barisakcam marked this pull request as ready for review September 7, 2026 10:11
@ahmdmhd
ahmdmhd requested a review from jdacoello September 7, 2026 11:55

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant