Product requirements

Lattice: plan

Lattice is one Ember grid for every collection: lists, feeds, tables, boards and spreadsheets.

Status
Shipped
Owner
Joe Gaudet
Created
Updated
One-pager
None
Related
ADR-0001, ADR-0002, ADR-0003, ADR-0004, ADR-0005, ADR-0006, ADR-0007, ADR-0008, ADR-0009, ADR-0010, ADR-0011, ADR-0012, ADR-0013, ADR-0014, ADR-0015, ADR-0016, ADR-0017, ADR-0018, ADR-0019, ADR-0020, ADR-0021, ADR-0022, ADR-0023, ADR-0024, ADR-0025, ADR-0026, ADR-0027

Summary

Date: 2026-12-01. Status: M0 in progress.

Changes

  • 2026-12-02: ADR 0025: the five live demos run fully in the browser on GitHub Pages, with no hosted server. The demo server is the real protocol code (parseRowsRequest and evaluate) in a Web Worker, with latency. The collaborative sheet uses the real createDocServer in a SharedWorker, with a leader on a BroadcastChannel as the fallback. The demos are in the guide under demos/. A hosted Rails demo server stays a later option (open question 6).
  • 2026-12-02: ADR 0020: the IronCalc WASI shim moves out of spikes/ to wasm/ironcalc-wasi. The .wasm is not in git: a CI job builds it, and the Ruby and Python jobs test and pack that file. The module gets insert, delete, rename, close and one ic_apply_batch call, so the Ruby and Python collab servers keep the workbook and make one call for each submit.
  • 2026-12-01: Section 11 has a "Fix" column, and S12 (changes in TanStack after the port) is new. S10 is closed: Joinery 1.0.1 is on npm.
  • 2026-12-01: M3 (List, Board), M4 (row models, data-fetch, the Node, Rails and Python servers), M5 (state and views) and protocol v1 rounds 1 and 2 are built. The Ember tests now run on Ember's development runtime (they ran on the production runtime before, so Ember's assertions never fired). New risk S13: in the test app, Joinery and Formwright CSS (about 1,400 rules, 36 with :has()) made grid layout about 6× slower than the Lattice CSS alone.
  • 2026-12-01: M2 Grid: ADR 0002 amendment 1 (accepted) replaces the held layer with sticky slots. The active row keeps its slot and element when it scrolls out of the range.
  • 2026-12-01: Maintainer decisions: ADR 0001 (raw Glimmer tags) is accepted. The ported TanStack code gets real types, with no lint override. Sheet gate: < 300 ms in the worker first, then incremental recalc upstream. Commit each time the gate passes.
  • 2026-12-01: The protocol is built (ADR 0005). Its v1 details add count to the request, as to aggregates, $count on group rows, key on ColumnSchema, one op on every filter node, and JSON pivot field names.
  • 2026-12-01: Spikes S5 and S6 are done (ADRs 0006 and 0007). IronCalc is the engine on the client and, as one WASI file, on every server. Open question 8 is new: IronCalc recalculates the full workbook on each edit.
  • 2026-12-01: Spikes S2 and S4 are done (ADRs 0002 and 0004). S2: the hybrid renderer is the decision. The S2 fallback now also needs the held layer. S4: one scroll container with position: sticky and logical insets works in LTR and RTL.
  • 2026-12-01: Spike S1, first result: Glimmer tracking runs headless in Node, so the engine tests run in Vitest.

Lattice is one Ember grid for every collection: lists, feeds, tables, boards and spreadsheets. It ports TanStack Table and TanStack Virtual into Ember-native code. On top of that port, it adds every AG Grid feature, Community and Enterprise, under the MIT license. It also adds a spreadsheet with formulas, a server model and live collaboration.

The sourced findings are in research.md.


3. Name and identity: Lattice

