Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
db65278
docs(adr): draft ADR 0016 — reuse is a link, not a Background
aslakhellesoy Sep 11, 2026
6d4fd5b
docs(adr): allow nested references in ADR 0016; depth is style, not a…
aslakhellesoy Sep 11, 2026
8cd7e2a
docs(adr): resolve the inbound-index question in ADR 0016
aslakhellesoy Sep 11, 2026
dce7412
docs(adr): resolve the port, runner and LSP-cost issues in ADR 0016
aslakhellesoy Sep 11, 2026
c5216be
fix(spec): an oath's doc.path is its workspace-relative POSIX path in…
aslakhellesoy Sep 11, 2026
4ed817f
perf(vscode): the language server reindexes once per typing burst, no…
aslakhellesoy Sep 11, 2026
397a389
feat(ts): reuse setup between examples by linking to a section
aslakhellesoy Sep 11, 2026
80e15ed
feat(ts): a step spliced in from another oath keeps that oath's identity
aslakhellesoy Sep 11, 2026
2ba138f
feat(py): reuse setup between examples by linking to a section
aslakhellesoy Sep 11, 2026
f28cc77
feat(ruby): reuse setup between examples by linking to a section
aslakhellesoy Sep 11, 2026
0a1b6f0
feat(go): reuse setup between examples by linking to a section
aslakhellesoy Sep 11, 2026
d00fd6f
feat(rust): reuse setup between examples by linking to a section
aslakhellesoy Sep 11, 2026
1cb9ad9
feat(dotnet): reuse setup between examples by linking to a section
aslakhellesoy Sep 11, 2026
1287590
feat(java): reuse setup between examples by linking to a section
aslakhellesoy Sep 11, 2026
37d43c5
docs(website): reuse setup by linking to a section
aslakhellesoy Sep 11, 2026
966cc3b
docs(adr): mark ADR 0016 accepted and record what shipped
aslakhellesoy Sep 11, 2026
691b2c4
fix(spec): an example a reference block opens is placed at the refere…
aslakhellesoy Sep 14, 2026
65aa3e9
fix(spec): a reference to an oath above the workspace root keeps its …
aslakhellesoy Sep 14, 2026
a30c4a8
fix(vscode): the language server writes edits through in order
aslakhellesoy Sep 14, 2026
8535bcc
fix(vscode): a spliced step is highlighted in the oath it was written in
aslakhellesoy Sep 14, 2026
0239689
chore(website): the playground plans its oath against an empty workspace
aslakhellesoy Sep 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion conformance/adapter/smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ oaths_on_disk() {
[ "$include" = "varar/**/*.md" ] || fail "$dir: the smoke contract assumes oaths live in varar/" \
"varar.config.json docs.include is [$include]" \
"Teach smoke.sh to glob, or move the oaths (see CLAUDE.md — 'varar means oaths')."
(cd "$REPO_ROOT/$dir" && ls varar/*.md | sort)
# `varar/**/*.md` is recursive, and a project may nest oaths (shared sections
# referenced from elsewhere conventionally live in varar/shared/ — ADR 0016).
(cd "$REPO_ROOT/$dir" && find varar -name '*.md' | sed 's|^\./||' | sort)
}

run_contract() {
Expand Down
22 changes: 22 additions & 0 deletions conformance/bundles/20-reference-splice/LibrarySteps.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package dev.varar.conformance.bundle20;

import dev.varar.State;
import dev.varar.StepDefinitions;
import dev.varar.Steps;

/** Java sibling of {@code library.steps.ts} / {@code library.steps.py} (bundle {@code 20-reference-splice}). */
public final class LibrarySteps implements StepDefinitions<LibrarySteps.Ctx> {

record Ctx(int shelf) implements State {}

@Override
public void register(Steps<Ctx> s) {
s.state(() -> new Ctx(0));

s.stimulus("I shelve {int} books", (Ctx ctx, Integer n) -> new Ctx(ctx.shelf() + n));

s.stimulus("I borrow a book", (Ctx ctx) -> new Ctx(ctx.shelf() - 1));

s.sensor("The shelf holds {int} books", (Ctx ctx, Integer n) -> ctx.shelf());
}
}
7 changes: 7 additions & 0 deletions conformance/bundles/20-reference-splice/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Late fees

A world state written once and linked from the examples that need it.

[A stocked library](./shared.md#a-stocked-library)

I borrow a book. The shelf holds 2 books.
108 changes: 108 additions & 0 deletions conformance/bundles/20-reference-splice/golden/doc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"examples": [
{
"body": [
{
"kind": "paragraph",
"segmentMap": [
{
"sourceOffset": 13,
"textOffset": 0
}
],
"span": {
"endCol": 70,
"endLine": 3,
"endOffset": 82,
"startCol": 1,
"startLine": 3,
"startOffset": 13
},
"text": "A world state written once and linked from the examples that need it."
}
],
"precededByDelimiter": true,
"scopeStack": [
"Late fees"
],
"span": {
"endCol": 70,
"endLine": 3,
"endOffset": 82,
"startCol": 1,
"startLine": 3,
"startOffset": 13
}
},
{
"body": [
{
"kind": "paragraph",
"segmentMap": [
{
"sourceOffset": 84,
"textOffset": 0
}
],
"span": {
"endCol": 51,
"endLine": 5,
"endOffset": 134,
"startCol": 1,
"startLine": 5,
"startOffset": 84
},
"text": "[A stocked library](./shared.md#a-stocked-library)"
}
],
"precededByDelimiter": false,
"scopeStack": [
"Late fees"
],
"span": {
"endCol": 51,
"endLine": 5,
"endOffset": 134,
"startCol": 1,
"startLine": 5,
"startOffset": 84
}
},
{
"body": [
{
"kind": "paragraph",
"segmentMap": [
{
"sourceOffset": 136,
"textOffset": 0
}
],
"span": {
"endCol": 42,
"endLine": 7,
"endOffset": 177,
"startCol": 1,
"startLine": 7,
"startOffset": 136
},
"text": "I borrow a book. The shelf holds 2 books."
}
],
"precededByDelimiter": false,
"scopeStack": [
"Late fees"
],
"span": {
"endCol": 42,
"endLine": 7,
"endOffset": 177,
"startCol": 1,
"startLine": 7,
"startOffset": 136
}
}
],
"orphanAttachments": [],
"path": "example.md"
}
93 changes: 93 additions & 0 deletions conformance/bundles/20-reference-splice/golden/plan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"diagnostics": [],
"examples": [
{
"expectedOutcome": "pass",
"name": "I borrow a book. The shelf holds 2 books",
"scopeStack": [
"Late fees"
],
"span": {
"endCol": 42,
"endLine": 7,
"endOffset": 177,
"startCol": 1,
"startLine": 5,
"startOffset": 84
},
"steps": [
{
"args": [
{
"parameterType": "int",
"value": "3"
}
],
"docPath": "shared.md",
"matchSpan": {
"endCol": 17,
"endLine": 7,
"endOffset": 130,
"startCol": 1,
"startLine": 7,
"startOffset": 114
},
"matchedExpression": "I shelve {int} books",
"paramSpans": [
{
"endCol": 11,
"endLine": 7,
"endOffset": 124,
"startCol": 10,
"startLine": 7,
"startOffset": 123
}
],
"text": "I shelve 3 books"
},
{
"args": [],
"matchSpan": {
"endCol": 16,
"endLine": 7,
"endOffset": 151,
"startCol": 1,
"startLine": 7,
"startOffset": 136
},
"matchedExpression": "I borrow a book",
"paramSpans": [],
"text": "I borrow a book"
},
{
"args": [
{
"parameterType": "int",
"value": "2"
}
],
"matchSpan": {
"endCol": 41,
"endLine": 7,
"endOffset": 176,
"startCol": 18,
"startLine": 7,
"startOffset": 153
},
"matchedExpression": "The shelf holds {int} books",
"paramSpans": [
{
"endCol": 35,
"endLine": 7,
"endOffset": 170,
"startCol": 34,
"startLine": 7,
"startOffset": 169
}
],
"text": "The shelf holds 2 books"
}
]
}
]
}
21 changes: 21 additions & 0 deletions conformance/bundles/20-reference-splice/golden/registry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"parameterTypes": [],
"steps": [
{
"expression": "I shelve {int} books",
"parameterTypeNames": [
"int"
]
},
{
"expression": "I borrow a book",
"parameterTypeNames": []
},
{
"expression": "The shelf holds {int} books",
"parameterTypeNames": [
"int"
]
}
]
}
43 changes: 43 additions & 0 deletions conformance/bundles/20-reference-splice/golden/trace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"examples": [
{
"name": "I borrow a book. The shelf holds 2 books",
"outcome": "pass",
"steps": [
{
"contextKey": {
"exampleName": "I borrow a book. The shelf holds 2 books",
"stepFile": "library.steps"
},
"exampleName": "I borrow a book. The shelf holds 2 books",
"matchedExpression": "I shelve {int} books",
"ordinal": 1,
"outcome": "pass",
"stepText": "I shelve 3 books"
},
{
"contextKey": {
"exampleName": "I borrow a book. The shelf holds 2 books",
"stepFile": "library.steps"
},
"exampleName": "I borrow a book. The shelf holds 2 books",
"matchedExpression": "I borrow a book",
"ordinal": 2,
"outcome": "pass",
"stepText": "I borrow a book"
},
{
"contextKey": {
"exampleName": "I borrow a book. The shelf holds 2 books",
"stepFile": "library.steps"
},
"exampleName": "I borrow a book. The shelf holds 2 books",
"matchedExpression": "The shelf holds {int} books",
"ordinal": 3,
"outcome": "pass",
"stepText": "The shelf holds 2 books"
}
]
}
]
}
28 changes: 28 additions & 0 deletions conformance/bundles/20-reference-splice/library.steps.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// C# sibling of library.steps.ts / .rs (bundle 20-reference-splice).
using Varar;
using Varar.Core;

namespace Varar.Corpus.B20;

public static class LibrarySteps
{
public static void Register(Steps s)
{
s.Stimulus(
"I shelve {int} books",
(state, n) => Value.Map([new("shelf", Value.Of(ShelfOf(state) + AsLong(n)))]));

s.Stimulus(
"I borrow a book",
state => Value.Map([new("shelf", Value.Of(ShelfOf(state) - 1))]));

s.Sensor("The shelf holds {int} books", (state, n) => Value.Of(ShelfOf(state)));
}

public static Value State() => Value.Map([new("shelf", Value.Of(0))]);

private static long ShelfOf(Value state) =>
state is VMap m && m.Entries.TryGetValue("shelf", out var v) && v is VInt i ? i.Int : 0;

private static long AsLong(Value v) => v is VInt i ? i.Int : 0;
}
31 changes: 31 additions & 0 deletions conformance/bundles/20-reference-splice/library.steps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Go sibling of library.steps.ts (bundle 20-reference-splice).
package fixture

import "github.com/varar-dev/varar/go/varar"

func shelfOf(state varar.Value) int {
if m, ok := state.AsMap(); ok {
if c, ok := m["shelf"]; ok {
if n, ok := c.AsInt(); ok {
return int(n)
}
}
}
return 0
}

func Register(s *varar.Steps[varar.Value]) {
s.Stimulus("I shelve {int} books", func(state varar.Value, n int) (varar.Value, error) {
return varar.MapValue(map[string]varar.Value{"shelf": varar.IntValue(int64(shelfOf(state) + n))}), nil
})
s.Stimulus("I borrow a book", func(state varar.Value) (varar.Value, error) {
return varar.MapValue(map[string]varar.Value{"shelf": varar.IntValue(int64(shelfOf(state) - 1))}), nil
})
s.Sensor("The shelf holds {int} books", func(state varar.Value, expected int) (int, error) {
return shelfOf(state), nil
})
}

func State() varar.Value {
return varar.MapValue(map[string]varar.Value{"shelf": varar.IntValue(0)})
}
17 changes: 17 additions & 0 deletions conformance/bundles/20-reference-splice/library.steps.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@file:JvmName("LibrarySteps")

// Kotlin sibling of library.steps.ts / library.steps.py / LibrarySteps.java
// (bundle 20-reference-splice).
package dev.varar.kotlin.conformance.bundle20

import dev.varar.kotlin.stimulus
import dev.varar.kotlin.steps
import dev.varar.kotlin.sensor

data class Ctx(val shelf: Int = 0)

val steps = steps(::Ctx) {
stimulus("I shelve {int} books") { n: Int -> copy(shelf = shelf + n) }
stimulus("I borrow a book") { copy(shelf = shelf - 1) }
sensor("The shelf holds {int} books") { n: Int -> shelf }
}
Loading
Loading