Skip to main content

Sources

Docs: Panes, Perceptions, Preferences, Plots, and Policies. Web App: Each Piece’s editor lists its Warnings & Errors under the code, and the Publish action stays off until none is left.

Structure

Warnings & Errors are what the checks find in a Piece: the compile, the type check, the Code check (React rules and classes that nothing styles), a Plot’s SQL check, and the Parable rules on this page. Every Parable rule is an error. The placement notes and the Page note at the end of this page are info. Each finding names its rule, such as parable(versioned-removed), says what is wrong and what to write instead, and links to its section below. The rules keep every Parable on one model:
  • A Pane has one type. The type is what the Pane shows and what people save on it.
  • People save values as rows of that type, one row for each item and each person, team, Workspace or default.
  • Values that the Parable owns are the Pane’s own data, and only a proposal changes them.
  • Links between items are typed references, and the platform checks them.

When the rules run

  • Save. A save is refused when it adds a finding. A Parable that still holds an older pattern keeps saving each step that removes it. An archive import is a save: it is refused for a finding it adds, with the same message. A save also waits up to 30 seconds for the Code check of the code it writes, and its answer holds the findings. A save that sets lintInBackground starts the Code check and does not wait for it. Its answer shows the check as pending, and a later read holds the findings. Ponder’s sketch tool saves this way.
  • Prepare and Publish. They are refused while any finding is left, even one that the last Release already held. A small change also removes every older pattern.
  • Reading. Opening a Piece shows the findings of the tree it reads. The server judges each tree once and keeps the findings, so a read of the same tree does not run the checks again.

When Publish refuses

Publish is refused with PA-AU-076 while a Page, Pane or Plot in the Changes has a warning or an error. A warning blocks Publish as an error does. Info findings do not block. The refusal holds what an agent needs to fix the Changes without the editor:
  • details.pieces names each Piece with its counts, and details.pieceKeys gives the key of each Piece at the same index.
  • details.findings lists the first findings of each Piece, errors first. It holds at most 5 findings for each Piece and 20 in all. In these limits, the list takes the errors of every Piece before it takes a warning. Each finding has its Piece (entityKey, kind, handle), severity, rule, message, line, column and, when the rule has a page that teaches it, docsUrl.
  • details.findingsLeftOut counts the errors and warnings that the list does not hold.
  • The sentence names the same findings, each with its line. It cuts a message after 300 characters. details.findings keeps each whole message.
Publish also waits for each Code check. It waits up to 30 seconds for a check that has not answered. If the check still runs after that, Publish is refused. The sentence and details.checking name each Piece that is still being checked. Open the Piece to see its Warnings & Errors when the check ends, then publish again. A check that could not finish is named in details.unchecked. Publish checks it again after one minute. A Piece that holds more than the check can read is named in details.tooLarge, and it blocks Publish. This is the check’s own safety stop, not a size to design to. In Ponder, Publish is off while a Piece in the Changes has a warning or an error, or a check that could not finish or a Piece too large to check. The reason on Publish names each Piece. Publish is also off until Ponder has read the Warnings & Errors of all the Changes. The first read after Ponder opens holds one Page only, and it has no Warnings & Errors. To read every finding of one Piece, with the exact text and revision that an edit needs, use Read a Piece’s problems (read_piece_problems in Ponder and MCP). Through the API, send:
With proposalId, the route answers the author of the Changes and a person who shares their Problem. Any other publisher gets PA-AU-001 there and fixes from details.findings. Leave out proposalId to read the Parable’s own content. Opening a composed Parable starts missing Page and Pane Code checks in the background. An import also starts these checks after it saves the Pieces. A pending check has no answer yet. A complete check carries the findings, including an empty list when it finds none. A failed check gives its reason. Read again to get the result of a pending check. Changed code starts a new check immediately. Unchanged code can retry a failed check after one minute. The server refuses the same things at run time, so the checks and the server never disagree: a value above 64 KB, raw JSON, a link to an item that does not exist, a row whose id differs from its value’s id, and a customer’s write of a Platform Parable’s defaults, data or Pieces.

