Lab Parables
A Lab Parable is a Parable whose app is an imported React package, called a Lab. It exists for teams that already have a React app, or need full control of their screens: they upload the app as one ZIP instead of rebuilding it from Pages and Panes. Parable supplies React, the shared design system, the reader’s Workspace data, and the publishing lifecycle, so the app reaches customer Workspaces with the same review and access checks as any other Parable. In Staff Settings, a Lab’s Pieces are Custom. Pieces, Progress and Publisher are separate choices: a Custom Parable does not need to be a Prototype, and it does not need Parable Pros as its Publisher. Code Pieces are the same app package without the Custom rules: any file type, and the entry file is optional. The ZIP holds the app’s code, pages, styles, and assets; an app with twenty pages is still one package. Its entry file, src/App.tsx or App.tsx (or the .jsx equivalents), exports a React component, and Parable mounts it, so the app never creates its own React root. Another entry path needs a parable.lab.json file at the ZIP root that names it. Leave out node_modules, React, the design system, .env files, and .git. Import never runs install or build scripts, so any extra browser library must already be bundled into the app’s files. The app reads data with the query function from the parable module, which runs SQL in the reader’s Workspace: Provider tables are namedproviders.<connector>.<table> and published Artifacts are named artifacts.<table>. The Parable’s own data files are tables at artifacts.parable_<parable>.<table> (see the Artifacts Power). The app lists, reads and adds the Parable’s files with files from the parable module, as Pane code does (see the Panes Power). The Workspace’s files reach the app only under that Power’s rules for them, and never a file that holds a Provider’s data. Values go in as bound parameters, never pasted into the SQL text. A reader with a Peeking seat cannot read Provider or Artifact tables with query, so readers get data through the Plots that parable.lab.json declares: readPlot(“capacity”) returns that Plot’s rows, and query over plotTable(“capacity”) filters it with bound parameters, as in SELECT * FROM ${plotTable("capacity")} WHERE team = $1. Both refuse a slug that parable.lab.json does not declare. The app holds no credentials, database connections, or Provider SDKs, and it cannot choose another Workspace or person. Shared controls import from parable/panes/placeholders; the host also supplies Motion, Kysely, scalar-lib, and D3.
SQL that the app runs reads every pool only for a person who holds Publishing or Primary on the Parable. A reader who holds Pinging or Peeking, such as a Viewer, runs SQL in a Parable only over its Plots, so app SQL that names providers., artifacts. or workspace. gets a refusal for that reader. Declare that SQL as Plots: put each query in its own .sql file in the ZIP, and list it under plots in parable.lab.json with a slug, a name and the file path in sql. The import keeps each one as a Plot on the Lab’s data Pane, a Pane that draws nothing. The app then reads the Plot with readPlot, or with query over plotTable, and every reader with a seat can run that read. A Plot’s rows, its Artifact and Workspace rows included, show to every reader with a seat. A Plot returns text, numbers, true or false, JSON, and lists or objects of them, and it takes no parameters: filter its rows in the app’s own SQL over plotTable with bound parameters. The import confirmation names each line of app source whose SQL names one of those pools. A warning does not block the import. A Plot whose SQL check did not finish at import, as when the Query Layer was not ready, is checked again on an editor’s next read.
The rules that matter: a Lab has no structured Pieces or Preferences that it draws, so filters and navigation live in React state and navigation stays inside the app. The one way out to another Parable is parables.open(id) from the parable module, with the Parable’s workspace.parables.id: it opens that Parable in the same tab, from a click or key press only, and refuses a Parable the reader cannot open. parables.preview(id) answers that Parable’s card image as a data: URL for an img, or null when it has none. Query results are displayed in the app; a Lab does not save them as Reports. The Publisher, Pieces and package controls each have separate view and modify permissions, and reading a deployed Lab needs none of them. Only Parable staff change Publisher, Progress and Pieces. A reader without Ponder permission or the Lab package view permission, such as a Viewer, sees the app alone, with no Files and no People. A Lab opens with Ponder’s column hidden. The app runs in the reader’s browser. With Custom Pieces, every file in the ZIP reaches that browser, data files included. With Code Pieces, a reader without Ponder permission or the package view permission gets only the entry file and the files that it imports. In both cases, keep private data out of the ZIP and read it through Plots. Every query still passes the reader’s Workspace access and data checks. Each destination Workspace needs its own Provider connections or Artifacts, because deploying does not copy data. A package is limited to 64 MiB compressed, 256 MiB expanded, 16 MiB per file, and 20,000 entries; symlinks, path traversal, and colliding paths are refused. A Custom Parable with app files cannot become Composed; start from an empty Parable for that. Custom can always become Code. With the Pools permission off, app SQL that reads a Provider Pool fails, and the import warns about it.
- Open a new or empty Parable, open Staff Settings, set Pieces to Custom, choose Import App Package, and upload the ZIP. Set Progress to Prototype while the app is not ready, and set Publisher to Parable Pros only when Parable Pros built the app.
- Before writing queries, ask Ponder to discover the exact table and column names in the Workspace’s data catalog. Read current rows from the whole table where _parable_deleted is false and _parable_observed is true; the latest dt holds only that day’s changed rows. Each row of a table of records is the current state of one record, so do not deduplicate it by its key. There is no sync-time column. The Providers Power names the system columns and the event tables that can hold an event more than once.
- Preview the app as an active member of the target Workspace so its queries return that Workspace’s data.
- In a Personal Parable, the import saves directly. In Publishing, the upload opens or selects your pending Changes: preview, propose the Changes, publish a Version, and deploy it. In Publishing, a Lab also needs a description to publish. The package does not carry it, so ask Ponder to write it. A Lab does not need a preview to publish. It gets a card picture by itself (see step 7 of the Pages Power).
- To update the app, change the files locally and use the upload icon beside Staff Settings to import a replacement ZIP. Parable replaces the whole package. A Plot keeps its slug across imports: a changed .sql file or name updates the Plot, and a Plot that parable.lab.json no longer lists is deleted. In Publishing, pending Changes do not replace the published app; readers receive the replacement after publication and delivery.
- If an import fails, the previous package stays in place. Fix the file or import named in the error and upload again.
providers., artifacts., or workspace. tables. A reader with a Peeking seat gets a refusal there, because a reader’s SQL in a Parable reads only that Parable’s Plots. Resolve each warning:
- Move the SQL into
plots/<slug>.sqland declare that file in the Plot declarations with its slug and name. - Replace the call with
readPlot(slug). When the app filters the rows with bound parameters, keepquery()and read fromplotTable(slug)in its SQL. - Plan the edit again. Do this until no warning is left.
- Apply the edit with the plan’s base version as expectedVersion and its plan digest. If apply refuses because the Lab or the plan changed, plan again. In Publishing, pass the proposalId of your own open Changes.