Skip to content

sparkles.wired.sdl — Delivery plan ​

Companion to SPEC.md. Each S-milestone is independently green: the repository builds, dub test :wired passes, formatting is clean, and no later milestone is needed to make an earlier commit valid. S-numbers are local to the SDL backend and do not replace the base M- or expressiveness E-series.

Dependency spine ​

The syntax/document engine is independent of typed serialization and may land first. The typed backend starts only after expressiveness E1 supplies wireSchemaOf!(F, T), open format annotations, and schema references, and E2 supplies the shared walker seam. If those milestones have evolved, S5 first adapts this plan to their shipped public contracts; it does not create an SDL shadow schema.

Every milestone includes focused @safe/@system test annotations, negative tests for its rejected shapes, and public DDoc for newly exposed symbols. New files are staged before Nix-based checks so the flake can see them.

S0 — Provenance and fixture manifest ​

Record the exact DUB revision used for grounding, inventory the relevant files under source/dub/internal/sdlang/, source/dub/recipe/sdl.d, and source/dub/internal/configy/, and classify each planned fixture as original, adapted, or directly ported. Add the required SDLang zlib/libpng and DUB/Configy MIT notices before importing any upstream-derived test body.

Gate: a reviewable fixture/provenance manifest; repository license tooling (if present) passes; no implementation code yet. Original sparkles tests remain under the repository license, while adapted/ported cases name source path and revision in comments.

S1 — Scalar model and canonical scalar writer ​

Add sdl.document scalar types (SdlScalarKind, date-time/zone payloads, qualified names, positions/spans) and the canonical scalar emitter from SPEC §3.4/§9. Reuse format-neutral integer, float, UTF-8, and Base64 primitives where they already exist; add them to sparkles:base only when genuinely reusable.

Gate: one test matrix covering every scalar kind, boundary integers, signed zero, shortest finite floats, string/character escapes, Base64, date/time zone forms, duration fractions, and non-finite rejection. Every emitted scalar re-parses in a temporary scalar harness and retains kind and value. The module builds without the parser or typed codec.

S2 — Complete lexer ​

Implement the compile-time SdlParserConfig/feature sets and the sdlFull, sdlDubCompat, and sdlDubRecipe profiles before the scanner kernels. Add UTF-8/BOM handling, identifiers and keywords, punctuation, terminators, all scalar tokens, comments, logical-line continuation, and token spans. The lexer is a forward range over borrowed source and returns structured SdlError values rather than throwing. Scalar decoding is deferred until a consumer requests the token value; disabled families reject as unsupportedFeature without instantiating their conversion kernels.

Gate: SPEC §3 lexical conformance tests under sdlFull; malformed escape/suffix/Base64/BOM and unterminated-comment cases; CR/LF/CRLF/U+2028/U+2029 location pins; Unicode name tests; and differential fixture outcomes under sdlDubCompat against the pinned DUB lexer. The sdlDubRecipe profile parses the pinned DUB recipe snapshot and every in-tree dub.sdl, while rejecting each disabled scalar family with its whole candidate span. Compile-time availability checks and linked-symbol probes prove binary, numeric, character, and temporal kernels are absent from a recipe-profile artifact. A fuzz smoke test runs each named profile and proves arbitrary bytes either tokenize or return an error without crash, hang, or out-of-bounds access.

S3 — Parser and ordered arena ​

Implement the grammar and allocator-backed SdlDocument/borrowed views. Store nodes in preorder and retain separate ordered extents for values, attributes, and children. Add qualified-name-filtering ranges that retain all repetitions.

Gate: SPEC §4 arena invariants; anonymous-tag and child-block grammar failures; duplicate attribute and child preservation; namespace separation; deep nesting bounded by SdlParserConfig.maxDepth; allocator lifecycle/leak checks; DIP1000 compile tests preventing views from escaping their document. Representative DUB recipe/sdl.d fixtures parse into expected semantic snapshots.

S4 — Document writer and laws ​

Add writeSdlDocument, indentation options, validateSDL, and canonical full document emission. This milestone is document-only and does not depend on the wired schema.

Gate: golden canonical output for comments, raw/regular strings, boolean aliases, semicolon terminators, namespaces, repetitions, anonymous tags, and nested blocks. Property tests enforce both SPEC §10 document laws over generated bounded documents. Parse-write-parse is also checked against the attributed DUB fixture corpus. Writer failures leave the caller's error channel structured and pathed.

