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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ its frontend, compiler, reconstruction, or Workshop integration internally.

## Status

- Protocol versions: **1.0**, additive **1.1** file-entry loading, additive **1.2** directory targets, and additive **1.3** source identity for entry-based compilation, and additive **1.4** artifact format negotiation for `lpp/compile`, and additive **1.5** name lookup via `lpp/lookup` (specified in [`docs/spec/README.md`](docs/spec/README.md)).
- Protocol versions: **1.0**, additive **1.1** file-entry loading, additive **1.2** directory targets, and additive **1.3** source identity for entry-based compilation, and additive **1.4** artifact format negotiation for `lpp/compile`, and additive **1.5** name lookup via `lpp/lookup`, and additive **1.6** canonical id resolution via `lpp/resolveIds` (specified in [`docs/spec/README.md`](docs/spec/README.md)).
- Repository state: initial published contract and conformance suite.
- Wright is a client/consumer of the protocol; LPP is not a dependency from the
language implementation back into Wright tooling internals.
Expand Down
7 changes: 5 additions & 2 deletions conformance/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LPP v1 Conformance Suite

This directory contains the test suite and fixtures for the Language Provider Protocol v1 wire contract, including the LPP 1.1 file-entry, LPP 1.2 directory-target project-loading, LPP 1.3 source-identity, LPP 1.4 artifact-format negotiation, and LPP 1.5 name-lookup revisions (see [`../docs/spec/README.md`](../docs/spec/README.md)).
This directory contains the test suite and fixtures for the Language Provider Protocol v1 wire contract, including the LPP 1.1 file-entry, LPP 1.2 directory-target project-loading, LPP 1.3 source-identity, LPP 1.4 artifact-format negotiation, LPP 1.5 name-lookup, and LPP 1.6 canonical-id-resolution revisions (see [`../docs/spec/README.md`](../docs/spec/README.md)).

## Layout

