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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ will read it.
- `vectors/<feature>.json`: that feature's cases.
- [`benches/`](benches/README.md): the benchmarks every runtime runs, in the
same value encoding.
- [`compiler/`](compiler/readme.md): compiler conformance cases, schema
graphs with the guarantees they give up and the diagnostics a build must
report, for a compiler or any tool that judges a package.
- [`specs/`](specs/readme.md): the format of each of these files, in CUE, and
the JSON Schemas generated from it, which each file names in `$schema`.

Expand Down Expand Up @@ -422,6 +425,9 @@ profile states it until live cross-runtime calls can prove it (see below).

## Implementing the spec

A compiler or another tool that judges packages vendors `compiler/cases/`
instead, and runs it as [`compiler/readme.md`](compiler/readme.md) says.

Vendor `features.json`, `vectors/` and `profiles/` at a pinned commit of this
repository, and `specs/gen/` too if you want their `$schema` to resolve; a
reader ignores it. `catalog/gen/catalog.json` holds the names and their
Expand Down
270 changes: 270 additions & 0 deletions compiler/cases/acceptance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
{
"$schema": "../../specs/gen/compiler.schema.json",
"group": "acceptance",
"cases": [
{
"id": "acceptance/not-accepted",
"description": "an unverified protocol of a dependency has to be accepted",
"packages": [
{
"name": "billing",
"config": "congregation billing\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/api.ids",
"text": "@handshake = \"none\"\n@unverified = \"the 2009 gateway\"\nprotocol Billing {\n function charge();\n}\n"
}
],
"dependencies": []
},
{
"name": "app",
"config": "congregation app\nspecification_version = 1\ndependencies = {\n billing = {\n path = \"../billing\"\n }\n}\n",
"schemas": [
{
"path": "src/api.ids",
"text": "struct A {\n x: u32\n}\n"
}
],
"dependencies": [
{
"name": "billing"
}
]
}
],
"build": "app",
"expect": {
"builds": false,
"diagnostics": [],
"error_contains": [
"protocol `Billing` is unverified, giving up schema agreement and encoding agreement",
"the 2009 gateway"
]
}
},
{
"id": "acceptance/accepted",
"description": "accepted for exactly what it gives up, it builds",
"packages": [
{
"name": "billing",
"config": "congregation billing\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/api.ids",
"text": "@handshake = \"none\"\n@unverified = \"the 2009 gateway\"\nprotocol Billing {\n function charge();\n}\n"
}
],
"dependencies": []
},
{
"name": "app",
"config": "congregation app\nspecification_version = 1\ndependencies = {\n billing = {\n path = \"../billing\"\n accept_unverified = { Billing = [\"schema_agreement\", \"encoding_agreement\"] }\n }\n}\n",
"schemas": [
{
"path": "src/api.ids",
"text": "struct A {\n x: u32\n}\n"
}
],
"dependencies": [
{
"name": "billing",
"accept_unverified": {
"Billing": [
"schema_agreement",
"encoding_agreement"
]
}
}
]
}
],
"build": "app",
"expect": {
"protocols": [],
"builds": true,
"diagnostics": []
}
},
{
"id": "acceptance/accepted-for-less",
"description": "accepted for less than it gives up, it stops again",
"packages": [
{
"name": "billing",
"config": "congregation billing\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/api.ids",
"text": "@handshake = \"none\"\n@unverified = \"the 2009 gateway\"\nprotocol Billing {\n function charge();\n}\n"
}
],
"dependencies": []
},
{
"name": "app",
"config": "congregation app\nspecification_version = 1\ndependencies = {\n billing = {\n path = \"../billing\"\n accept_unverified = { Billing = [\"schema_agreement\"] }\n }\n}\n",
"schemas": [
{
"path": "src/api.ids",
"text": "struct A {\n x: u32\n}\n"
}
],
"dependencies": [
{
"name": "billing",
"accept_unverified": {
"Billing": [
"schema_agreement"
]
}
}
]
}
],
"build": "app",
"expect": {
"builds": false,
"diagnostics": [],
"error_contains": [
"protocol `Billing` now gives up schema agreement and encoding agreement",
"it was accepted for schema agreement"
]
}
},
{
"id": "acceptance/accepted-for-more",
"description": "accepted for more than it gives up, it stops too: the set has to match exactly",
"packages": [
{
"name": "billing",
"config": "congregation billing\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/api.ids",
"text": "@handshake = \"none\"\n@unverified = \"the 2009 gateway\"\nprotocol Billing {\n function charge();\n}\n"
}
],
"dependencies": []
},
{
"name": "app",
"config": "congregation app\nspecification_version = 1\ndependencies = {\n billing = {\n path = \"../billing\"\n accept_unverified = { Billing = [\"schema_agreement\", \"encoding_agreement\", \"bounded_size\"] }\n }\n}\n",
"schemas": [
{
"path": "src/api.ids",
"text": "struct A {\n x: u32\n}\n"
}
],
"dependencies": [
{
"name": "billing",
"accept_unverified": {
"Billing": [
"schema_agreement",
"encoding_agreement",
"bounded_size"
]
}
}
]
}
],
"build": "app",
"expect": {
"builds": false,
"diagnostics": [],
"error_contains": [
"protocol `Billing` now gives up schema agreement and encoding agreement"
]
}
},
{
"id": "acceptance/package-reasons-shown",
"description": "what the package said once is what the consumer is shown to accept",
"packages": [
{
"name": "billing",
"config": "congregation billing\nspecification_version = 1\nhandshake = \"none\"\nunverified = {\n schema_agreement = \"the gateway pins schemas by contract\"\n encoding_agreement = \"the gateway only speaks one encoding\"\n}\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/api.ids",
"text": "protocol Billing {\n function charge();\n}\n"
}
],
"dependencies": []
},
{
"name": "app",
"config": "congregation app\nspecification_version = 1\ndependencies = {\n billing = {\n path = \"../billing\"\n }\n}\n",
"schemas": [
{
"path": "src/api.ids",
"text": "struct A {\n x: u32\n}\n"
}
],
"dependencies": [
{
"name": "billing"
}
]
}
],
"build": "app",
"expect": {
"builds": false,
"diagnostics": [],
"error_contains": [
"protocol `Billing` is unverified, giving up schema agreement and encoding agreement",
"schema agreement \"the gateway pins schemas by contract\"",
"encoding agreement \"the gateway only speaks one encoding\""
]
}
},
{
"id": "acceptance/judged-by-its-own-package",
"description": "a dependency is judged by its own package's settings and default handshake, not the consumer's",
"packages": [
{
"name": "billing",
"config": "congregation billing\nspecification_version = 1\nhandshake = \"none\"\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/api.ids",
"text": "@unverified = \"the 2009 gateway\"\nprotocol Billing {\n function charge();\n}\n"
}
],
"dependencies": []
},
{
"name": "app",
"config": "congregation app\nspecification_version = 1\ndependencies = {\n billing = {\n path = \"../billing\"\n accept_unverified = { Billing = [\"schema_agreement\", \"encoding_agreement\"] }\n }\n}\n",
"schemas": [
{
"path": "src/api.ids",
"text": "struct A {\n x: u32\n}\n"
}
],
"dependencies": [
{
"name": "billing",
"accept_unverified": {
"Billing": [
"schema_agreement",
"encoding_agreement"
]
}
}
]
}
],
"build": "app",
"expect": {
"protocols": [],
"builds": true,
"diagnostics": []
}
}
]
}
Loading
Loading