SelfscribeDownloadOpen the app

Conformance suite

Every engine build must pass every fixture here. This is the contract between agents.

Layout

#
  • NNN-name.self is the input. A fixture is every top-level .self file whose stem contains

    no .; NNN-name.base.self files and subdirectories are support files (imports, includes).

  • NNN-name.html is the expected HTML body, without the <style> block.
  • NNN-name.diag.txt, if present, lists the expected diagnostics, one per line, in order:

    SEVERITY [FILE:]LINE:COL MESSAGE. FILE appears only when the diagnostic belongs to an imported or included file, as its canonical key. **No .diag.txt means the fixture must produce no diagnostics at all.**

  • NNN-name.css, if present, is the expected CSS (D41).
  • NNN-name.folds.txt, if present, lists the expected folds, one per line:

    KIND LEVEL FIRSTLINE-LASTLINE (D51).

Normalisation

#

Applied to both expected and actual HTML and CSS before comparing:

  1. \r\n becomes \n.
  2. Every match of >[ \t]*\n\s*< becomes >< (line breaks between tags do not matter).
  3. Trim.

Spaces between tags on the same line are significant. Nothing else is normalised.

.diag.txt and .folds.txt are compared line by line, ignoring blank lines and trailing whitespace (D67).

Runner options

#
  • Input: the raw bytes of the .self file, through the byte-level entry (parse_bytes in

    Rust, parse(Uint8Array) in JS), so invalid UTF-8 is handled per D8.

  • path: the fixture's file name (for example 008-import-override.self).
  • Resolver: reads spec/conformance/KEY, or returns null if it does not exist, or if KEY

    contains :// or a .. segment (D67). A library key lib:NAME reads spec/conformance/library/NAME.self (D72).

  • Full built-in plugin set. allow_re, allow_remote, forms, unsafe_html off. No host vars.

Rules for fixtures

#
  • Small. One feature per fixture where possible.
  • Expected output is hand-written and reviewed, never generated by the engine under test.
  • Class names for styled rules use the rule's as name when given, else self-rN where

    N is the rule's 1-based index in the document's compiled table (imports included, D28). A named rule whose name another rule writes as a class uses self-rN beside the name (D264).

  • Add a fixture for every bug fixed. The fixture comes before the fix.

Runners: engine/crates/selfscribe-conformance/tests/conformance.rs (Rust, with selfscribe-plugins), engine/crates/selfscribe-cli/tests/conformance.rs (CLI), and packages/selfscribe/test/conformance.test.ts (WASM through the JS package). All read this directory. They must agree.

Coverage: escapes, nested inlines, overlapping delimiters, unclosed blocks, imports with overrides and cycles, off, scopes, every modifier, every directive, every built-in plugin, CRLF input, empty document, rules-only document, tabs versus spaces, and the limits in 03 §4. INDEX.md maps each fixture to the spec clause it checks.

Fixture index