Expand All @@ -12,7 +12,7 @@ mock-provider/ Reference provider for the "x-demo-lang" equation DSL (Ru
runner/ Conformance runner that replays fixtures against any provider binary
```

* **Fixtures** (`fixtures/v1/`): one JSON file per scenario. Each scenario defines a session with request/response steps, optional CLI flags, and the expected exit code. Responses are compared after JSON parsing so key order does not matter. The directory contains LPP 1.0, LPP 1.1, LPP 1.2, LPP 1.3, LPP 1.4, and LPP 1.5 scenarios. `fixtures/v1/sessions/` holds the standard initialize/shutdown handshake once per protocol version; a scenario whose steps don't themselves exercise the handshake sets `"session": "<version>"` and the runner splices those steps around its own.
* **Fixtures** (`fixtures/v1/`): one JSON file per scenario. Each scenario defines a session with request/response steps, optional CLI flags, and the expected exit code. Responses are compared after JSON parsing so key order does not matter. The directory contains LPP 1.0, LPP 1.1, LPP 1.2, LPP 1.3, LPP 1.4, LPP 1.5, and LPP 1.6 scenarios. `fixtures/v1/sessions/` holds the standard initialize/shutdown handshake once per protocol version; a scenario whose steps don't themselves exercise the handshake sets `"session": "<version>"` and the runner splices those steps around its own.
* **Mock provider** (`mock-provider/`): a small Rust binary implementing the full LPP v1 surface for a demonstration language distinct from OPY and OSTW. It runs over stdio so clients (like the Wright LPP client in wrightkit/wright#142) can test against it directly.
* **Runner** (`runner/`): spawns a fresh provider process per scenario, feeds requests over stdin, validates stdout responses against expectations, and checks the process exit code. Expected responses compare verbatim except at leaves a fixture marks provider-supplied (see the scenario format below).

Expand Down Expand Up @@ -154,6 +154,9 @@ Semantics exercised by the fixtures:
and `start` settings, and the arithmetic operators, which form the
`x-demo:enum/operator` enum domain — returned as ranked entries with
callable, enum-domain, parameter, and setting facts.
* **resolveIds**: a fixed table that spells `applyImpulse` and
`setStatusEffect` as `shove` and `afflict` and `Status`/`STUNNED` as
`stunned`; every other id is unmapped and omitted.

The mock provider binary accepts `--without <capability>,...` to disable
capabilities at runtime, which the capability-negotiation fixtures use. A
Expand Down
12 changes: 12 additions & 0 deletions conformance/fixtures/v1/62-resolve-ids-mapping.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "resolve-ids-mapping",
"description": "resolveIds maps requested canonical ids to the language's spellings: calls by id, enum members grouped by domain. Ids the language does not map, and domains with no mapped member, are omitted rather than reported.",
"scope": "semantics",
"session": "1.6",
"providerArgs": ["--protocol-version", "1.6"],
"steps": [
{"request":{"id":2,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang","calls":["applyImpulse","setStatusEffect"],"enums":{"Status":["STUNNED"]}}},"expectResponse":{"result":{"calls":{"applyImpulse":"shove","setStatusEffect":"afflict"},"enums":{"Status":{"STUNNED":"stunned"}}}}},
{"request":{"id":3,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang","calls":["applyImpulse","loweredOnlyConstruct"],"enums":{"Status":["STUNNED","UNMAPPED_MEMBER"],"UnmappedDomain":["ANY"]}}},"expectResponse":{"result":{"calls":{"applyImpulse":"shove"},"enums":{"Status":{"STUNNED":"stunned"}}}}},
{"request":{"id":4,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang"}},"expectResponse":{"result":{"calls":{},"enums":{}}}}
]
}
12 changes: 12 additions & 0 deletions conformance/fixtures/v1/63-resolve-ids-capability-unavailable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "resolve-ids-capability-unavailable",
"description": "A 1.6 provider may decline resolveIds independently: it advertises resolveIds false and answers lpp/resolveIds with capabilityUnavailable while lookup keeps working.",
"scope": "protocol",
"providerArgs": ["--protocol-version", "1.6", "--without", "resolveIds"],
"steps": [
{"request":{"id":1,"method":"lpp/initialize","params":{"protocolVersion":"1.6"}},"expectResponse":{"result":{"protocolVersion":"1.6","serverInfo":{"name":{"$provider":"nonEmptyString"},"version":{"$provider":"nonEmptyString"}},"languages":{"$provider":"languageList"},"capabilities":{"check":true,"compile":true,"reconstruct":true,"symbols":true,"definition":true,"references":true,"rename":true,"editValidation":true,"projectLoading":true,"sourceIdentity":true,"lookup":true,"resolveIds":false}}}},
{"request":{"id":2,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang","calls":["applyImpulse"]}},"expectResponse":{"error":{"code":-32000,"message":{"$provider":"nonEmptyString"},"data":{"lpp":{"kind":"capabilityUnavailable","details":{"capability":"resolveIds","method":"lpp/resolveIds"}}}}}},
{"request":{"id":3,"method":"lpp/lookup","params":{"languageId":"x-demo-lang","query":"multiply","kind":"operator"}},"expectResponse":{"result":{"entries":[{"identity":"x-demo:operator/multiply","kind":"operator","spelling":"*","displayName":"multiply","callable":{"receiver":"integer","parameters":[{"name":"arg","type":"integer","required":true}]}}]}}},
{"request":{"id":4,"method":"lpp/shutdown","params":{}},"expectResponse":{"result":null}}
]
}
10 changes: 10 additions & 0 deletions conformance/fixtures/v1/64-resolve-ids-version-gate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "resolve-ids-version-gate",
"description": "lpp/resolveIds exists only in LPP 1.6 sessions: a 1.5 provider does not advertise it and answers the method with capabilityUnavailable.",
"scope": "protocol",
"session": "1.5",
"providerArgs": ["--protocol-version", "1.5"],
"steps": [
{"request":{"id":2,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang","calls":["applyImpulse"]}},"expectResponse":{"error":{"code":-32000,"message":{"$provider":"nonEmptyString"},"data":{"lpp":{"kind":"capabilityUnavailable","details":{"capability":"resolveIds","method":"lpp/resolveIds"}}}}}}
]
}
10 changes: 10 additions & 0 deletions conformance/fixtures/v1/65-resolve-ids-invalid-language.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "resolve-ids-invalid-language",
"description": "A languageId the provider does not serve is refused with invalidLanguage.",
"scope": "protocol",
"session": "1.6",
"providerArgs": ["--protocol-version", "1.6"],
"steps": [
{"request":{"id":2,"method":"lpp/resolveIds","params":{"languageId":"not-a-language","calls":["applyImpulse"]}},"expectResponse":{"error":{"code":-32000,"message":{"$provider":"nonEmptyString"},"data":{"lpp":{"kind":"invalidLanguage","details":{"languageId":"not-a-language"}}}}}}
]
}
14 changes: 14 additions & 0 deletions conformance/fixtures/v1/66-resolve-ids-invalid-params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "resolve-ids-invalid-params",
"description": "Malformed resolveIds params are rejected with -32602: a missing languageId, wrong element types, and wrong container types.",
"scope": "protocol",
"session": "1.6",
"providerArgs": ["--protocol-version", "1.6"],
"steps": [
{"request":{"id":2,"method":"lpp/resolveIds","params":{"calls":["applyImpulse"]}},"expectResponse":{"error":{"code":-32602,"message":{"$provider":"nonEmptyString"}}}},
{"request":{"id":3,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang","calls":[1]}},"expectResponse":{"error":{"code":-32602,"message":{"$provider":"nonEmptyString"}}}},
{"request":{"id":4,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang","calls":"applyImpulse"}},"expectResponse":{"error":{"code":-32602,"message":{"$provider":"nonEmptyString"}}}},
{"request":{"id":5,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang","enums":["Status"]}},"expectResponse":{"error":{"code":-32602,"message":{"$provider":"nonEmptyString"}}}},
{"request":{"id":6,"method":"lpp/resolveIds","params":{"languageId":"x-demo-lang","enums":{"Status":"STUNNED"}}},"expectResponse":{"error":{"code":-32602,"message":{"$provider":"nonEmptyString"}}}}
]
}
Loading
Loading