Code check rules

unstyled-class

Rule: better-tailwindcss(no-unknown-classes). Finds: a class that neither the shared stylesheet nor a Palette of this Parable styles. Each warning names the class and its source position. Why: the sandbox builds utilities from the design system’s sources. It does not compile new Tailwind classes from a Pane’s code. A valid Tailwind class can still have no rule in the sandbox. Write instead: define the class in a Palette, or remove it. Use the shared controls’ props for their variants. A class the shared stylesheet already holds needs no Palette rule. The check also accepts Font Awesome classes and the group and peer markers. For example, w-[137.5px] gets a warning when the sandbox has no rule for it. Define a named class in the Palette instead:
Then give the Pane element className="preview-column". The next Code check reads the Palette and removes that warning.

Perception rules

These rules read a Page’s or Pane’s Perception.

versioned-removed

Finds: Versioned<T> or Versioned<PlotSql> in a Perception. Why: a Pane could change the Parable itself by saving a value, outside the review that every other change gets. A Pane that uses Versioned<> gets only this finding, so two rules never send you two ways. Write instead:
  • If the Parable owns the value, such as an ontology or a list of Provider descriptions, declare it as the Pane’s data and change it with propose.change(...).
  • If each person or Workspace sets the value, make it rows of a saved-data Pane.
  • For Plot SQL, propose a change to the Plot.
A setting save on such a Pane. On a Parable in Published Versions, a shared save or removal of the Pane’s setting is refused at once with PA-AU-076. The person reads “This setting is in an old-style Pane. Ask Ponder to convert the Pane, then save again.” The save opens no Patch. On a Personal Parable the save still saves.

live-wrapper

Finds: Live<T> in a Perception. Why: every Preference is Live now, so the wrapper says nothing. Write instead: remove the Live<> wrapper.

one-type

Finds: a preferences field in a Perception, also readonly preferences: null. Why: a Pane saves rows of its own type. A second type for saved values splits one thing into two shapes that nothing keeps in step. Write instead:
  • For readonly preferences: null, remove the field and add | null to the Pane’s type, as in BasePerception<Meeting | null>. The field let the Pane draw with no value from its parent, and | null keeps that. The Plots that the Pane owns still return rows of its type.
  • If preferences is the same type as the Pane’s type, remove the field.
  • If the Parable owns the saved value, declare it as the Pane’s data.
  • If each person or Workspace sets it, move it into its own saved-data Pane, and read that Pane with panes.<name>.preferences.get(id).

no-raw-json

Finds: a field of a Pane’s type, or of its data, that is raw JSON: Generic.JSON, unknown, any, or Readonly<Record<string, T>>. Why: nothing can check raw JSON, Plots cannot read it as columns, and a change of its shape breaks saved values without a warning. Write instead: give the field a real type: a scalar-lib type, a Ref<T>, a named interface, or a list of those. If it holds many items, make them rows of a Pane, keyed by an id field.

bound-field

Finds: a bound Pane whose field is missing from its parent’s type, has a different type, or is bound twice. Why: a bound Pane takes one field of its parent’s row as its value (props.value). The field must exist, with the bound Pane’s type, and feed one Pane. Write instead: bind the Pane to a field that the parent’s type has, with the same type, once:

bound-once

Finds: a Pane that two Panes bind, each with Bound<>. Why: a bound Pane uses the Policies of the one Pane that binds it. Two parents would give it two sets of Policies, and a reader that one parent refuses could read the field through the other. Write instead: bind the Pane from one Pane only. If two Panes need the same kind of field, give each parent a bound Pane of its own.

bound-policy

Finds: a bound Pane whose Policies differ from the defaults that a new Pane gets. Why: a bound Pane uses its parent’s Policies and never reads its own. Policies of its own would look like protection that does not apply. A bound Pane cannot narrow its parent’s Policies yet. Write instead: reset the bound Pane’s Policies to the defaults, and set who may see and change the field on the parent Pane.

primitive-renamed