S5 — SDL schema annotations and typed role validation ​

Add Sdl, the six typed role UDAs, and the SDL projection in wireSchemaOf!(Sdl, T). Resolve default-child roles, qualified @WireName!Sdl, shared case/alias/default/optional/converter/check metadata, positional extents, dynamic name/namespace fields, and unknown policy into the schema once.

Gate: compile-time schema snapshots for every role and composition; role UDA values survive in open annotations; JSON schemas for the same types are unchanged. Negative compile fixtures cover duplicate positions, a variadic value not last, aggregate attributes, invalid names, duplicate identity fields, root-only violations, conflicting strict/extras policy, and every other SPEC §5.2 shape error. Diagnostics contain type, field, role, and expected shape.

S6 — Typed decode ​

Implement fromSDL!T(SdlNode) and text fromSDL!T as the SDL leaf adapter over the shared schema walk. Cover scalars, enums, null-aware values, static/dynamic sequences, AAs, aggregates, conversions, checks, defaults, presence, and union representations approved in the SDL schema annotation.

Gate: one fixture exercises all three channels in one aggregate; positional and repeated-order tests; exact static-array lengths; duplicate singular child and AA-key rejection; missing required role diagnostics; enum/name/case policy; converter/check errors retaining source spans; Decoded!T presence bits; union success and per-variant failure. Existing JSON tests and byte output remain unchanged.

S7 — Typed encode and canonical output ​

Implement writeSDL and toSDL through the same schema walk. Declaration order governs fields, input order governs sequences, and canonical key order governs AAs. Encode checks and converters run in the shared order.

Gate: typed goldens for DUB-shaped recipes (multiple authors, repeated configuration, positional dependency names, attributes, namespaces, and child settings); writer-template tests with a Buffer; deterministic AA output; all schema-supported scalar kinds; encode errors with role paths. Property tests enforce fromSDL!T(toSDL(value)) == value for types accepted by isWireRoundTrippable!(Sdl, T).

S8 — Unknown fields and exact repetition preservation ​

Implement ignore, @WireStrict!Sdl, @SdlExtra, borrowed/owned SdlExtras, ordinal merge on encode, and collision detection. Accumulating decode uses the shared error-sink protocol.

Gate: unknown positional values, namespaced duplicate attributes, and mixed repeated children each pass ignore/forbid/preserve tests; preserved extras survive typed decode-encode-decode with channel order intact; collisions fail at the extra occurrence's role path; strict accumulation reports all unknowns; borrowed-extra lifetime checks compile under DIP1000.

S9 — File helpers and operational errors ​

Add readSDLFile and writeSDLFile: source-name propagation, recursive parent directory creation, same-directory temporary files, atomic replacement, final newline, cleanup, and stage-specific errors.

Gate: temporary-filesystem tests for successful nested writes, read/parse/decode source context, encode/write/rename failures, unchanged existing targets after failure, no orphan temporary file on handled failure, and exact canonical bytes. Platform-specific atomic-replace limitations are tested or explicitly skipped with skipTest, never silently returned as passes.

S10 — Conformance, attribution audit, and documentation handoff ​

Run the full attributed DUB scalar/parser/recipe fixture corpus, fuzz/regression seeds, typed properties, and all wired tests. Audit public imports, DDoc, source attributes, allocator ownership, and every copied/adapted test's notice. Add library Diátaxis documentation only in a separate documentation change; this milestone does not alter this spec's sidebar.

Gate:

  • dub test :wired is green in debug mode;
  • dub build :wired -b checked is green with assertions live;
  • all document and typed round-trip laws pass;
  • JSON conformance and byte goldens are unchanged;
  • formatting and repository hooks are clean;
  • the license/provenance manifest has no unclassified imported fixture;
  • a final API grep matches SPEC §2/§11 and exposes no DUB internal type.

The SDL backend is complete only after S10. Performance optimization follows as separate measured work and may not weaken source spans, ordering, scalar-kind fidelity, error structure, or any round-trip law.

After S10: editing, migration, and performance ​

These milestones deliver lossless editing and the performance architecture. Measurement comes first so every later change has a baseline, and the shared primitives land in sparkles:base before the SDL code that uses them.

