Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
conformance/invalid/byte-order-mark/source.stack binary
conformance/invalid/invalid-utf8/source.stack binary
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ jobs:

- name: Validate diagnostic fixtures
run: find conformance -name expected.diagnostics.json -print0 | xargs -0 check-jsonschema --schemafile schemas/diagnostic-expectations.schema.json

- name: Validate compiler diagnostic coverage
run: python scripts/validate-compiler-diagnostics.py
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ python -m pip install --requirement requirements-dev.txt
check-jsonschema --check-metaschema schemas/*.json
check-jsonschema --schemafile schemas/normalized-ir.schema.json conformance/valid/*/expected.ir.json
find conformance -name expected.diagnostics.json -print0 | xargs -0 check-jsonschema --schemafile schemas/diagnostic-expectations.schema.json
python scripts/validate-compiler-diagnostics.py
```

## Design Principles
Expand Down
4 changes: 4 additions & 0 deletions conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ invalid/<case-id>/expected.diagnostics.json

Expected IR documents conform to [`normalized-ir.schema.json`](../schemas/normalized-ir.schema.json). Diagnostic expectation documents conform to [`diagnostic-expectations.schema.json`](../schemas/diagnostic-expectations.schema.json).

The canonical suite covers every Stack 1.0 diagnostic assigned to compiler stages 1 through 4: `STK1001` through `STK3014`, excluding unassigned numbers, plus `STK4002` and `STK4003`. [`validate-compiler-diagnostics.py`](../scripts/validate-compiler-diagnostics.py) verifies that every required code occurs in at least one expectation document. Renderer-stage `STK4001`, `STK5001`, and `STK6001` remain outside compiler conformance.

The encoding cases intentionally include raw invalid UTF-8, a UTF-8 byte order mark, CRLF line endings, and a Unicode scalar before an error position. Tools must preserve `source.stack` bytes rather than decoding and rewriting fixtures during discovery.

## Comparison

- JSON values are compared semantically; formatting and object-member order do not matter.
Expand Down
13 changes: 13 additions & 0 deletions conformance/invalid/byte-order-mark/expected.diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK1002",
"severity": "error",
"range": {
"start": { "byteOffset": 0, "line": 1, "column": 1 },
"end": { "byteOffset": 3, "line": 1, "column": 2 }
}
}
]
}
4 changes: 4 additions & 0 deletions conformance/invalid/byte-order-mark/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
stack 1.0
diagram "BOM" {
node api "API"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK3014",
"severity": "error",
"range": {
"start": { "byteOffset": 44, "line": 4, "column": 3 },
"end": { "byteOffset": 54, "line": 4, "column": 13 }
}
},
{
"code": "STK4002",
"severity": "warning",
"range": {
"start": { "byteOffset": 62, "line": 5, "column": 8 },
"end": { "byteOffset": 65, "line": 5, "column": 11 }
}
}
]
}
32 changes: 32 additions & 0 deletions conformance/invalid/duplicate-theme-dense-node/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
stack 1.0
diagram "Dense" {
theme light
theme dark
node hub "Hub"
node n0 "N 0"
node n1 "N 1"
node n2 "N 2"
node n3 "N 3"
node n4 "N 4"
node n5 "N 5"
node n6 "N 6"
node n7 "N 7"
node n8 "N 8"
node n9 "N 9"
node n10 "N 10"
node n11 "N 11"
node n12 "N 12"
edge hub -> n0
edge hub -> n1
edge hub -> n2
edge hub -> n3
edge hub -> n4
edge hub -> n5
edge hub -> n6
edge hub -> n7
edge hub -> n8
edge hub -> n9
edge hub -> n10
edge hub -> n11
edge hub -> n12
}
29 changes: 29 additions & 0 deletions conformance/invalid/edge-rules/expected.diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK3007",
"severity": "error",
"range": {
"start": { "byteOffset": 61, "line": 3, "column": 34 },
"end": { "byteOffset": 67, "line": 3, "column": 40 }
}
},
{
"code": "STK3005",
"severity": "error",
"range": {
"start": { "byteOffset": 85, "line": 5, "column": 3 },
"end": { "byteOffset": 96, "line": 5, "column": 14 }
}
},
{
"code": "STK3006",
"severity": "error",
"range": {
"start": { "byteOffset": 113, "line": 7, "column": 3 },
"end": { "byteOffset": 124, "line": 7, "column": 14 }
}
}
]
}
8 changes: 8 additions & 0 deletions conformance/invalid/edge-rules/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
stack 1.0
diagram "Edges" {
node a "A" { kind service kind worker }
node b "B"
edge a -> a
edge a -- b
edge b -- a
}
13 changes: 13 additions & 0 deletions conformance/invalid/empty-diagram/expected.diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK4003",
"severity": "error",
"range": {
"start": { "byteOffset": 10, "line": 2, "column": 1 },
"end": { "byteOffset": 28, "line": 2, "column": 19 }
}
}
]
}
2 changes: 2 additions & 0 deletions conformance/invalid/empty-diagram/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
stack 1.0
diagram "Empty" {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK2001",
"severity": "error",
"range": {
"start": { "byteOffset": 0, "line": 1, "column": 1 },
"end": { "byteOffset": 9, "line": 1, "column": 10 }
}
},
{
"code": "STK3008",
"severity": "error",
"range": {
"start": { "byteOffset": 18, "line": 2, "column": 9 },
"end": { "byteOffset": 25, "line": 2, "column": 16 }
}
},
{
"code": "STK3009",
"severity": "error",
"range": {
"start": { "byteOffset": 36, "line": 3, "column": 9 },
"end": { "byteOffset": 41, "line": 3, "column": 14 }
}
},
{
"code": "STK3001",
"severity": "error",
"range": {
"start": { "byteOffset": 60, "line": 4, "column": 8 },
"end": { "byteOffset": 63, "line": 4, "column": 11 }
}
},
{
"code": "STK3008",
"severity": "error",
"range": {
"start": { "byteOffset": 64, "line": 4, "column": 12 },
"end": { "byteOffset": 66, "line": 4, "column": 14 }
}
},
{
"code": "STK3001",
"severity": "error",
"range": {
"start": { "byteOffset": 74, "line": 5, "column": 8 },
"end": { "byteOffset": 77, "line": 5, "column": 11 }
}
},
{
"code": "STK3002",
"severity": "error",
"range": {
"start": { "byteOffset": 74, "line": 5, "column": 8 },
"end": { "byteOffset": 77, "line": 5, "column": 11 }
}
},
{
"code": "STK3003",
"severity": "error",
"range": {
"start": { "byteOffset": 97, "line": 6, "column": 8 },
"end": { "byteOffset": 104, "line": 6, "column": 15 }
}
},
{
"code": "STK3004",
"severity": "error",
"range": {
"start": { "byteOffset": 108, "line": 6, "column": 19 },
"end": { "byteOffset": 113, "line": 6, "column": 24 }
}
}
]
}
7 changes: 7 additions & 0 deletions conformance/invalid/independent-semantic-errors/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
stack 2.0
diagram " Bad " {
group empty "Empty" {}
node Bad ""
node Bad "Duplicate"
edge missing -> empty
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK1003",
"severity": "error",
"range": {
"start": { "byteOffset": 23, "line": 2, "column": 14 },
"end": { "byteOffset": 23, "line": 2, "column": 14 }
}
}
]
}
4 changes: 4 additions & 0 deletions conformance/invalid/invalid-string-escape/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
stack 1.0
diagram "Bad\q" {
node api "API"
}
13 changes: 13 additions & 0 deletions conformance/invalid/invalid-utf8/expected.diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK1001",
"severity": "error",
"range": {
"start": { "byteOffset": 17, "line": 2, "column": 5 },
"end": { "byteOffset": 17, "line": 2, "column": 5 }
}
}
]
}
2 changes: 2 additions & 0 deletions conformance/invalid/invalid-utf8/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
stack 1.0
// 図�
37 changes: 37 additions & 0 deletions conformance/invalid/layout-rules/expected.diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK3012",
"severity": "error",
"range": {
"start": { "byteOffset": 100, "line": 7, "column": 15 },
"end": { "byteOffset": 104, "line": 7, "column": 19 }
}
},
{
"code": "STK3011",
"severity": "error",
"range": {
"start": { "byteOffset": 123, "line": 8, "column": 19 },
"end": { "byteOffset": 130, "line": 8, "column": 26 }
}
},
{
"code": "STK3011",
"severity": "error",
"range": {
"start": { "byteOffset": 146, "line": 9, "column": 15 },
"end": { "byteOffset": 147, "line": 9, "column": 16 }
}
},
{
"code": "STK3012",
"severity": "error",
"range": {
"start": { "byteOffset": 155, "line": 11, "column": 3 },
"end": { "byteOffset": 181, "line": 11, "column": 29 }
}
}
]
}
12 changes: 12 additions & 0 deletions conformance/invalid/layout-rules/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
stack 1.0
diagram "Layout" {
node a "A"
node b "B"
layout {
direction right
direction down
rank same [a, missing]
order [a, a]
}
layout { direction right }
}
21 changes: 21 additions & 0 deletions conformance/invalid/nested-group-icon/expected.diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK3010",
"severity": "error",
"range": {
"start": { "byteOffset": 113, "line": 6, "column": 15 },
"end": { "byteOffset": 117, "line": 6, "column": 19 }
}
},
{
"code": "STK3013",
"severity": "error",
"range": {
"start": { "byteOffset": 161, "line": 7, "column": 35 },
"end": { "byteOffset": 171, "line": 7, "column": 45 }
}
}
]
}
12 changes: 12 additions & 0 deletions conformance/invalid/nested-group-icon/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
stack 1.0
diagram "Nested" {
group one "One" {
group two "Two" {
group three "Three" {
group four "Four" {
node leaf "Leaf" { icon "Bad_icon" }
}
}
}
}
}
13 changes: 13 additions & 0 deletions conformance/invalid/unexpected-end/expected.diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK2003",
"severity": "error",
"range": {
"start": { "byteOffset": 50, "line": 4, "column": 1 },
"end": { "byteOffset": 50, "line": 4, "column": 1 }
}
}
]
}
3 changes: 3 additions & 0 deletions conformance/invalid/unexpected-end/source.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
stack 1.0
diagram "Incomplete" {
node api "API"
13 changes: 13 additions & 0 deletions conformance/invalid/unexpected-token/expected.diagnostics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"schemaVersion": "1.0",
"diagnostics": [
{
"code": "STK2002",
"severity": "error",
"range": {
"start": { "byteOffset": 35, "line": 3, "column": 3 },
"end": { "byteOffset": 41, "line": 3, "column": 9 }
}
}
]
}
Loading