Skip to content

Check and finalize

The lint rules Artiwright checks, and what finalize verifies before a file is handed over.

Check and finalize.md

Two steps keep bad files from reaching people: lint finds problems while the agent works, and finalize checks the real file before it’s saved.

Lint checks the document on its rendered layout, so it sees what a person would. Each finding names the slide or cell, the anchor of the shape to fix, and a suggested fix. Errors block finalize; warnings don’t.

Rule Severity What it finds
text/overflow error Text runs past the bottom of its box, or a line that doesn’t wrap runs past its side
layout/off-canvas error An element extends more than 2 px outside the slide
content/placeholder error An empty placeholder, “Click to add…” or lorem ipsum
image/distorted error A picture’s aspect ratio differs from its image by more than 2%
chart/placeholder-title error A chart title is empty or “Chart Title”
layout/overlap warn Text overlaps other text, a chart, a table or a picture, or a filled box is drawn over part of another (a panel cutting across a row of cards)
layout/sparse warn The content sits at the top and leaves more than 40% of the slide empty below it
layout/misaligned warn Matching text side by side (the same size, in boxes of the same width, such as card labels or values) starts at different heights
text/min-size warn A paragraph of 40 words or more under 18 px, body text under 14 px, or any text under 11 px
text/typed-bullet warn A paragraph starts with a typed bullet character (•, –, -, *) instead of a real bullet
copy/symbols warn Text joins phrases with symbols (|, •, →) where words would read better
copy/punctuation warn Slide text joins clauses with em dashes, or puts a space before a comma
copy/precision warn A figure in text, a table or chart labels shows more digits than a room reads (“$45.984B”)
copy/repeated-label warn The label above a title (the eyebrow) only repeats words of the title
table/total warn A table’s last row is a total that differs from the sum of the rows above it
layout/dense warn A slide holds more than 110 words of text outside its tables and charts
layout/table-run warn Three slides or more in a row are each carried by a table
deck/cover warn A deck of four slides or more opens on a chart, a table or a row of figures instead of a cover
a11y/contrast warn Text contrast under 4.5:1 (3:1 for large text) against what’s behind it
image/upscaled warn A picture is shown at more than 1.5× its pixels
font/substituted warn A font isn’t available, so it was drawn with a stand-in
font/too-many warn The deck uses more than two font families
chart/axis-unit warn A chart’s series are named as percentages, but its value axis shows bare numbers
chart/blank-categories warn A chart blanks out category names to thin its axis labels; keep every name and set labelEvery
chart/3d warn A chart is drawn in 3D, which distorts the values it shows
connector/orphan warn A connector end isn’t attached to a shape, or the line crosses text
Rule Severity What it finds
formula/error error A formula’s result is an error (#DIV/0!, #REF!, #NAME?, #VALUE!, #N/A, #SPILL!, …)
formula/circular error A formula refers to itself, directly or through other cells
cell/too-narrow error A number doesn’t fit its column, so Excel shows ####
chart/empty error A chart’s data cells hold no numbers
drawing/covers-cells warn A chart or picture sits on cells that hold values
text/clipped warn Text is wider than its cell and the next cell isn’t empty
number/as-text warn A number is stored as text, so formulas and charts ignore it
formula/hardcoded warn A formula has a typed-in number instead of an input cell
number/unformatted warn Large or long numbers have no number format

Example: a column too narrow for its numbers

Section titled “Example: a column too narrow for its numbers”

Every value in this sheet is right, but its money columns are 52 px wide, so Excel shows #### instead of the numbers. Most people who open it won’t know to widen the column.

A revenue sheet whose money columns show #### because they are too narrow

Lint measures each value the way Excel draws it and reports every cell that won’t fit, nine here, with the room it needs and the fix:

cell/too-narrow error
Q3!B2 shows #### in Excel: "$6,200,000" needs 78 px but column B is 52 px.
Fix: sheet.setColumnWidth("B", 88) or sheet.autofitColumns().

The agent widens the columns, lint finds nothing, and finalize saves the file:

The same sheet with wider columns, every amount readable

Finalize checks the real file, then saves it: where the user works, for an app’s local server, else into the session’s outputs/ folder. It never overwrites a file.

  1. Office file validation: the file follows the Open XML format PowerPoint and Excel expect.
  2. Package integrity: every part and link inside the file is present and consistent.
  3. Your requirements (below).
  4. Chart data: every chart’s cached values match its data.
  5. Numbers: when the session also holds a workbook, a deck’s numbers come from it (below).
  6. Lint: no errors, unless you waive them.
  7. Read back: the written file opens again cleanly.

It returns the file’s path and SHA-256, or what blocked it. A receipt recording the checks (not the file’s content) is kept under .artiwright/receipts/.

State what the file must contain, and finalize refuses to save one that doesn’t:

Requirement For Example
slideCount decks 12
nativeCharts, nativeTables decks slides that must hold a native chart or table
tableTotals decks total rows that must equal the sum above them
fonts decks { "allowed": ["Aptos", "Georgia"] }
lint decks { "block": ["error"], "waive": ["font/too-many"] }
sheets, tables workbooks names that must exist
charts workbooks at least this many native charts
values workbooks [{ "cell": "Checks!B2", "equals": 0 }]

An agent states these from the request (“a 12-slide deck with a revenue chart”), and your code can pass them to deck.finalize({ output, requirements }).

When a deck reports on a workbook in the same session, its figures should be the workbook’s. Finalize reads every number on the slides and looks for it among the workbook’s values, allowing for how decks show numbers: rounding to the digits shown, k, M and B, models kept in thousands, percentages, changes and complements of ratios (“+3.1% vs plan” for 103.1%), and the totals of a column or row. IDs, dates, years and small counts aren’t checked.

  • A table with three or more numbers that aren’t in the workbook, making up at least 30% of its numbers, blocks finalize. So does a text box with four or more.
  • A few scattered numbers it can’t find are warnings: decks also show figures they work out, like a difference.

The finding names the slide, the object and examples of the numbers, so the agent can read the right values and rebuild that part. If the figures come from somewhere else, waive the check with "lint": { "waive": ["numbers/untraced"] }. Sessions without a workbook aren’t checked.