The bench uses woodworking names: Formwright, Joinery, Marquetry, Jig, Millwork. A lattice is strips of wood that cross to make a grid. Lattice takes rows and columns and crosses them into lists, tables, boards and sheets.

  • Repo: joegaudet/ember-lattice.
  • npm scope: @ember-lattice/*. The bare package ember-lattice is the CLI, like ember-joinery. This is the UI-library template (Joinery, Formwright, Marquetry). The name question showed @lattice-ts/*, but that pattern is for TypeScript-first libraries (Switchyard, Millwork). Lattice is Ember only, so it uses the Ember UI pattern.
  • Server packages: npm @ember-lattice/server, gem lattice-grid, PyPI lattice-grid. The name lattice is taken on RubyGems and PyPI.
  • Docs: https://joegaudet.com/ember-lattice/.
  • Make the npm org ember-lattice before the first release. The registry check could not read the org page.
  • Words for the docs, used with care: "strip" (a row or a column), "cross" (a cell), "panel" (a view). Code names stay plain: row, column, cell, view.

Glossary

1. Terms

Term Meaning
engine The Lattice core: columns, rows, state, features and the row model pipeline. It has no DOM.
feature One plugin of the engine, for example rowSorting or columnPinning. Same idea as a TanStack v9 feature.
row model Where rows come from and who computes them: client, infinite, server or viewport.
data source The object that a row model asks for rows. It hides the server.
view A saved set of grid state: columns, sort, filter, groups, widths.
surface A component that renders the engine: Grid, List, Board, Sheet.
cell One value at a row and a column. A cell has a value, a display and an optional component.
sheet A surface and a model in which cells hold formulas and formats.
op One change to a sheet or a row set, for example "set cell", "insert row". The server orders ops.

Problem and context

Not recorded in the original plan.

Goals and non-goals

Not recorded in the original plan.

Customers

Not recorded in the original plan.

Internal stakeholders

Not recorded in the original plan.

Users and scenarios

Not recorded in the original plan.

Landscape and constraints

Not recorded in the original plan.

Proposed design

4. Architecture

4.1 Layers

 surfaces      Grid      List      Board      Sheet               (@ember-lattice/ember)
                 \        |         |         /
 chrome        menus, side bar, filters UI, status bar, find       (@ember-lattice/ui)
                          |
 render        virtualizer, row recycling, renderer seam (DOM now, canvas later)
                          |
 engine        table, columns, features, state atoms, row model pipeline  (@ember-lattice/core)
                          |
 data          row models: client | infinite | server | viewport   (@ember-lattice/data)
                          |
 wire          Lattice protocol (plain TS) ── server packages: Node, Rails, Python

4.2 Packages

Package Contents Depends on
@ember-lattice/core Engine: Table, column defs, all features, row model pipeline, Atom, memo, column types ember-source only
@ember-lattice/virtual Port of virtual-core: row and column virtualizers, measurement, lanes, anchors, scaled scroll ember-source
@ember-lattice/ember Surfaces Grid, List, Board, Sheet; cell, header and row components; keyboard; ARIA; drag core, virtual, @ember-joinery/primitives
@ember-lattice/theme CSS: grid presets on Joinery tokens, in a lattice cascade layer @ember-joinery/ember CSS (peer)
@ember-lattice/ui Column menu, context menu, side bar, tool panels, filter UIs, advanced filter builder, status bar, toolbar, find ember, Joinery
@ember-lattice/data DataSource interface, the four row models, block cache, transactions, live updates core, @switchyard-ts/core
@ember-lattice/protocol Wire types, JSON Schema, version, AG Grid SSRM translator. Plain TS, no Ember. none
@ember-lattice/data-fetch DataSource over fetch and the Lattice protocol data, protocol
@ember-lattice/data-warp-drive DataSource over WarpDrive requests, JSON:API links data, @warp-drive/core
@ember-lattice/data-graphql DataSource over Relay connections data
@ember-lattice/state StateStore interface; URL, localStorage and server adapters; saved views core
@ember-lattice/editing Edit lifecycle, Formwright editors, row and popup edit, batch edit, undo and redo, clipboard, fill handle ember, @ember-formwright/ember, @switchyard-ts/ember
@ember-lattice/export CSV, XLSX and PDF export core
@ember-lattice/charts Sparklines, integrated charts through @ember-joinery/chart ember
@ember-lattice/sheet Sheet model: sparse cells, refs by ID, formats, merges, conditional formats, validation, notes, named ranges core, editing
@ember-lattice/formula FormulaEngine interface, A1 and R1C1 parse for editing, ID-ref storage none
@ember-lattice/formula-ironcalc IronCalc WASM adapter, loaded on demand formula, @ironcalc/wasm
@ember-lattice/formula-hyperformula HyperFormula adapter. GPL peer, optional, the app owns the license. formula, hyperformula (peer)
@ember-lattice/collab Op log client, presence, cursors, rebase of local ops sheet, data
@ember-lattice/test-support harnessed harnesses: GridHarness, ListHarness, BoardHarness, SheetHarness, scroll and drag helpers @harnessed-ts/core
@ember-lattice/marquetry Marquetry catalog entries for Lattice surfaces @ember-marquetry/core
@ember-lattice/server Node: protocol to SQL (Kysely), sheet op log server, collab socket protocol
ruby/lattice-grid Rails: protocol to ActiveRecord and Arel, op log, Action Cable channel —
python/lattice-grid SQLAlchemy and Django: protocol to SQL, op log, ASGI socket —
ember-lattice CLI: npx ember-lattice add <preset> copies a preset into the app —
bench (private) Perf harness and fixtures (section 9) all

Rules:

  • Core and virtual import nothing from Joinery, Formwright or Switchyard. An app can use the engine with its own skin.
  • data depends on @switchyard-ts/core (not the Ember package), because a machine runs each block (section 5.2). It imports nothing from Joinery or Formwright.
  • protocol and formula import nothing from Ember. Servers and workers share them.
  • Every heavy part loads on demand: IronCalc WASM, XLSX, PDF, charts.
  • Scroll, virtualization and cell render never go through a Switchyard machine (decision 20). Machines run only interaction states: edit, block load, drag, resize.

4.3 Reactivity (the base of the port)

TanStack v9 puts one atom on each state slice and reads are pull-based. Lattice keeps that model in Glimmer terms.

// core/src/reactivity/atom.ts (ADR 0001: one raw Glimmer tag for each atom)
import { createTag, consumeTag, dirtyTag } from '@glimmer/validator'
class Atom<T> {
  #tag = createTag()
  #value: T
  get(): T {
    consumeTag(this.#tag)
    return this.#value
  }
  set(next: T): boolean {
    if (this.equals(this.#value, next)) return false
    this.#value = next
    dirtyTag(this.#tag)
    return true
  }
}
const derived = <T>(fn: () => T) => {
  const c = createCache(fn)
  return {
    get value() {
      return getValue(c)
    },
  }
}
  • ADR 0001 (accepted): raw tags are about 10× faster to create and 4× faster to read after a write than @tracked, at 1M tags, with about half the memory. The APIs exist in ember-source 6.12. A CI job on 6.12 checks them.
  • row.version uses a raw tag with prototype methods, not Atom (bound methods cost about 220 MB for each 1M atoms).
  • Each state slice (sorting, columnSizing, ...) is an Atom. Three ownership modes, as in TanStack: internal, controlled (@state plus @onStateChange), and external atom.
  • The row model pipeline is a chain of derived caches: core → filtered → grouped → sorted → expanded → paginated. A step recomputes only when its inputs change.
  • Row data is an immutable array. Lattice never wraps rows in trackedArray. A transaction makes a new array and a set of changed row IDs.
  • Fine-grained cell reads: a cell reads row.version and the column accessor. A row edit bumps one row.version, so only that row's cells render again.
  • Batch writes: table.batch(() => ...) sets many atoms and renders once.

4.4 The engine API (Ember-first, TanStack words)

import { Table, column, features } from '@ember-lattice/core'

class OrdersTable extends Table<Order> {
  features = features.all // or features.pick('rowSorting', 'columnPinning')

  @column({ header: 'Customer', size: 220, pin: 'left' })
  customer = (o: Order) => o.customer.name

  @column({ type: 'money', aggregate: 'sum' }) // column type from Millwork codec
  total = (o: Order) => o.total

  @column({ type: Status, filter: 'set' }) // real-enums column
  status = (o: Order) => o.status

  @column({ cell: CustomerAvatarCell, editor: 'text' })
  owner = (o: Order) => o.owner
}
<Lattice::Grid
  @table={{this.orders}}
  @rowModel={{this.serverRows}}
  @view={{this.view}}
  @theme='sheet'
  @density='compact'
  as |grid|
>
  <grid.Toolbar />
  <grid.SideBar />
  <grid.StatusBar />
</Lattice::Grid>
  • A plain object form (defineColumns([...])) makes the same definition. Marquetry and saved views need it. Open question 1 picks which form is the source of truth.
  • Column groups: @group({ header: 'Sales' }) on a nested class, or columns: [...] in the object form.
  • Column types (core/src/types/) add compare, format, parse and a default filter on top of a Millwork codec or a real-enum. Built-in types: text, number, money, decimal, percent, date, datetime, boolean, enum, url, email, json.

4.5 Features (the port of the 17 TanStack features, plus AG Grid features)

Ported from table-core 9.3.1, test for test: cellSelection, cellSpanning, columnFaceting, columnFiltering, columnGrouping, columnOrdering, columnPinning, columnResizing, columnSizing, columnVisibility, globalFiltering, rowAggregation, rowExpanding, rowPagination, rowPinning, rowSelection, rowSorting.

New, for AG Grid parity:

Feature Note
columnFlex, columnAutoSize Flex widths and auto-size from measured content
columnHeaderGroups Header group rows, expand and collapse groups
rowGrouping (extended) Group panel, sticky group rows, group rows from the server
pivot Pivot columns made from values, "show values as" (% of total, of row, of column)
treeData Rows with a parent path or a children accessor, lazy children
masterDetail A detail surface below a row, any component, nested grids
fullWidthRows A row that is one component across all columns
rowDrag Managed and unmanaged drag, between grids, drag to group changes the field
rowHeight Fixed, presets (short, medium, tall), measured, auto
quickFilter, advancedFilter Quick text filter, filter tree with AND and OR
find Find in grid, next and previous, highlight
notes Cell notes stored outside row data
rowNumbers A row number column
calculatedColumns Columns from a formula expression
highlightChanges Flash a cell when its value changes

4.6 Rendering and virtualization

  • @ember-lattice/virtual ports virtual-core: Virtualizer with estimateSize, measureElement, lanes, gap, overscan, rangeExtractor, isRtl, getItemKey.
  • The grid uses two virtualizers: rows and columns. rangeExtractor always keeps pinned rows, pinned columns, sticky group rows and the focused cell in the range.
  • Row recycling. The grid renders a fixed pool of row slots, keyed by slot, not by row ID. On scroll, a slot gets a new row. Glimmer then updates only the cells whose value changed. Spike S2 checks the cost against keyed-by-ID rendering.
  • Cell paths (decision 26):
    • Plain cell: the column format gives a string. No component, one text node.
    • Component cell: any gts component with the signature { Args: { cell, row, column, value } }.
    • A column can give a renderer that is "cheap" (pure template) or "full" (a component with state). Lattice warns in dev mode when a full renderer is in a column with more than 10k visible cells a second.
  • Scaled scroll. Above the browser element height cap, the virtualizer maps the virtual offset to a smaller scroll range (spike S3).
  • Renderer seam (decision 6). Surfaces talk to a Renderer interface: mount, paint(range), hitTest(x, y), focusCell. The DOM renderer ships in 1.0. A canvas renderer can implement the same interface after 1.0. Accessibility for canvas then uses an ARIA overlay.

4.7 Surfaces

Surface Use Notes
Grid Tables and data grids All features. ARIA grid or treegrid.
List Lists and feeds One column, variable height, masonry (lanes), card grid, load in two directions with a scroll anchor. ARIA list, feed or listbox.
Board Kanban Lanes by a group field. Drag a card to another lane to edit the field (an op through the data source). Each lane is virtualized.
Sheet Spreadsheet A1 headers, formula bar, sheet tabs, frozen panes, fill handle. ARIA grid.

All four use the same engine and row models. One view can switch between Grid, List and Board.

4.8 Keyboard and focus

  • A 2-D roving tabindex (ember/src/focus/grid-focus.ts) on top of Joinery RovingFocus ideas. The grid has one tab stop.
  • Keys follow the WAI-ARIA APG grid pattern: arrows, Home, End, Ctrl+Home, Ctrl+End, PageUp, PageDown, Enter or F2 to edit, Escape to cancel, Tab to move in edit mode, Space to select, Shift+arrows to extend a range, Ctrl+A, Ctrl+C, Ctrl+V, Ctrl+Z, Ctrl+Y.
  • The focused cell stays in the DOM when it scrolls out (the range extractor keeps it).
  • RTL swaps the arrow directions and the pin sides.

4.9 Accessibility (decision 28)

  • role="grid" or role="treegrid", aria-rowcount, aria-colcount, aria-rowindex, aria-colindex on every rendered row and cell, so screen readers know the true size.
  • aria-sort on headers, aria-selected on rows and cells, aria-expanded on group rows, aria-level, aria-setsize, aria-posinset for tree data.
  • Live announcements through SwitchyardAnnouncer: sort changes, filter result counts, loading, edit saved or failed, collaborator joined.
  • Every test ends with an axe audit. Screen-reader tests run with NVDA and VoiceOver on a fixed script before each minor release (manual, recorded in docs/a11y/).
  • High-contrast and forced-colors styles in @ember-lattice/theme.

4.10 Styles (decision 7)

  • Lattice uses the Joinery oklch tokens, so all 7 Joinery themes and 8 styles work.
  • Grid presets in @ember-lattice/theme: density (compact, normal, comfortable), borders (none, rows, cells), zebra, sheet (A1 look with grid lines), list, board.
  • Grid tokens add to Joinery tokens: --lt-row-height, --lt-cell-padding, --lt-header-bg, --lt-range-bg, --lt-range-border, --lt-pinned-shadow, and more.
  • Classes are .lt-* inside :where(), in a lattice cascade layer after joinery.
  • Light, dark and high contrast in every preset. A theme builder page in the docs.

5. Data

5.1 The DataSource interface

interface DataSource<Row> {
  capabilities: { sort; filter; group; aggregate; pivot; tree; count; transactions; push }
  getRows(req: RowsRequest, signal: AbortSignal): Promise<RowsResponse<Row>>
  subscribe?(onChange: (tx: Transaction<Row>) => void): () => void // live updates
  mutate?(ops: RowOp<Row>[]): Promise<MutateResult<Row>> // edits, drag to group
  getRowId(row: Row): string
}
  • capabilities tells the row model what the server does. Lattice does the rest on the client when it can, and warns when it cannot.
  • Every request takes an AbortSignal. A fast scroll cancels old block requests.

5.2 Row models (decision 13)

Row model How it works
client All rows in memory. The full pipeline runs on the client. An optional worker runs filter, sort and group for big sets (port of the TanStack worker plugin).
infinite Blocks of blockSize rows. A block cache with LRU eviction (maxBlocks). Sort and filter on the server. Load in two directions for lists.
server Lazy group levels. Each group node has its own block cache. Server group, aggregate, pivot and tree. Transactions by route (group path). Grand total row.
viewport The grid tells the server the visible range. The server pushes only those rows and their changes. For live, high-rate data.
  • A Switchyard machine runs each block: idle → loading → loaded → stale → reloading, with failed and retry (decision 20). Skeleton cells show while a block loads.
  • refresh({ purge }), retryFailed(), applyTransaction(tx), applyTransactionAsync(tx) (batched in one frame).

5.3 The Lattice protocol (decision 16)

interface RowsRequest {
  v: 1
  range: { start: number; end: number } | { after?: string; before?: string; limit: number }
  sort: { column: string; dir: 'asc' | 'desc'; nulls?: 'first' | 'last' }[]
  filter: FilterNode | null // one typed tree: and, or, not, leaf { column, op, value }
  search?: string // quick filter
  group: { by: string[]; keys: unknown[] } // keys.length is the level
  aggregate: { column: string; fn: string }[]
  pivot?: { by: string[]; values: { column: string; fn: string }[] }
  columns?: string[] // projection
}
interface RowsResponse<Row> {
  rows: Row[]
  count?: number
  cursor?: { next?: string; prev?: string }
  pivotColumns?: PivotColumn[]
  total?: Record<string, unknown>
}
  • Both offset and cursor paging. Cursor (keyset) paging is for deep scroll and lists.
  • One filter grammar. The AG Grid translator maps both AG Grid filter grammars into it.
  • protocol ships a JSON Schema for each message and a conformance suite (protocol/conformance/) that every server package must pass.
  • The filter op list is closed: eq, ne, lt, lte, gt, gte, in, notIn, contains, startsWith, endsWith, blank, notBlank, between, inRange (dates).

5.4 Server packages (decision 15)

All three do the same work and pass the same conformance suite:

  1. Allow-list every column, aggregate function and op. This is the trust boundary.
  2. Bind all values as parameters. Never put a client string into SQL.
  3. Group rows when keys.length < by.length, else leaf rows.
  4. Pivot with FILTER (WHERE ...) on Postgres, CASE on other databases.
  5. Keyset paging when a cursor is given.
  6. Count only when asked, or when the block is the last block.
  7. Push transactions to clients (Action Cable, ws, ASGI).
Package Query layer Socket Databases
@ember-lattice/server Kysely ws Postgres, MySQL, SQLite
gem lattice-grid Arel and ActiveRecord Action Cable Postgres, MySQL, SQLite
PyPI lattice-grid SQLAlchemy Core; a Django adapter ASGI (Starlette, Channels) Postgres, MySQL, SQLite

5.5 Adapters (decision 14)

  • data-fetch: the Lattice protocol over fetch (POST or GET with a query string).
  • data-warp-drive: requests through the WarpDrive RequestManager; JSON:API links for paging; records stay in the WarpDrive cache. The experimental pagination API stays inside this adapter.
  • data-graphql: Relay connections for infinite lists.
  • data-ag-grid: wraps an existing AG Grid SSRM backend through the translator. This is the migration path.
  • Client-only: arrayDataSource(rows) for tests and demos.

6. State and views (decision 17)

  • table.getState() gives a JSON object with: column order, pinning, sizing, visibility, sort, filter, quick filter, find, group, pivot, aggregation, expanded groups, selection, focused cell, scroll position, pagination, side bar state. Same keys as the AG Grid state API.
  • StateStore interface: load(key), save(key, state), subscribe?.
  • Adapters:
    • urlStore: a short, stable encoding in a query param. It uses Joinery qp helpers.
    • localStore: localStorage, with a version and a migration step.
    • serverStore: saved views through the data source. Personal views, shared views and locked views (Notion, Airtable). "Save for everyone" is an explicit action.
  • Precedence: URL, then personal view, then shared view, then column defaults.
  • Every state has a schema version. Old state migrates or drops one key at a time, never the whole state.

7. Editing (decisions 19 and 20)

  • Cell editors use the Formwright ControlSignature. Every Formwright control is a cell editor with no glue. Built-in editors: text, large text, number, date, select, rich select, checkbox, enum (real-enums), money (Millwork).
  • Modes: cell edit, full-row edit (a Formwright Form @inline over the row), popup edit (Formwright callout), batch edit (stage, then commit or discard).
  • An edit machine (Switchyard): viewing → editing → validating → saving → saved | failed. Validation uses the column Standard Schema.
  • Undo and redo: a command stack of inverse ops. In a collaborative sheet, undo only your own ops (section 8.4).
  • Clipboard: copy and paste of ranges as TSV and HTML. Paste parses each value with the column type. Cut.
  • Fill handle: drag to copy, or to extend a series (numbers, dates, text with numbers).
  • Range selection: many ranges, Shift and Ctrl, range sums in the status bar.

8. Sheet

8.1 Model

  • Sparse cells: Map<rowId, Map<colId, Cell>>. A cell holds a raw value, a formula, a format ID and a style ID.
  • Row and column IDs are stable. Formulas store refs by ID, like AG Grid (REF(COLUMN("c7"),ROW("r42"))). A1 and R1C1 exist only in the editor and in import and export. So refs stay valid when rows and columns move.
  • Multiple sheets. Cross-sheet refs. Named ranges.
  • Frozen panes are pinned rows and columns.
  • Merged cells: a merge map that the render layer and the selection model read. This is different from cell spanning, which is computed from values.

8.2 Formatting and data tools (decision 24)

  • Number formats in Excel format-code syntax (#,##0.00, 0%, yyyy-mm-dd). One parser and formatter in sheet/src/format/, with Intl for locale.
  • Cell styles: font weight, italic, color, fill, borders, alignment, wrap.
  • Conditional formatting: value rules, color scales, data bars, formula rules.
  • Data validation: list, range, formula. Invalid input shows a note.
  • Notes (comments) on cells. Find and replace.

8.3 Formula engine (decision 21)

interface FormulaEngine {
  load(doc: SheetDoc): Promise<void>
  apply(ops: SheetOp[]): Promise<CellChange[]> // returns changed computed values
  evaluate(sheet: string, formula: string): Promise<unknown>
  functions(): FunctionInfo[] // for the formula bar help
}
  • The engine runs in a Web Worker on the client. The grid never waits for it on the main thread.
  • formula-ironcalc: IronCalc WASM in the worker, and the IronCalc Node or Python binding on the server. The same engine on both sides gives the same results (the Google Sheets lesson).
  • formula-hyperformula: optional, GPL. The app owns the license.
  • A shared formula conformance suite runs each adapter on the same sheets.
  • IronCalc stores A1 formulas. The adapter converts ID refs to A1 for the engine and back. Spike S5 checks the cost.

8.4 Server model and collaboration (decisions 22 and 23)

  • The server keeps an op log for each sheet document. Each op has a document sequence number.
  • The client sends ops with the last sequence it saw. The server orders them, transforms conflicts, runs the engine, stores the result and sends the ops and the computed changes to all clients.
  • The client applies its own ops at once (optimistic). It runs the engine locally for the display. When the server ops arrive, it rebases its pending ops on them.
  • Conflict rules (OT on the server): edits on a deleted row drop; two edits on one cell keep the last in server order; row and column insert and delete shift ranges and merges. Refs do not shift, because they are IDs.
  • Presence: each user has a color, a cursor cell and a selection range. Other users see them as outlines with a name label. Presence goes over the same socket, is not stored, and expires.
  • Live "who edits this cell" lock hint: a soft lock while a user is in edit mode.
  • Snapshots every N ops for fast load. Version history from the op log.
  • The same op log runs for plain grids too: row transactions from many users.
  • Collab packages: @ember-lattice/collab (client) and the op log server in each server package.

8.5 XLSX (decision 24)

  • Import and export with formulas, formats, styles, merges, frozen panes and multiple sheets.
  • First choice: IronCalc's xlsx reader and writer, because the engine is already loaded. Fallback: SheetJS CE 0.20.3 from cdn.sheetjs.com (Apache-2.0). ExcelJS is not used: its last release was 2023.
  • CSV import and export for all surfaces. PDF export through a print stylesheet plus an optional PDF writer (spike S9).

10. Bench integration

Tool Use
Joinery Tokens, themes, styles; primitives for menus, popovers, anchor, focus, resize; qp. Its data-table moves onto Lattice (M12).
Formwright Cell editors, row and popup edit, validation, model adapters.
Switchyard Edit, block load, drag and resize machines; announcer.
real-enums Enum column type: order, labels, icons, set filter options.
Millwork Column types from codecs. Lattice adds compare and format. Ask the Millwork plan to add an optional compare to the codec contract.
harnessed @ember-lattice/test-support harnesses. Add scroll and drag helpers to harnessed core.
Jig A story for every surface, feature and preset. msw mocks for the server row model.
Marquetry A catalog entry for each surface, so a model can stream a Lattice grid.

User interface and prior art

15. Docs and demos (decision 30)

  • Kolay docs-app at joegaudet.com/ember-lattice/. Every example on a page is a tested example.
  • Sections: Start; Surfaces (Grid, List, Board, Sheet); Columns; Rows; Data (row models, data sources, protocol, server packages for Node, Rails, Python); State and views; Editing; Sheet and formulas; Collaboration; Styles; Accessibility; Performance; Migrate from AG Grid; Migrate from Joinery data-table; Parity matrix; API.
  • Jig: one story for each surface, feature and preset, with play functions.
  • Live demos, in the guide under demos/ (ADR 0025):
    1. "Every collection": one data set as a list, a table, a board and a sheet. One switch.
    2. 1M-row grid with server group, pivot and live ticking.
    3. Infinite feed with two-way load.
    4. Collaborative sheet: open it in two windows, see cursors and formulas.
    5. Kanban board with drag to change status.
  • The demos run fully in the browser, with no hosted server (ADR 0025). The demo server is the real protocol code (parseRowsRequest and evaluate) in a Web Worker, with latency. The collaborative sheet uses the real createDocServer in a SharedWorker, so two windows of one browser share it. A hosted Rails demo server stays a later option (open question 6).

16. Marketing site update

The Workbench page is in the wt-site-workbench worktree, branch feat/joe/ember-workbench. That branch has not merged into joegaudet.github.io yet, so make these changes on top of it. The angle is "One grid for every collection" (decision 29).

16.1 Now: bench card

  1. In _tests/tools.mjs, add this entry after ember-joinery:
    { id: 'ember-lattice', name: 'Lattice', group: 'forms', status: 'bench', links: {} },
    
  2. In ember-workbench/index.html, add a Lattice card in the "Components and forms" group (after the Formwright card, near line 422). Proposed copy: "One grid for every collection. Lists, feeds, tables, boards and spreadsheets from one Ember engine, with AG Grid's full feature set under MIT." Add the card note: "Not released yet. The docs, code and package come with 1.0." No links while the status is bench.
  3. Add --ember-lattice tint colors in ember-workbench/site.css, in the light block, the dark media block and the dark data-theme block (near lines 16, 41 and 62).
  4. Add a logo at ember-workbench/images/logos/ember-lattice.svg (crossed strips), and a link in the logo strip near line 200.
  5. Update the stack diagram:
    • The <desc> near line 260 names the tools for each layer. Add "data views are Lattice".
    • Add a Lattice row in the components layer of the wide SVG (near line 272) and the narrow SVG (near line 323).
  6. Update the "One layer each, one bench" copy near line 251. Proposed: "Components hold two: Joinery gives the parts, and Lattice shows every collection."
  7. Add "Lattice" to the JSON-LD tool list near line 105 and to the meta description at line 9.
  8. Add a card source ember-workbench/_src/lattice-card.html and a tool image ember-workbench/_src/tools/ember-lattice.png. Run ember-workbench/_src/render-cards.sh.
  9. Run the gates in _tests/: npm test, npm run links, npm run lighthouse (95 or more), npm run screenshots. Check the screenshots in light, dark, desktop and phone.

16.2 At each 0.x release

  • Keep the status bench until 1.0. In the card note, name the last 0.x and what it has, for example "0.4: server row models".

16.3 At 1.0

  1. In tools.mjs, set status: 'shipped' and add docs, github and npm links.
  2. Add the links to the card, and add the npm install line to the "Stock the bench" section.
  3. Add /ember-lattice/ to sitemap.xml. Add Lattice to the open source section of the homepage index.html.
  4. Publish the docs site at joegaudet.com/ember-lattice/.
  5. Add cross-links from the Joinery, Formwright, Switchyard, real-enums and Millwork docs and READMEs, and back.
  6. Launch posts: "One grid for every collection" (the angle), "AG Grid Enterprise features, MIT, for Ember" (the parity matrix), "A collaborative spreadsheet in Ember" (the sheet demo).

Requirements

9. Performance gates (decision 25)

The private bench package runs Playwright with Chrome tracing on fixed fixtures. CI runs it on one runner type and compares each run with the stored baseline. A miss of more than 10% fails the build.

"Decided" gates come from answer 25. "Proposed" gates are new in this plan and need approval.

Gate Target Status
First render, 50k rows × 20 columns, client model < 100 ms after data is ready decided
Scroll, 1M rows × 200 columns, gts cells in 20 columns 60 fps, no long task > 50 ms decided
Live updates, viewport model 1,000 row updates a second, no dropped frames decided
Sort 1M rows (worker) < 500 ms proposed
Group and aggregate 1M rows (worker) < 800 ms proposed
Sheet recalc, 100k formula cells, one input change < 300 ms in the worker, UI never blocks; < 100 ms after upstream incremental recalc decided
Memory, 1M rows < 2× the size of the raw data proposed
Bundle, core + virtual + ember (gzip) < 60 KB proposed

Benchmarks also run against AG Grid Community on the same fixtures. The docs show both.


13. AG Grid parity matrix

The docs keep a matrix with one row for each AG Grid module (83 Community, 59 Enterprise, from the 36.3.0 tarballs). Each row names the Lattice feature, the milestone, and a link to its test and docs page. CI fails if a row says "done" and has no test link. 1.0 needs every row done, or marked "not applicable" with a reason (for example the AG Grid AI toolkit, which Marquetry covers).


14. Tests and quality gates

  • TDD for every behavior (write the test, see it fail, then implement).
  • The port: port the TanStack test files first. They must fail on an empty Lattice, then pass.
  • Unit tests: QUnit in test-app for Ember code; Vitest for protocol and formula.
  • Harness tests: harnessed GridHarness and others, run under QUnit and Playwright.
  • Every test ends with an axe audit.
  • Property-based tests (fast-check) for the row model pipeline, the protocol translator, OT and the fill handle.
  • Server conformance suites: protocol and formula. Each server package runs them in its own CI (Node, Ruby, Python).
  • Visual tests: Jig snapshots for each preset in light, dark and high contrast, LTR and RTL.
  • Gate (from the template): format:check, build, lint, typecheck, test, docs-app tests, test:examples, bench, plus bundle exec rspec and pytest for the server packages.

Data model and API changes

Not recorded in the original plan.

Security and permissions

Not recorded in the original plan.

Observability and success metrics

Not recorded in the original plan.

Rollout and migration

Not recorded in the original plan.

Work items

12. Milestones

Each milestone is a public 0.x release (decision 3). Some tracks run at the same time (section 12.1).

M Release Scope Done when
M0 — Repo from the UI-library template; ruby/ and python/ folders like Benchdog; NOTICE with the TanStack MIT notice; spikes S1–S4, S10, S11; PORT_MAP.md and scripts/upstream-diff.mjs (S12); ADRs; bench harness Spikes have tests and ADRs. CI is green.
M1 0.1 Engine: port table-core 9.3.1. Port the TanStack tests first (red), then the code. All 17 features, Atom, memo, column types, both column forms. Every ported test passes. Engine perf gates pass (in Node or the browser, as spike S1 found).
M2 0.2 Virtual port; Grid surface; row recycling; cell paths; header groups; pin; resize; reorder (pointer drag); keyboard; ARIA; theme presets; harnesses. A 1M-row client grid passes the scroll gate. Axe and keyboard tests pass.
M3 0.3 List surface: variable height, masonry, card grid, two-way load with anchor; Board surface with drag between lanes. Harness tests for each; scroll anchor stays fixed on prepend.
M4 0.4 data: DataSource, infinite, server, viewport row models; block machines; transactions; protocol with JSON Schema and conformance suite; data-fetch, data-warp-drive, data-graphql, data-ag-grid; @ember-lattice/server (Node). Node server passes conformance. Live update gate passes.
M5 0.5 State and views: StateStore, URL, local and server stores, saved views, migrations. Reload restores every state key.
M6 0.6 Editing: Formwright editors, edit machine, row, popup and batch edit, undo and redo, range selection, clipboard, fill handle. Edit flows pass with harnessed; axe passes in edit mode.
M7 0.7 Grid UI and big features: column menu, context menu, side bar, tool panels, all filters, advanced filter builder, status bar, toolbar, find, notes, row numbers, pivot, tree data, master/detail, full-width rows, row drag between grids, calculated columns. AG Grid feature matrix rows for these are green (section 13).
M8 0.8 Export and charts: CSV, XLSX, PDF; sparklines; integrated charts. Round trip tests for CSV and XLSX.
M9 0.9 gem lattice-grid and PyPI lattice-grid. Can start after M4. Both pass the protocol conformance suite.
M10 0.10 Sheet: model, formula seam, IronCalc in a worker, formats, styles, merges, conditional formats, validation, notes, named ranges, sheet tabs, formula bar, XLSX with formulas. Formula conformance suite passes. Sheet recalc gate passes.
M11 0.11 Collaboration: op log servers (Node, Rails, Python), client rebase, presence, cursors, soft locks, snapshots, version history. Property tests with 10 random clients converge.
M12 1.0 Joinery data-table rebuilt on Lattice; Marquetry catalog; all perf gates; screen-reader pass; docs site; Jig stories; live demos; release with oss-release. Parity matrix is fully green. Site is live. Packages are on npm, RubyGems and PyPI.

12.1 Parallel tracks

When agents work as a team, each track owns its own packages. No two tracks edit the same file.

Track Packages Starts after
Engine core M0
Render virtual, ember, theme M0 (virtual), M1 (ember)
Data data, protocol, data-*, server M1
Server ports ruby/, python/ M4 protocol freeze
UI ui, export, charts M2
Editing editing, state M2
Sheet sheet, formula*, collab M6
Docs docs-app, Jig stories, site M2, then each milestone

Future work and research

Not recorded in the original plan.

Alternatives considered

2. Decisions (from the 30 answers)

# Topic Decision
1 Name Lattice. A lattice is a grid of crossed wood strips.
2 License All MIT, every feature. No paid tier.
3 Release Public 0.x release for each milestone. 1.0 at AG Grid parity.
4 Site group "Components and forms", beside Joinery and Formwright.
5 TanStack No dependency on TanStack. Lattice is written fully in Ember.
6 Rendering Virtualized DOM in 1.0. A renderer seam so a canvas renderer can come after 1.0.
7 Styles Joinery tokens, themes and styles, plus grid presets (density, borders, zebra, sheet).
8 Ember floor ember-source >= 6.12, gts, Embroider and Vite only.
9 Port depth Port the table-core and virtual-core source into Ember-native code. Keep the TanStack MIT notice in NOTICE.
10 API shape Ember-first (classes, decorators, gts components). Keep TanStack words where they fit.
11 Joinery data-table Rebuild it on Lattice when the Lattice engine is stable. One engine on the bench.
12 Core Ember all the way down. Only the wire protocol is plain TypeScript, so servers can share it.
13 Row models All four in 1.0: client, infinite, server, viewport.
14 Data sources One DataSource interface plus adapters.
15 Server packages Protocol spec and types, a Rails gem, a Node package and a Python package.
16 Protocol A Lattice protocol, plus a translator to and from the AG Grid SSRM shape.
17 Persistence URL, localStorage and server saved views, all behind one StateStore interface.
18 Lists Variable-height rows, masonry and card grids, boards, and infinite load in two directions.
19 Editing Formwright controls are the cell editors. Row and popup edit use Formwright forms.
20 Switchyard Machines drive interaction states. Scroll and cell render stay plain tracked code.
21 Formulas A FormulaEngine interface. IronCalc (MIT, WASM) is the first adapter. A HyperFormula adapter is an optional GPL peer.
22 Sheet truth A server-authoritative op log. The client runs the same engine for optimistic display.
23 Collaboration Full collaboration in 1.0: presence, cursors, selections and conflict handling. (The answer was "presence and the whole mess". This plan reads it as full collaboration.)
24 Sheet scope Core sheet, formatting, data tools and XLSX import and export, all in 1.0.
25 Performance AG Grid-class release gates (section 9).
26 Cells Any gts component as a cell. Rows are recycled. A light format path for plain cells.
27 Grid UI Menus and panels, all filters, export and charts, master/detail, tree data and pivot. All in 1.0.
28 A11y and i18n WAI-ARIA grid and treegrid patterns, full keyboard, screen-reader tests, axe in every test, RTL, i18n.
29 Marketing Lead with "One grid for every collection".
30 Docs Kolay docs-app, Jig stories and hosted live demos (with a real server).

Risks

11. Risks and spikes

Each spike starts with a failing test (TDD rule). The result goes in an ADR in the repo.

# Spike Why Fix (the plan of record) If the fix fails
S1 Atom on @tracked vs tracked() on 7.4; tag cost for 1M rows The engine depends on cheap reads. One tag per row (row.version), not one per cell. Engine tests run in Vitest browser mode with Playwright, so "can core run in Node" does not block work. Fewer atoms, coarser tags, or a 7.4 floor for the engine only. Ask before you move the floor.
S2 Row recycling: cost and correctness Slots keyed by position can leak component state between rows (decision 26). (a) Two cell kinds: "cheap" cells reuse row slots; "full" cells (components with state) are keyed by row ID. Dev mode warns when a cheap cell component has @tracked fields. (b) cell.state: a store keyed by row ID and column ID that cell components use for their state. (c) The focused row and the edited row keep their slot (sticky slots, ADR 0002 amendment 1), so their element, focus and state stay when they scroll out of the range. (d) Editors render in an overlay, tied to the cell with Joinery anchor positioning. The Formwright draft lives in the edit machine. (e) A recycling contract suite runs against every built-in cell type, and third-party cells can run it too. Key all rows by row ID with a larger overscan, plus the held layer from (c). Keyed rows alone lose focus and the editor when the row leaves the range (ADR 0002).
S3 Height above the browser element cap 1M rows at 32 px is near the Chrome cap and over the Firefox cap. A safe cap of 10M px, tested in CI in Chrome, Firefox and Safari. Above the cap, scaled scroll: map the virtual offset to scrollTop with a ratio. Wheel, keyboard and touch input move in virtual space. A "row N of M" hint shows during a scrollbar drag. The docs recommend the server model above about 1M rows. Paged virtual scroll (a jump list).
S4 Pinned columns with column virtualization, RTL, sticky groups Hard layout cases. One scroll container with position: sticky (as AG Grid v36). CSS logical properties (inset-inline-start), so RTL needs no extra code. Separate pinned containers with synced scroll.
S5 IronCalc in a worker: WASM size, load time, function coverage IronCalc is "very early". Done (ADR 0006). 176 of 178 common functions are present (missing: AGGREGATE, GETPIVOTDATA). 99.81% of 71,661 formula cells match Excel. 725 KB gzip, loads in a worker. The host cannot register functions, so missing functions go upstream in Rust (no formula.js layer). IronCalc recalculates every formula on each edit and returns no changed-cell list: the adapter reads the visible range again after each recalc. HyperFormula for apps that can license it, or a Lattice engine (big).
S6 IronCalc on the server (Rails, Python) No Ruby binding is known. Done (ADR 0007). IronCalc builds for wasm32-wasip1 with no source change. One .wasm file gives identical results (same f64 bits) in node:wasi, wasmtime-py and the wasmtime gem. Cache the compiled module (5.4 ms load). Not needed: the native gem and the Node calc service stay as fallbacks only.
S7 Conflict handling for sheet ops with merges and formulas Collaboration correctness. Everything is ID-based: cells, refs, range ends, merges. A row insert or delete then shifts nothing. Two conflicts remain: two writes to one cell (the last write in server order wins), and an edit to a deleted row (drop it and tell the user). Property tests with fast-check and 10 random clients. Narrow the op set.
S8 Screen readers on a virtual grid of 1M rows A11y bar. aria-rowcount and aria-rowindex. No announcements on scroll. VoiceOver and NVDA tests automated with Guidepup in CI. Manual screen-reader runs before each minor release.
S9 PDF export without a heavy dependency AG Grid has it as E. A print stylesheet first. An optional writer, pdf-lib (MIT), that loads on demand. Print stylesheet only in 1.0.
S10 Joinery not on npm Lattice depends on it. Closed 2026-12-01: @ember-joinery/* 1.0.1 is on npm. Lattice installs it from npm. —
S11 Stable perf numbers in CI Shared runners vary. Run Lattice and AG Grid in the same CI job on the same fixtures. Compare ratios, not absolute times. Use the median of 5 runs, fixed CPU throttling, and counts of long tasks. A self-hosted runner.
S12 Changes in TanStack after the port The port copies table-core 9.3.1 and virtual-core 3.19.16. Upstream fixes do not come by themselves. PORT_MAP.md maps each ported file to its TanStack source and version. scripts/upstream-diff.mjs shows the upstream diff for those files at each TanStack release. Port only the fixes you need. —
S13 Page CSS cost under the grid In the test app, Joinery and Formwright CSS (about 1,400 rules, 36 with :has()) made each grid layout about 6× slower than the Lattice CSS alone. Measure in the bench with and without Joinery CSS. Report the :has() rules to Joinery, with a trace. Use contain on the grid root if it helps after the upstream fix. Document the cost and a scoped Joinery import.

Open questions

  1. Column source of truth. Is the class with @column the main form, with the object form for Marquetry and views? Or are the two equal, with a test that they make the same definition? (Same question as Millwork open question 1.)
  2. Harness base. Joinery and Formwright use their own synchronous harness base. Lattice plans harnessed. Does the Joinery data-table harness move to harnessed at M12?
  3. Millwork compare. Add an optional compare and format to the Millwork codec contract, or keep them only in Lattice column types?
  4. IronCalc maturity. If spike S5 finds gaps in function coverage, do we contribute to IronCalc upstream, or start a Lattice engine?
  5. Rails formula engine. If spike S6 fails, is a Node sidecar for the Rails gem acceptable?
  6. Demo hosting. Deferred 2026-12-02 (ADR 0025): the demos run in the browser and need no host. A hosted Rails demo server, so users on two computers can share a sheet, needs a host and a budget from the maintainer.
  7. Floor for the engine. If spike S1 shows that tracked() (7.4) is much faster, is a 7.4 floor acceptable for 1.0, with 6.12 on a slower path?
  8. Sheet recalc gate. Decided 2026-12-01: the gate is "the UI never blocks" and recalc < 300 ms at 100k formula cells in the worker, with a busy hint. Then add dependency-based recalc to IronCalc upstream (Rust) and tighten the gate to < 100 ms.

Interview record

Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.

QuestionAnswerSource
Where does the text of this page come from?From the Markdown file docs/plan.md at commit 4c77ac4. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so.Document: docs/plan.md

Changelog

DateAuthorChange
2026-12-03Joe GaudetCommit 7ce4af2: Lattice 1.0 (#1)
2026-12-04Joe Gaudet (agent)Converted from docs/plan.md to this page. The text is the text of the Markdown file.
2026-12-04Joe Gaudet (agent)Status Shipped: version 1.0.0 of the Lattice packages is on npm (@ember-lattice/core 1.0.0, tag v1.0.0). The Markdown file says "M0 in progress" (2026-12-01).

The prd skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.