Finds: a Perception that still declares readonly primitive: .... Why: the Perception field is now type. extends BasePerception<T> already declares type: T. Write instead: remove the primitive line, and put the type in BasePerception<T>.

Policy rules

setting-item-id

Finds: a Policy that reads a row by a legacy handle: fromSetting: { paneKey, handle } or enabledFromSetting: { paneKey, handle }. Why: Typed Panes name each row by its item id. The row conversion keeps a single value’s handle as its item id, but a value that held a list of items becomes one row for each item, so the handle names no row any more. The Policy would fall back to its own grant without a word. Write instead: name the row by its item id:

Pane code rules

The Code check runs these rules on a Page’s or Pane’s code.

values-api

Finds: a read of preferences.values, preferences.mode or preferences.plotSql, on the Pane’s own module or on a module of a Pane it declares. Why: preferences.values saved one whole value under a handle, outside the Pane’s type, and the modes are gone. Write instead:
  • To show a value, use preferences.get(id), or the preferences.useItem(id) hook. The value is already layered for the reader.
  • To edit one actor’s value, read it with preferences.get(id, { for }) and save it with preferences.save({ id, value, for }), where for is 'me', 'group:<id>', 'workspace' or 'default'.
  • To change a Plot’s SQL, propose it with propose.change(plot, { sql }, { expectedRevision }).

data-in-code

Finds: one literal of data above 8 KB in a Page’s or Pane’s code, such as a long list of objects or a long string. Why: the checks cannot see data in code, and nobody can change or customize it without changing the code. Write instead: move the data into the Pane’s data with a proposal, or into Preference rows if each actor needs a copy of their own.

module-at-load

Finds: a read of a declared Pane’s module that runs while this Pane’s code loads. The rule follows top-level code, static class members, and the functions that this code calls in the same file. It finds three forms:
  • A top-level let that only a callback on the module sets, read at load: E.value, E() or const { value } = E.
  • A member of the module itself: panes.engine.module.value.
  • React.use(panes.engine.module) outside a component.
The rule ignores a read that checks the value first, a read with ?., and a read in a try block. Why: panes.<name>.module is a Promise. A Promise calls back only after the Pane’s code has run, even when the other Pane has already loaded. So the value is empty at that line, and the Pane fails with Cannot read properties of undefined. Write instead:
  • Read the module during render:
  • For code that must run while the Pane loads, put it in the code module of a data-layer Package that holds the Pane (Packages). Import it from @parable/<parable>/<package>. That module runs before the Pane.

Plot SQL rules

These rules read a Plot’s SQL. The server’s SQL check records its own codes. PV_STMT_004 is SQL that the server cannot plan, or that Prepare’s planning pass refuses. PV_STMT_005 is a Pipeline plan too deep for query-runner, and PV_STMT_006 is one close to that limit. Plots describes them.

typed-read

Finds: Plot SQL that reads workspace.preferences. Why: workspace.preferences holds every Pane’s saved values as raw JSON, with no type. It is only for looking at values in the SQL console. Write instead: read the Pane by name.
  • parables.<parable>.<pane> returns typed rows of the Pane’s type, layered for the reader.
  • parables.<parable>.<pane>_by_actor returns each actor’s own rows, with actor_kind and actor_id, for example every team’s.
  • parables.<parable>.<pane>_data returns the Pane’s own data.

filters-in-comments

Finds: a SQL comment that starts with -- Filter:. Why: nothing checks a filter that is written in a comment, and a Policy cannot read it. Write instead: make each filter a typed row of a saved-data Pane, and read it in the SQL by name. If a Policy reads these rows, let only people who may edit Policies write them.

Data and Release rules

use-ref

Finds: a text field of a Pane’s data whose values are all ids of one Pane’s items. Why: a link that is text is not checked. A rename or a delete leaves it pointing at nothing. Write instead: make the field a typed reference, such as Ref<Concept>. A save checks that each linked item exists and that the saver can see it. The one-time row conversion checks the links of each row it converts, and fails a row whose link finds no item. This rule reads Pane data only. A text link between Preference rows is not found by it. Make such a field a Ref<T> when you rewrite the Pane, so a save and the conversion check it.