Stage 0 review, 2026-10-24/25: three rounds by one independent reviewer over the three drafts. Round 1 found 2 blockers and 10 majors, round 2 (on the repairs) 2 blockers and 7 majors, round 3 (bounded to round 2's findings) 4 majors; every finding was fixed. The round-3 repairs — the SDE4 separator rule, views referring to the document's core, the SDE9 allowlist, the block-less append point, whitespace before a removed continuation, and the constructor's host check — have not been reviewed. The usual second, fresh reviewer did not run.

Accepted by the owner, 2026-10-27: span-patch editing rather than a concrete syntax tree; the SdlSpan break, with the document owning its source, views referring to its core, and the SPEC amended; and no persistent node handles in the first slice. S11–S18 are delivered as one pull request, one or more commits per milestone.

S11 — Benchmark baseline ​

SDL parse, decode and encode rows in the wired_bench runtime harness; pinned datasets in its Nix data package (a recipe snapshot at a named commit, a concatenated large recipe, a generated deep/wide document) with committed canonical-output fingerprints; the pinned DUB parser as a reference row.

Gate: the three rows run under -b bench and verify against their fingerprints; the first results file is committed with machine and toolchain. No SDL source changes. (The edit row joins in S14.)

S12 — Shared primitives in sparkles:base ​

Text edits (TXE1–TXE5) with dmd-fmt migrated onto them; the line index's newline policy, column unit, construction from known line starts, and @nogc storage (performance §4).

Gate: the TXE oracles; dmd-fmt's tests unchanged, mapCursor's included; the line index's existing tests unchanged, plus every SDL newline form and invalid-UTF-8 columns.

S13 — Owned source, byte spans, and layout ​

The document owns its source; spans become byte ranges with positions on demand and eager positions in errors, and node views become a document core reference and a cell index so typed decode reaches the line table (SDP3), with the SPEC amendment of performance §3 and its consumers migrated in the same commit. The parser records extents, block delimiters and comment spans (editing §2, SDE6).

Gate: every position, error and conformance golden equal on all CI platforms (SDP7); extents and comment spans checked against hand-annotated recipes (CRLF, no final newline, tabs, ;-separated nodes, one-line blocks such as a {; b 1; }, comments in every position, embedded recipes); S11 rows before and after (SDP2).

S14 — The editor ​

The operations of editing §3 resolving to base text edits, with SDE1–SDE5, SDE7, SDE8 and SDE10, and the EmbeddedDubRecipe rendering keeping every logical newline sequence.

Gate: the SDE1 annotated-range fixtures and byte-comparison property test, and the SDE2 reference-model test, over every tracked recipe and embedded recipe; conflict, ambiguity, fragment, newline, indentation and embedded-delimiter cases; the SDE10 growth-and-move test; a @safe pure nothrow @nogc editing test; the S11 edit row; readDubManifest errors in hosts whose prefix holds a lone CR or U+2028 now report the host's line, pinned by a test.

S15 — Migration ​

Every site in editing §7 moves to the editor, the document API or the schema; the SDE9 audit lands in apps/ci with its allowlist.

Gate: standardize-build-settings --check and the checked-build-type tool report no change on the current tree; on fixture recipes with comments, CRLF and unusual layout, each tool's diff is exactly the intended lines. Where the old tools were right, their output is the oracle; where they were wrong — a commented buildType "checked", a } not in column zero, a whole file stripped — the fixture pins the fix. ci test is green.

S16 — One-pass reader ​

SDP4: the pool sized once from the source, the cell arrays growing, behind the same public API.

Gate: SDP7 everywhere; the allocation-failure rollback test still covers every block; S11 parse improves and no other row regresses (SDP2).

S17 — Linear typed decode ​

SDP5, with compile-time name dispatch modeled on the JSON codec.

Gate: SDP7; the name-comparison counting test; S11 decode improves.

S18 — Shared scratch ​

SDP6 for scratch, keeping the allocator parameter.

Gate: SDP7; S11 rows; the recorded fixed-width scratch decisions re-measured.

S19 — Audit completeness ​

The SDE9 audit reads the two shapes it could not see: SDL text built by concatenation (~, ~=), and SDL text compared whole (==, !=, a case label). A match or comparison whose subject is a decoded value — a read of the document views, the dub.sdl schema or std.json, or a name bound from one — is typed work, and the audit says so by itself instead of through the allowlist. The markers name recipe forms only: the bare package name test-runner gives way to its recipe spellings, sparkles:test-runner and test-runner/src. A concatenation counts only when its operand holds recipe syntax, since a marker in prose (+/- in a key hint) builds no SDL. Markers are read in a literal's decoded value, so the quoted markers also match inside a "…" literal. Every allowlist entry is reclassified by the rule or migrated.

Gate: sdlAudit.* tests pin, as positive fixtures, a concatenated recipe line, a marked constant built with ~, == and != against raw text, and a case label on a raw switch; and, as negative fixtures, concatenated prose holding a marker, and the same comparisons on node.name, a foreach variable over a JSON object, a lambda parameter over valuesOf, and a local initialized from qualifiedName.localName. ci check adhoc-sdl passes on the tree with no allowlist entry that the rule covers; any entry left states why no rule can tell it from SDL work. The legacy-setting removal in standardize-build-settings matches nodes by name, values and attributes, not by their text, and standardize-build-settings --check still reports no change on the tree.

S20 — Keyed typed write-back ​

updateSDL pairs aggregate-sequence elements by identity, keeping a longest run in common order in place and moving every other identity pair with its bytes and attached comments (the editor's moves, SDE18), and edits only the elements whose meaning changed (editing §3.1). Pairing hashes identities and finds the run by patience sorting, O(n log n) per sequence. Scalar unions encode, and write back in place; updateSDL applies to any node, not only the root.

Gate:

  • sdl.typedEdit.keyed.*: removing the first or a middle element removes exactly it and its attached comments; inserting first or in the middle leaves every other byte; a changed identity between kept neighbours keeps its comments; a nested configuration's change edits only its value; a reordered element moves byte for byte with its comments and is then changed in place (reorderMovesTheElement); equal identities pair first to first, in order (duplicatesPairInOrder); a 5000-element sequence reversed and shuffled keeps every element's bytes within two seconds each, where the quadratic pairing took seven (largeSequenceIsFast).
  • sdl.editor.move.* and sdl.editor.properties.movesInRepositoryRecipes: SDE18's hand cases and property test.
  • build_primitives.dub_manifest.roundTrip.lossless: over every repository recipe, removing the first configuration and inserting a dependency first decodes as the change, loses no comment outside the removed node and its attached comments, and leaves every other configuration's bytes in the output.
  • wired.sdl.codec.unionEncode: a scalar union round-trips on every scalar channel; sdl.typedEdit.unionsChangeInPlace writes a changed member as one value edit.
  • sdl.typedEdit.updatesANonRootNode: an update of a non-root node edits that node.
  • Laws 4 and 5 of SPEC §10, unchanged.

S21 — Persistent node handles ​

The owner asked on 2026-11-06 for the deferred editing capabilities without waiting for their entry conditions. This milestone delivers a growable slot table in sparkles.base.pool (POOL19–POOL21), and SdlOpenDocument with node handles carried across commits (editing §9, SDE11–SDE13).

Gate: the pool tests for POOL19–POOL21 (@safe pure nothrow @nogc, the fixed table's POOL1–POOL7 cases repeated on the growable one, growth with live handles, both reuse orders); the SDE11 property test over every tracked recipe; the SDE12 and SDE13 cases; every existing editor test unchanged.

S22 — Incremental re-parse ​

Writing and committing re-parse only the edited region (editing §10, SDE14–SDE15).

Gate: first, an sdl.commit row in the runtime harness (one small edit at a time committed to an open document, held to a committed fingerprint), with its full-re-parse numbers recorded; then the SDE14 property test, with its mutation check, and the SDE15 fallback counts and error equality; every editor, codec and conformance test unchanged (SDP7); sdl.commit and sdl.edit improve in retired instructions per byte, and sdl.parse does not regress (SDP2).

S23 — Path selectors ​

Path selection (SDS1–SDS5): a DQL path selects nodes or attributes, and an optional DQL filter narrows them. The path grammar is read by a shared reader in sparkles:dql, and the filter is parsed and evaluated by DQL's own parser and host-resolver evaluator, so there is no second query language. The selector is its own sub-package, sparkles:wired-sdl-select, so sparkles:wired and its consumers that never select do not build DQL. The owner asked for it on 2026-11-06, ahead of the entry condition editing §8 had set (a second consumer whose selection is not a name-and-value filter).

Gate:

  • the path reader accepts exactly DQL §2.1, quoted segments included — a table of accepted and rejected paths, each rejection at its byte offset (an unterminated string, a bad escape, an empty [] among them) — and is @safe pure nothrow @nogc; DQL's printed paths parse back to the same steps;
  • SDS2's oracle: over every repository recipe and a fixture with dotted tag and attribute names, every name path present in it to depth three, printed as DQL prints it, with and without an index, selects exactly what nested byChild loops select, in the same order; attribute selections likewise against nested byAttribute loops;
  • SDS3's oracle: over every repository recipe, a fixed set of filters — comparisons on values and attributes, null checks, categories, &&, ||, !, and globMatch — keeps exactly what the hand-written predicate keeps;
  • a path-only selection runs in a @safe pure nothrow @nogc test;
  • the editor's range overloads apply one operation per selected target, and one consumer's hand-written name-and-value filter moves onto a selector.

S22 follow-ups: shared storage, 2026-11-07 ​

The region path still copied the source and every kept cell into the new document, so a one-value edit of a 4000-tag document allocated 2.7 MB. Re-parses now share the unchanged cells (editing §10.1), and the editor hands over the rendered text (performance SDP8).

GateEvidence
SDP8: an edit's allocation does not grow with the documentsdl.reader.reparseEdited.allocatesTheEdit: 8 blocks and 3226 bytes (edit at the start) or 3258 (at the end), equal at 2001 and 8001 nodes, whose full parses allocate 1.16 MB and 4.60 MB
SDE14 over shared documents; the ownership rule of §10.1sdl.reader.reparseEdited.properties, its chained pass (Mallocator and a counting allocator, which gets every block back); .oracleCatchesASplice perturbs a run's shift, a line run's, a copy
SDE16 across allocator types; retention boundedsdl.reader.reparseEdited.statefulAllocatorLocalizes (kept cells copied); .retentionIsBounded (600 edits, held blocks under 4 full parses, the fallback seen); sdl.open_document.statefulAllocator

Retired instructions per input byte (--perf, -b bench, LDC 1.43). The walk rows are new; their before is the same rows run on this branch's parent. The first after column shares cells but re-resolves each read; the second is the shipped one, whose views keep their run.

DatasetRowBeforeSharedAfter
dub_recipesparse192.1188.1188.0
dub_recipesdecode369.9366.3365.7
dub_recipesedit35.27.98.0
dub_recipescommit41.034.235.8
dub_recipescommit-unchanged0.870.810.80
dub_recipesencode39.039.939.1
dub_recipeswalk1.753.052.01
dub_recipeswalk-edited1.7617.22.05
deep_wideparse150.0148.6148.4
deep_wideedit26.110.911.0
deep_widecommit16.92.02.1
deep_widecommit-unchanged0.170.170.17
deep_wideencode80.781.180.6
deep_widewalk0.581.400.63
deep_widewalk-edited0.5810.20.63

A view is now its run and its cell, and a child range steps inside its run by pointer arithmetic, so a shared document reads as fast as a flat one. What walk still pays over the parent's arrays is a few instructions per element: a child step reads the child's subtree size and checks the run's end, where a child-index window was one load, and a span read adds the run's shift. On deep_wide, whose nodes carry many values, that is +9%; recipes have few values per node, so it is +15% there. Removing it would take a second view type for flat documents, which every consumer would have to be generic over, or the child-index arena back, which an edit cannot share.

S22 follow-ups: 2026-11-07 ​

S22 left two limits. A commit with no edits re-parsed the whole host, and the region path served only stateless allocators: a stateful one took the full parse, and SdlOpenDocument refused one. Both are lifted.

GateEvidence
SDE16; a stateful SdlOpenDocument, its lifetime rulereparseEdited's allocator overload; sdl.reader.reparseEdited.properties repeating every edit through CountingAllocator, .statefulAllocatorLocalizes; sdl.editor.write.statefulAllocatorLocalizes; sdl.open_document.statefulAllocator; editing §9
SDE17; an sdl.commit-unchanged row, its before firstsdl.reader.reparseEdited.noEditsCopyWithoutLexing; sdl.editor.write.noEditsParsesNothing; sdl.open_document.unchangedCommitParsesNothing; sdl.commit-unchanged

Retired instructions per input byte (--perf, -b bench, LDC 1.43; before is this branch's parent with the new row added). commit-unchanged counts its bytes once per commit, as commit does; what remains of it is copying the host into the rendered output.

DatasetRowBeforeAfter
dub_recipesparse192.0192.0
dub_recipesedit35.635.1
dub_recipescommit41.441.0
dub_recipescommit-unchanged193.40.84
deep_wideparse150.0149.9
deep_wideedit26.226.1
deep_widecommit17.016.8
deep_widecommit-unchanged150.50.17

S20–S21 follow-ups: moves ​

S20's moves replaced the moved node: a commit retired its handle and its descendants', as a replacement does. Moves now replace nothing, and a moved node's anchor goes where its bytes went (editing §9). A move also needed the node and its destination each alone on their lines, and updateSDL wrote any other reordered element afresh. A node sharing a line now moves its inline text, along its line, onto another's or onto a line of its own (editing §2, §3, SDE18); updateSDL writes an element afresh only where placement allows no move — more than one line, a line comment or attached comments, bound between two nodes of one line.

GateEvidence
SDE11 over moves; SDE12 for a moved-and-replaced nodeSdlEditor.movedOffset; sdl.open_document.properties.repositoryRecipes with random moves, some re-indenting and some with an edit inside, mutation-checked; .movesKeepHandles; .replacedNodesGoStale
SDE18 on shared lines; placement beside an inline sibling; SDE3's blank overlapsdl.editor.move.sharedLines, .rejects; sdl.editor.properties.movesOnSharedLines (every recipe with nodes put on shared lines, mutation-checked); sdl.open_document.properties.repositoryRecipes over the same hosts; sdl.typedEdit.keyed.reorderOnSharedLines; SdlEditor.canMove

S21–S22 closure: 2026-11-06 ​

MilestoneGateEvidence
S21POOL19–POOL21; SDE11 property test; SDE12, SDE13 casesHeapSlotTable and the pool.heap_slot_table.* tests; SdlOpenDocument; sdl.open_document.properties.repositoryRecipes, .handlesFollowTheirNodes, .replacedNodesGoStale, .anonymousAndEmbedded, .failedCommitsChangeNothing
S22sdl.commit baseline first; SDE14 with mutation check; SDE15results/2026-11-06-ryzen9-7940hx-x86-64-v4-sdl-s22-before.json; reparseEdited; sdl.reader.reparseEdited.properties (5816 edits, 1665 localized), .oracleCatchesASplice, .localizesAndFallsBack, .crlf; every editor, codec and conformance test

Retired instructions per input byte (--perf, -b bench, Ryzen 9 7940HX, LDC 1.43). Before is the full re-parse; commit counts its bytes once per commit.

DatasetRowBeforeAfter
dub_recipesparse192.1192.1
dub_recipesedit194.535.5
dub_recipescommit203.141.4
dub_recipes_concatparse190.6190.4
dub_recipes_concatedit190.731.3
dub_recipes_concatcommit190.730.9
deep_wideparse150.1149.9
deep_wideedit150.226.2
deep_widecommit150.217.0

What remains of an edit or commit is linear but cheap: copying the source, the kept cells and their payloads, and rebuilding the child index. The re-lexed region is usually a single line.

S11–S18 closure: 2026-10-27 ​

Every gate from S11 to S18 holds on this branch, delivered as one pull request.

MilestoneGateEvidence
S11three rows under -b bench, verified against committed fingerprints; first results committedsdl.parse, sdl.decode, sdl.encode in libs/wired/bench/runtime/src/sparkles/wired_bench/sdl.d; datasets pinned in nix/packages/wired-bench-datasets.nix; results/2026-10-27-ryzen9-7940hx-x86-64-v4-sdl-baseline.json
S12TXE oracles; dmd-fmt tests unchanged; line-index tests unchanged plus SDL newlines and columnssparkles.base.text.edits (concatenation reference, pairwise validity, monotonic mapping, @nogc); dmd-fmt's mapCursor tests; sparkles.base.text.lineindex
S13positions, errors and conformance unchanged; extents and comments against annotated fixturessdl.reader.layout.positionsMatchTheScan, .extentFixtures, .commentsInSourceOrder; sdl.conformance.pinnedDub; SPEC §4.1, §4.2 and §7 amended
S14SDE1–SDE5, SDE7, SDE8, SDE10; edit row; host lines past a lone CR or U+2028sdl.editor.*, including properties.repositoryRecipes (SDE1 and SDE2 over every recipe, mutation-checked), nogc, replacementsSurviveGrowthAndMoves, embeddedRecipe; sdl.edit; readDubManifest.hostLinesPastLoneCrAndU2028
S15tools report no change on the tree; old-tool defects pinned; SDE9 audit and re-inventorystandardize-build-settings --check: 0 of 152; add-checked-buildtype: 0 of 119; buildSettings.normalize.lossless, addChecked.withChecked; ci check adhoc-sdl with six reviewed exceptions; editing §7 re-inventory
S16–S18each optimization's before and after on every row; no regressionthe table below; SDP7 suites green throughout

Retired instructions per input byte (--perf, -b bench, Ryzen 9 7940HX, LDC 1.42), the SDP2 metric. The S11 column precedes S13; S13 changed no row.

DatasetRowS11pre-S16S16S17S18
dub_recipesparse341.4341.4184.6184.6184.6
dub_recipesdecode546.5547.1390.4373.0366.7
dub_recipesencode37.837.837.837.837.8
dub_recipesedit—344.4186.4186.4186.4
deep_wideparse291.7291.9148.2148.2146.5
deep_wideencode80.980.980.980.980.9
deep_wideedit—291.7148.5148.4146.8

S16's single pass removed the counting lex (parse −46%, decode −29%); S17's dispatch shows −4.5% on decode here because recipe aggregates are narrow — wired.sdl.codec.linearDecode.nameComparisons pins the complexity bound on a wide one; S18 is within a percent. Wall-time medians, recorded in the results file, moved by the host's load more than these effects during the measurement, which is why the gate reads instructions.

Beyond the plan, the work also fixed a lexer disagreement with DUB (a date followed by a duration lexed as one token; now in the pinned DUB fixtures), two encode bugs that kept toSDL from writing the dub.sdl schema, and added the lossless typed write-back (updateSDL, editing §3.1) with the format and lossless round-trip suites of SPEC §10 over every recipe.

S10 closure: 2026-10-23 ​

Every S10 gate holds on this branch, so the SDL backend is complete in the sense above.

Gate or auditEvidence
Full attributed DUB scalar/parser/recipe corpussdl.conformance.pinnedDub: every string literal in the unittest blocks of DUB's SDLang lexer, parser, AST, and token modules and its recipe module (570 unique inputs) plus 21 original fixtures, compared on tokens, payloads, and trees
Fuzz and regression seedssdl.reader.multiByteDeterministicFuzzSmoke, sdl.writer.laws.generatedDocuments, sdl.lexer.pinnedDubCorpusRegressions
Typed propertieswired.sdl.codec.roundTripLaw.generated, wired.sdl.codec.audit.roundTripPredicate
dub test :wired (debug)green, 275 tests; the full ci test passes all 59 packages
dub build :wired -b checkedgreen
Document and typed round-trip lawsthe law tests above and sdl.writer.laws.canonicalTargetsFullProfile
JSON conformance and byte goldens unchangedconformance.jsonTestSuite and conformance.nativejsonBenchmark run against $JSON_TEST_SUITE; JSON goldens pass unchanged
Formatting and repository hooksprek run over the branch is clean
Provenance manifestPROVENANCE.md lists every non-original test; the direct copy is byte-identical to upstream
API grep against SPEC §2/§11, no DUB typesdl.conformance.publicSurface; every public name is named in the SPEC, and the role projection is package-internal
DDocevery public declaration and member is documented (compiler JSON audit)
Source attributesno whole-function or whole-template @trusted remains; each trust wraps one operation; typed decode and encode are @safe pure (wired.sdl.codec.safePure)
Allocator ownershipsdl.reader.allocatorFailureRollbackEveryBlock; the sanitizer suite (ci test --sanitize address) is clean
Library documentationtutorial, four how-to guides, reference, and explanation

Running the full corpus found three disagreements with DUB, all fixed: -.5 was rejected, a DUB-profile string continuation kept the next line's indentation, and DUB's negative clock fraction needed normalizing in the oracle (the same instant, spelled differently). On aarch64 a fourth appeared, and it is DUB's: Phobos's to!double is correctly rounded only where real is wider than double, so DUB reads 1.2 one ulp high there. The oracle now pins every floating payload of ours to the C library's correctly rounded value and allows DUB that one ulp only on such platforms. The API audit found that SdlError.valuePath was specified but never filled; both directions now fill it.

Audit follow-up — 2026-10-22 ​

The corrective branch adds whole-view lifetime rejection, missing-payload checks, unsigned bounds, initializer restoration, nested schema validation, qualified aliases, explicit defaults, checks, presence, structural adapters, bounded accumulation, and canonical-string law regressions. The shared schema cursor now supplies field policies to both codecs. S10's remaining gates were closed afterwards; see S10 closure.

Static-array review ​

SiteDecision
Lexer Base64 quartet and month-day tableKeep: protocol-width scratch and immutable lookup data, not growable collections.
Writer UTF-8 scratch and seven fractional digitsKeep: exact encoding bounds; no independent length/capacity policy is needed.
Writer decimal significand scratchKeep: bounded by the shortest float kernel. A UniqueBuffer!(char, 64) replacement regressed the mixed-scalar benchmark.
Parser depth/parent stacksKeep: bounded by the compile-time parser profile; replacing them with heap growth would obscure the depth contract.
Typed static-array fields, presence words, seen masksKeep: schema-sized value layouts, not dynamic storage.
Test input arrays and borrowed-view arraysKeep: fixed fixtures and ownership/lifetime probes intentionally exercise stack storage.
Writer temporary float spellingsChange SharedBuffer to UniqueBuffer: neither temporary is copied or shared.

Base text reuse candidates ​

The owned-text spec is a target, not proof that every API has shipped. The following candidates were checked against existing modules:

  • utf.decodeToken, utf.encodeScalar, and utf8.utf8SequenceLength: the lexer/writer already use the owned UTF kernels; preserve SDL-specific newline and quoted-literal rules rather than substituting a generic quoted reader.
  • unicode_properties.unicodeProperty: already supplies identifier and whitespace classification; normalization/case folding must not alter wire keys.
  • float_conv.readDecimalFloat, writeShortest: already underpin SDL floating conversion; the new Stringly adapter reuses them rather than Phobos parsing.
  • readers.readInteger, readEnumString, and writers.writeInteger, writeEnumMemberName: used by Stringly, with full-input consumption and overflow rejection. Replacing the optimized existing SDL integer writer was measured and rejected.
  • base_codecs: potentially useful for a later Base64 cutover, but SDL's whitespace and padding acceptance must remain unchanged; no speculative substitution was made.
  • Text provenance, normalization, graphemes, terminal cell width, wrapping, hyphenation, and bidi are not needed for wire parsing. Source positions count source units under the SDL contract, not terminal display cells.

Measured refactor decisions ​

Linux x86-64, Ryzen 9 7940HX, LDC 1.42 / frontend 2.112, assertion-preserving bench, 2-second minimum sample time. Values are median nanoseconds per batch or operation, not cross-machine baselines.

WorkloadBeforeAfterInterpretation
SDL mixed scalars (112 values)23,51623,706Within observed variation (90/120 ns reported deviations); retain single-owner buffers.
SDL with growable digit scratch23,51624,618Rejected, +4.7%.
JSON twitter parse174,590173,136No regression.
JSON mesh parse444,636444,875No material change.
JSON twitter serialize609,712592,262No regression.
JSON mesh serialize1,137,8601,108,778No regression.
JSON twitter typed decode204,939200,791No regression.

Reproduce the SDL comparison with dub test :wired -b bench -- --bench --bench-min-time=2000 -i wired.sdl.writeScalars --bench-json=<path>. For JSON, run the runtime harness with WIRED_BENCH_ENGINES=wired-native, WIRED_BENCH_DATASETS=twitter,mesh, and the wired\.(parse|serialize|decode)$ filter. The JSON baseline precedes the shared metadata/presence changes; the SDL baseline precedes the scratch/text refactor. There is no SDL parser performance claim from a writer-only benchmark.