What each fixture checks, and the clause it checks it against (spec file § or decision D#).

FixtureChecksClause
001 no-rules-is-markdownno rules block means use markdown01 §1, D40
002 inline-longest-winslongest pattern at a position; run alignment02 §3, D35
003 colour-commentsline rules, word rule, style classes, CSS02 §4, D41
004 group-nestgroup, nest, digit slotD24, D29, D30
005 table-splitsplit02 §4
006 block-verbatimverbatim block, optional space in block segmentD33
007 escapeescape stops a match01 §3, D5
008 import-overrideuse, replacement, off02 §6, 05 §1
009 scopescope and @scope01 §3
010 link-attr-slotattribute slot consumed02 §4
011 fold-and-hiddenfold N, hidden block, fold outputD51
012 unclosed-block-degradesunclosed block warning, standalone paragraphD34, D10
013 unknown-targetunknown target warning at the ruleD44
014 set-slotset slot02 §3
015 set-slot-not-inheritedslot per file01 §2
016 empty-documentempty input01 §5
017 rules-onlyrules block, empty body, rules foldD51
018 crlfCRLF line ends, verbatim output uses LFD1
019 tabs-vs-spacestab = one level, 2 spaces = one level01 §4, D30
020 indent-settingset indent 401 §2
021 bomBOM before the fenceD2
022 fence-case-leading-blankblank lines before fence, several spaces, caseD2
023 fence-needs-space~~~selfscribe is not a fenceD2
024 unclosed-rules-blockunclosed rules block becomes bodyD3
025 escapes\` before punctuation only; \; trailing `D5
026 escape-inside-slotescapes inside content and attribute slotsD5, D35
027 at-linesordinary @ lines; stray @endD6
028 rules-commentsfull-line and trailing comments, # in CSS and patternD12
029 set-and-varset variables, title, missing varD49
030 blanklines-keepset blanklines keepD54
031 longest-tie-last-winsequal length: last defined wins02 §3
032 override-in-documentsame WHERE + pattern replaces02 §6
033 off-by-nameoff NAMED13
034 off-with-whereoff WHERE PATTERND13
035 off-no-where-and-nomatchoff PATTERN hits all WHEREs; no-match warningD13
036 off-then-redefinelater rule with same pattern is activeD13
037 full-formfull form, anonymous rule, repeated style02 §5, D20
038 numbered-slots_2 before _1D25
039 content-slot-tokenbare slot token as content (bbcode [url])D22
040 quoted-attr-interpolation"color: _1"; unsafe style attributeD23, D42
041 empty-slot-attr-omittedempty slot attribute omitted; attr-only slot may be emptyD35, D39
042 classes-orderclass order and dedupe, as classD39, D41
043 css-unsafeunsafe declarations droppedD42
044 unsafe-urlURL scheme policyD43
045 html-escapingtext and attribute escapingD39
046 disallowed-targetrefused elements, unknown inline targetD43, D44
047 reserved-text-hiddentext, hidden inline and line02 §4
048 keepkeep on inline and lineD38
049 word-rulesword boundaries, word inside inline, not in verbatimD36
050 boundbound modifierD36
051 digit-slot_#D24
052 pattern-errorsevery rule-line errorD19, D25, D26
053 invalid-settingsinvalid set valuesD19, D21
054 pattern-too-long256 ok, 257 error03 §4, D26
055 double-space-pattern\ \ , whitespace collapseD11
056 literal-arrow\-> in patternsD11
057 verbatim-inlineverbatim keeps backslashes; escaped closerD5
058 group-shared-inputshared group, group classes, input=D29, D45
059 group-breaksblank and scope lines do not break a groupD29, D6
060 nest-childrenparagraph children, skipped levels, blank linesD30
061 split-edgesescaped separator, empty cells02 §4, D66
062 fold-levelsfold N sections, trailing blanks, empty sectionsD51
063 fold-barebare fold on line and blockD51
064 block-nonverbatim-nestednested same-rule blocks, closer winsD33
065 block-single-lineone-line blocksD33
066 block-in-list-indentindentation stripped in nested verbatimD33
067 block-longest-openerlonger opener winsD27, D33
068 paragraph-mergelines merge, trailing spaces trimmedD31
069 line-exact-anchoredline patterns anchored at both endsD32
070 nested-inlinesrecursion into slots, run alignment nestingD35
071 overlapping-delimitersleftmost start winsD35
072 inline-edge-casesno cross-line, empty content slot failsD35
073 limit-inline-32inline recursion limitD55
074 limit-nesting-64nesting limitD55
075 import-cyclecycle cut, diagnostic in the imported fileD16
076 import-unresolvedunresolved path, unknown template, remote offD17
077 import-in-place-orderuse expands in placeD14
078 import-relative-nestedrelative keys from nested importsD17
079 import-settingswhich settings leak from importsD15
080 scope-inherits-defaultscope = default + ownD37
081 scope-flat-nestingscopes do not stackD7
082 scope-import-and-offimport into current scope; off per scopeD15, D37
083 use-formbuilt-in form template, input=, var04 §5
084 use-commentsbuilt-in comments template, CSS originsD41
085 emojiemoji plugin, unknown name, styled wrapperD46, D49
086 mermaid-mathmermaid and math markersD49
087 csv-tsvcsv quoting and trimming, tsv, header onlyD49
088 includeinclude, include cycle, unresolved include; the included file's own rule reads its bodyD49, D263
089 regex-disabledre rule without allow_reD63
090 duplicate-nameduplicate as namesD28
091 attr-not-allowedattribute name policyD43
092 slot-not-in-patternreference to a missing slotD25
093 markdown-table-separatorseparator row hidden inside the tableD60
094 markdown-tourthe built-in Markdown template end to endtemplates/markdown.self
095 full-form-modifiersevery modifier key in full form; incomplete rule; unknown keyD20, D66.13
096 settings-rules-projectset rules, set project and their invalid values01 §2, D19
097 import-diamond-rootdiamond import, root-relative /, .. above the rootD16, D17
098 plain-workbook-templatesbuilt-in plain and workbook; diagnostic in a templateD17, D56
099 scope-in-blocks@scope in a non-verbatim body (auto-close), in verbatim (text), indented, unclosedD6
100 include-inline-and-scopeinclude under @scope; include from an inline ruleD49, D66.14
101 block-opener-fallbacklonger opener without closer falls back to a shorter oneD33
102 unclosed-nested-blockunclosed outer block with a closed inner oneD33, D34
103 lone-cr-mixed-indentlone \r is text; tabs and spaces mixed on one lineD1, D30
104 invalid-utf8lossy decode with an errorD8
105 css-overridden-omittedoverridden and disabled styled rules emit no CSS; overridden unknown target is silentD41, D44
106 unknown-target-onceone warning per rule, not per useD44
107 url-morecite, upper-case scheme, whitespace inside a scheme, &# is not a schemeD43
108 css-triggers-hash-quoteexpression(, \`, < triggers; # inside quotes; _0` literalD12, D25, D42
109 long-relative-urla relative URL longer than any scheme stays; a long scheme is still refusedD43
110 library-rulebookuse NAME resolves a host library rulebook (lib:NAME); unknown names; no relative imports inside a library rulebookD72
111 data-csv-tableuse data; a typed CSV data block drawn as its own table; every type's cell; the payloadD80, D82
112 data-bad-cellsbad cells per type, unknown type, extra fields, an inferred columnD80
113 data-formatsJSON array, JSON Lines, records with a % header and a comment, TSV by sniffing; list viewsD80, D82
114 view-table-optionsas hidden; sort desc, columns, page, totals in tfoot; group, filter, search, titleD80, D82
115 view-cards-boarda board by its first choice column (empty columns kept), grouped cards, a board by a text column with (none), avg and countD80, D82
116 view-calendar-forma calendar by the first date column (offset timestamps on their written day, a note for undated records), a formD82
117 view-diagnosticsduplicate and invalid names, unknown kinds, sources, columns, reserved sqlite, repeated options, filter errors, fallbacksD80, D81
118 data-filesfrom PATH with a types body, a view of a file path, file diagnostics, unresolved and unsupported filesD80
119 view-filterthe filter language: or, not, parentheses, dates and timestamps, choices order, lists, alternatives (A or B values), today without a host date, empty cellsD81
120 data-escapingCRLF input, quoted CSV, HTML and payload escapingD80, D82
121 details-summarydetails with a summary attribute gets a <summary> child; an empty slot has noneD86
122 footnotesMarkdown footnotes: numbering by first reference, repeated references, unknown, unused, duplicate and invalid notesD87
123 citations-bibauthor-year citations from a BibTeX file: prefixes, locators, et al., DOI and URL links, macros, TeX flattening, file diagnosticsD88
124 citations-recordsnumeric citations from a records data block, all, a refused URL, no authors or year, an unknown sourceD88
125 equationsnumbered equations, eq: labels, references, an unlabelled and a plain math block, a duplicate labelD89
126 glossaryterms marked in headings and text but not in code, links or longer words; hidden abbreviations; a duplicate termD90
127 progresstask counts per section, whole document, no tasksD91
128 footref-without-notesa reference-like [^x] in a file without notes is text, without a warningD87
129 page-break---page--- in Markdown is a page break, hr.self-pagebreakD94
133 data-holidaysset holidays SOURCE: the days off (a span with a to column) go to clients in the payload; filters take units (today+10wd, today-1m, today+2w)D119
134 data-holidays-unknowna holidays source that does not exist warns once, at the set lineD119
135 data-calccalculated columns: start + 3w, start + 10wd, due - start, hours * client.rate (exact), client.email through a choice(from …) column; CSV fields skip them; a view filters and sorts by them; the payload carries calcD120
136 data-calc-warningsa type that does not fit, an unknown column, a missing ), a lookup through a plain column, a written type that disagrees, a number plus an amount, a division by zero (empty), a JSON key for a calculated columnD120
137 rule-keyskey SHORTCUT on rules changes nothing in the HTML; a shortcut without Ctrl or Alt (other than F1-F24) warnsD122
138 linebreaks-keepset linebreaks keep: a line break inside a paragraph is a <br> (indentation dropped); lists are untouched; another value warnsD123
139 block-optionssize words after a block's opening line (maxwidth:800px, width=50%, align:center) become its inline style (a code block's on its pre) and are not matched by the rule; a bad value warnsD125
141 palettepalette NAME VALUE [dark VALUE], one line or a block: custom properties on :where(.self-doc, .self-palette) before the rules, the dark value through light-dark(); a later name replaces in place; a bad name, an editor name (ui- and the like), a dark gradient and an empty value warnD129
142 classclass NAME { css } styles a class without a rule, after the palette and before the rules; a later class of the same name replaces it in place; self-, cm-, ed- and pg- names, a missing { css } and unsafe declarations warnD130
143 view-plainplain on a data view: the payload says "plain":true (the client draws no bar, and sums as bare figures); the static table is unchangedD80
144 word-slotsone-word slots in word rules: @_, #_ with an attribute and keep, #_/_, $_, _%, v_; trailing , . ) stay outside; no match after a letter (email@host) or before -; a longer literal (@ana) wins; escapes; _ alone, _# and three slots are errorsD133
145 class-selectorsclass NAME with pseudos (::after, :last-child::after, :hover, ::marker, :nth-child(2n+1)) and one descendant or child element (card h3, card > p), still under :where(.self-doc, .self-palette); the same name and ending replaces; two elements, a pseudo-element before the element, other pseudos, class and list selectors warn; \` in content` is unsafeD130
146 view-chart-baras chart by COLUMN sum COLUMN: a bar per choice in order, (none) last, exact sums, an SVG with a titled bar per value and a table of the numbers; the payload's chart and by; no total gives count, and a filter applies first; an unknown chart type warnsD134
147 view-chart-lineas chart line by month (the first date column), two totals as two series, an empty month in between (sum 0, no average), a negative value, a record without a date noted; area by date week (Mondays); a period on a column that is not a date warnsD134
148 view-chart-grouphbar … group product: one series per value; pie of one total; donut group region (group alone is the categories) with max of a rating; min of a date is left out with a warningD134
149 numberednumbered counts each kind on its own (figure, table, theorem; name=Satz shares the theorem count); captions under figures, above tables, run into a theorem's first line; ref by prefix, by kind= and bare; [@eq:…] still eqref; unknown, duplicate and invalid labels and an invalid kind warnD140
150 typed-slots_# read by attributes (value=_#, inside quotes); group-start=_# puts start on the ol from the first item, left out when 1, nested lists count on their own; url word slots take query strings, fragments and balanced brackets, leaving trailing punctuation and quotes outside, not inside code; a link's text is not linked again; _# without a digit slot and url off a word rule warnD141
151 data-rulesRules after a column's type: required (an empty cell warns), unique (a repeated value is a bad cell), default, when TEST then VALUE else '' with its test in the payload, hidden (left out of the columns shown), readonly; a default that does not fit, a test on an unknown column, an unknown rule and a when without then warn; a calculated column beside themD153
152 data-query-lockedreadonly and views said on a data block hold for its views; locked and unlocked; views none; data NAME from OTHER where TEST keeps the other source's records and lines, names itself in source.query, adds a calculated column from its one header line; two queries that take from each other and a missing source warnD154, D155
153 data-query-totalsper client sum hours avg hours min due count after where: one record per value with sum_hours, avg_hours, min_due, records; a calculated column from the block's header line; views of it are readonly; a view and a query of the totals (where records > 1); a looked-up column carries link with where each value's record starts; an unknown per column warns and the records are listedD156, D157
154 data-totals-joinThe column totals are per stays a choice(from clients.name): calculated columns of the totals read through it (rate = client.rate, cost = sum_hours * client.rate, city = client.city), an empty value reads nothing; a view total and a chart over those columns; a query of the totals (where cost > 1000); a lookup of a column the other source does not have warnsD161
155 data-table-peekA choice(from DB.sqlite/TABLE.csv COLUMN) column: its link carries peek, the column names and the looked-up records whole (each value's first record, empty values left out), because a table of a database has no text to open; a calculated column reads through it; a lookup of an ordinary file carries no peek (reads 155-shop.sqlite/clients.csv and 118-data-files.csv)D162
156 data-pivotper region across quarter sum amount: a column for each value of quarter and a total column, one record per region; a value named like a column gets _; empty cells where nothing is to total, 0 for a count; max of a date gives date columns; a view total and a chart over a value column; two totals with across, an unknown across column and across without one warn; a query that names itself says soD165
157 rewriterewrite block turns a short notation into a target's language: LaTeX templates under set slot @ (x_1 passes through) with first and last lines for math; _# digits and a line's own indentation kept for pre; a line no template matches stays as written; data-self-rewrite carries the line map; markdown's code block still works beside them02 §8, D255
158 rewrite-sharedA rewrite from a rulebook (use) applies in the document; rewrite inline, a rewrite into data (which reads its block as written), a slot the pattern lacks (left as written) and an unknown template line are problems on their lines02 §8, D255
159 own-styleA styled rule named box while another rule writes div.box (and a group writes ul.box): its class is self-r1 beside box, its CSS .self-r1, an info note at the rule; a class box line still styles every .box; a name nothing else writes keeps .note02 §4, D41, D264
160 view-buttonsbutton Watered runs watered, button "Moved it" runs moved: the payload carries buttons as [label, action] pairs in order; the static table draws no button and no extra column04 §7, D267
161 data-totals-fileTotals over a table kept in a file: sum("161-picks.csv".points) and count(…) in a file's own header, over the rows whose choice(from 161-players.csv) column names each player; the picks' own points are worked out first; a view of the file and a block that reads it (from 161-players.csv) are the same table, and the block's header totals a block of the document that reads the other file (sum(picks.points)); an unknown source warns (reads 161-players.csv and 161-picks.csv)D139, D270
162 data-calc-rulesRules after a calculated column's expression: hidden (left out of the block's table, shown where columns names it), help beside the calculation in the payload; required and default do not apply to a calculated column and are taken off with a warning eachD153, D270
163 data-figuresThe static output writes figures as the client does: set currency £ without tips puts £ on the money columns (worked-out ones too) and not on tips, whole pounds where every value is whole; thousands grouped; set dates weekday for due dates; a table's totals row with Total and bare sums, a group's line with its count and sums, a list's totals as words named by their columns (Amount £2,154.90 · Average amount £1,077.45); tiles for as stats; worked-out cells marked self-calc; when … -> red on a row and -> bold in left on a cellD82, D186, D259
164 view-chart-moneyA static chart has the client's view box (an hbar of two rows is 158 high, bars 340), axis values grouped, compact from 10,000 and with the shared currency, each bar's value written as its column's totals (inside a bar that reaches the edge), series named by their columns as headings (Revenue, Orders), a legend over several series, a donut's total and shares, and the numbers as written in a table for screen readersD134
140 rules-regions# region NAME … # endregion (nested, one left open) and # ---- section comments fold inside the rules block; they stay commentsD124

Not covered by fixtures (unit tests instead): depth 64 reached through non-verbatim blocks, includes and imports, because a readable fixture for it would be hundreds of lines.