data-grants

Finds: a Pane that holds data, and whose Policies name no view.data grant. Why: a missing grant admits nobody, so nobody can read the data. When the Policies name no data grant at all, nobody can change the data either. A Pane that was converted before Convert a Versioned Pane copied the grants holds its data under such Policies. Write instead: add the data grants to the Pane’s Policies. To keep the access that the Pane’s values had before they became data, give each data grant the same grant as preferences has for that action:
Changing Policies needs edit.policies. Prepare, Publish and the Warnings & Errors view run this rule. A save does not, so a set of Changes can hold the steps that add the grants. A bound Pane uses its parent’s Policies, so this rule does not judge it.

shape-grow

Finds: a change to the type of a Pane that holds saved rows, compared with the line’s last Release, that removes, renames, retypes or narrows a field, or adds a required one. Why: saved rows were checked against the old type. A Release may only add optional fields or widen a union, so every saved row still fits. Write instead: keep the old field and add a new optional one. A union may take a new member, and a field may become optional or take | null.

saved-data-plot

Finds: a Pane that owns a Plot and has saved rows, and that does not declare overrides: true:
  • a Pane that declares preload, so it shows the rows that people save, and also owns a Plot;
  • a Pane that was a saved-data Pane in the line’s last Release and that now owns a Plot.
Why: a Pane that owns a Plot is a Plot Pane. It shows the Plot’s rows and takes no saved rows. Without this rule, a Plot that you add to a saved-data Pane makes it a Plot Pane with no warning, and every save of a row on it is refused (PA-AU-040). Write instead: move the Plot to the Package that holds the Pane, and read it from the saved-data Pane by name. That Package’s Policies then decide who reads the Plot’s rows.
  • If the Package is still a folder that owns no Plot, give it a Perception and the Policies of the Pane.
  • If it owns Plots, or already has Policies that differ from the Pane’s, leave it as it is: its Policies decide who reads its other Plots, saved rows and data. Put the Pane in a new data-layer Package inside it instead, give the new Package the Policies of the Pane, and move the Plot there.
  • If people save rows over the Plot’s rows, declare overrides: true in the Pane’s Perception instead.
The Warnings & Errors view, a save (an archive import too), Prepare and Publish run the first check. Only Prepare and Publish run the second, because it compares with the last Release.

Palette rules

These rules read a Page’s or Pane’s Palette.

shared-tokens

Finds: a Palette value that is exactly the value of a token in a shared stylesheet. A shared stylesheet is the Palette that a Platform Parable gives to every Parable at the parable.styles place (The shared stylesheet of a Platform Parable). A token is a custom property that the stylesheet sets in a :root, html or body rule. The rule compares each kind of value with the tokens of the same kind: Why: a value that you copy from a token does not change when the token changes. The Parable then keeps the old color, size or font after the Platform Parable changes its look, and it does not change with the theme. Write instead: var() of the token that the finding names:
The match is exact, because a wrong finding would block Publish with no way out. The rule compares values in one form: hex colors in lower case and in their long form, numbers without trailing zeros, units in lower case, and an alpha of 1 removed. A value that is near a token’s value is not a finding. Zero lengths, keywords such as inherit, a value inside var(), url() or a string, and the descriptors of @font-face are never findings. A custom property that a Palette sets is a definition, not a use, so a shared stylesheet does not find its own tokens. The rule applies only in a Workspace where a Platform Parable gives a shared stylesheet and is Visible. A save, an archive import too, is refused only for a value that it adds. Prepare and Publish are refused while any value remains. Each Palette’s Warnings & Errors show its findings.

Placement notes

These three findings are notes, not rules. They are info, so a save, Prepare or Publish is never refused for them. A save returns them with the other Warnings & Errors of the revision it wrote, so the author learns at once that a reader may not see a Pane.

unplaced-pane

Finds: a Pane that no Page declares, and that no Pane declared by a Page, at any depth, declares. A Parable with a Custom Page gets no note, because a Custom Page declares no Panes. Why: a reader sees a Pane only on a Page. A Pane that no Page reaches is saved, but nobody sees it. Write instead: declare the Pane in the Home Page’s Perception, or in the Perception of the Page the person named, and place it in that Page’s layout. Do both in the same save as the Pane. A Pane whose code draws nothing on every path only holds Plots, rows or code for other Pieces. Their home is a data-layer Package that holds the Panes that use them (see Packages): move each Plot there with its contract, move shared code to the Package’s module, and delete the Pane. Rows that people saved on the Pane stay on it, so keep the Pane while it holds saved rows. Until it goes, Check a Pane notes it and stays clean, because on a Page it would show an empty place.

needs-input

Finds: a Pane that is not bound and that does not draw with no value: its type does not take null, it owns no Plot, its type has no id field, and it owns no Pane data. A Pane that owns a Plot draws its Plot’s rows with no value (PARABLE-9272). The note finds such a Pane in two cases:
  • No Pane declares it, so only a Page can place it.
  • A Page, or a Pane that a Page shows, renders it with no primitive, preferenceId or value prop and no spread (PARABLE-9550). The note names that parent.
Why: a Page hands a Pane no value, and a parent that renders a Pane with no prop hands it none either. When the Page opens, such a Pane shows only “Choose a Preference or provide an input.” instead of its rows. Check a Pane counts the note as a problem. Write instead: a Pane that takes an input still draws when the Page opens: give its input a default, such as the last 12 weeks or all teams. The person can change it. Pass that value as primitive from the parent, or write the type as T | null, such as BasePerception<TicketMonth | null>, and use the default when props.primitive is null.

draws-nothing

Finds: a Pane that a Page shows, at any depth, whose code draws nothing on every path: the component it exports by default returns only null, undefined, false, an empty fragment or no value. The returns of functions inside the component do not count. A Pane whose code draws for some rows or some inputs is not found. Why: a Pane is something a person sees. On a Page, this Pane shows an empty place. Check a Pane counts it as a problem, so Ponder fixes it before it answers (PARABLE-7902). Write instead: draw what the Pane is for, with its own empty state for no rows. If the Pane only holds Plots, rows or code for other Pieces, move them to a data-layer Package that holds the Panes that use them, and take the Pane off every Page.

Page notes

These findings are notes too. They are info, so a save, Prepare or Publish is never refused for them. A save returns it with the other Warnings & Errors of the revision it wrote.

page-plot-read

Finds: Page code that reads a Plot of a Pane that the Page declares: panes.<pane>.plots.<plot>(), panes['<pane>'].plots['<plot>'](), panes.<pane>.plots.run('<plot>') or panes.<pane>.plotSource('<plot>'). The note names the Page and the Plot. When the code does not name the Plot, the note names the Pane. A Pane may read the Plots of the Panes it declares, so Pane code gets no note. Why: a Page is composition only: it holds no data and no SQL of its own. Each Plot belongs to the Pane that owns it, and that Pane renders the rows. The server checks the owning Pane’s Policies on every read of its Plot, also when a Page reads it. But rows that a Page renders are outside the Pane: moving the Pane to another Page leaves the rows behind. Write instead: render the rows in the Pane that owns the Plot, and place that Pane on the Page by its name in the Page’s Perception:
When several data Panes share a layout, put them in a layout Pane, a Pane whose type is null. Each data Pane still renders its own rows.

page-holds-content

Finds: in a Product Page’s code, anything besides boxes and the Panes the Page declares: words of its own, a control (or a box that answers an event, such as onClick), a picture, a drawing, a table, a list or another element. The note names the Page and what it holds, and quotes the words. Boxes are div, section, main, header, footer, nav, aside, article, span, a fragment and motion’s boxes, with their class names and attributes. A Pane counts by any name the code gives it, such as const Roster = panes.roster. Code the check cannot follow is never a finding. Prose, Playbook, Presentation, Probe and Custom Pages get no note. Why: a Page only arranges Panes. What a Page draws itself cannot be placed on another Page or opened alone in a chat. Write instead: put the words, the control or the drawing in the Pane it belongs to, and place that Pane on the Page: