Skip to content

Commit cbac189

Browse files
committed
docs: add ADR template and contribution process
- Require ADRs for normative specification changes and document the validation workflow. - Add a project-adapted ADR template and align existing ADR headings with it. Signed-off-by: Aviator 5 <ai.agent.tor@gmail.com>
1 parent 5489fb7 commit cbac189

7 files changed

Lines changed: 127 additions & 29 deletions

CONTRIBUTING.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,36 @@ Thank you for your interest in contributing to the Global Type System (GTS) Spec
77
### Prerequisites
88

99
- **Git** for version control
10-
- **JSON Schema validator** (optional, for testing schema examples)
11-
- **Python 3.8+** (optional, for running reference implementations)
10+
- **Node.js 20+ and `ajv-cli`** (optional, for validating JSON Schema examples as CI does)
11+
- **Python 3.9–3.14** (optional, for working on the conformance test suite)
12+
- **Docker** (optional, and recommended for running the conformance test suite)
1213
- **Your favorite editor** (VS Code with JSON Schema support recommended)
1314

1415
### Development Setup
1516

1617
```bash
1718
# Clone the repository
18-
git clone <repository-url>
19+
git clone https://github.com/GlobalTypeSystem/gts-spec.git
1920
cd gts-spec
2021

21-
# Optional: Install Python dependencies for reference implementations
22-
pip install jsonschema
23-
24-
# Optional: Install JSON Schema validator
22+
# Optional: install the JSON Schema validator used by CI
2523
npm install -g ajv-cli
2624
```
2725

26+
The conformance tests run against an external GTS implementation over HTTP; this repository does not contain a reference implementation. See [`tests/README.md`](tests/README.md) for Docker and local Python setup.
27+
2828
### Repository Layout
2929

3030
```
3131
gts-spec/
32-
├── README.md # Main specification document
32+
├── README.md # Normative specification
3333
├── CONTRIBUTING.md # This file
34-
├── LICENSE # License information
35-
── examples/ # Example GTS Types and instances
36-
├── events/ # Event-related examples
37-
├── types/ # GTS Type Schemas (JSON Schema documents)
38-
└── instances/ # JSON instance examples
39-
└── ... # Other domain examples
34+
├── LICENSE # License
35+
── NOTICE # Attribution notices
36+
├── adr/ # Architecture Decision Records (+ template.md)
37+
├── examples/ # GTS Types and Instances in JSON, YAML, and TypeSpec
38+
├── tests/ # Implementation-independent HTTP conformance tests
39+
└── .github/workflows/ # CI and release workflows
4040
```
4141

4242
## Development Workflow
@@ -57,16 +57,26 @@ Use descriptive branch names:
5757

5858
Follow the specification standards and patterns described below.
5959

60+
#### Specification changes require an ADR
61+
62+
Any proposal that adds normative behavior to the specification or intentionally changes existing normative behavior **MUST go through the Architecture Decision Record (ADR) process**. Start by copying the project-adapted MADR [`ADR template`](adr/template.md) to the next sequentially numbered file under [`adr/`](adr/) and fill in all applicable sections. The specification, tests, and examples must reference or implement the decision where applicable.
63+
64+
Open the pull request with the ADR already at **`Status: Accepted`** — the decision is what is under review, so accepting the ADR *is* merging the pull request. There is no separate approval step and no `Proposed` state in the repository: an ADR on `main` is accepted by definition. A decision that is later replaced keeps its file and moves to `Status: Superseded`, with `Superseded by` pointing at the ADR that replaces it (and that ADR's `Supersedes` pointing back). The ADR may be reviewed in its own pull request or together with the resulting specification change; either way it must not be merged before the reviewers agree on the decision itself.
65+
66+
A confirmed bug fix does not require a new ADR when it only restores behavior already established by the specification or an accepted ADR. If fixing the issue requires choosing new semantics, it is a specification change and therefore requires an ADR.
67+
6068
### 3. Validate Your Changes
6169

6270
```bash
63-
# Validate all schemas in a directory
64-
ajv compile --strict=false -s "examples/events/types/*.schema.json"
71+
# Validate the JSON Schema examples covered by CI
72+
ajv compile -s "examples/*/types/*.schema.json" --strict=false
6573

66-
# Run Python reference implementation tests (if available)
67-
python -m pytest tests/
74+
# Run the conformance tests against a GTS server already listening on port 8000
75+
python -m pytest tests/ --gts-base-url http://127.0.0.1:8000
6876
```
6977

78+
Run the checks relevant to the files you changed. JSONC, YAML, TypeSpec, nested example directories, and unresolved `gts://` references may require their own format-aware validation in addition to the CI command above. For test-suite setup and targeted test invocations, follow [`tests/README.md`](tests/README.md).
79+
7080
### 4. Commit Changes
7181

7282
Follow a structured commit message format:
@@ -113,8 +123,9 @@ Specification development guidelines:
113123

114124
- Follow GTS identifier format rules strictly
115125
- Ensure all schemas use correct `$id` values
116-
- Validate schemas against JSON Schema Draft 7 or later
126+
- Declare the intended JSON Schema dialect with `$schema` and use keywords valid for that dialect; GTS is dialect-agnostic, while repository examples generally use Draft-07 for interoperability
117127
- Include both GTS Type Schemas (the canonical JSON definitions of types) and GTS Instance examples
128+
- Keep normative specification changes, conformance tests, and examples aligned
118129
- Document any deviations or implementation-specific choices
119130

120131
## Releases
@@ -139,8 +150,8 @@ When the specification moves to the next minor version (e.g. `0.11` → `0.12`),
139150
Releases are produced from `github.com/GlobalTypeSystem/gts-spec`. The workflow is restricted to that repository; pushing a tag from a fork has no effect.
140151

141152
```bash
142-
git tag v0.11.3
143-
git push origin v0.11.3
153+
git tag vX.Y.Z
154+
git push origin vX.Y.Z
144155
```
145156

146157
The [`Release Tests Image`](.github/workflows/release-tests-image.yml) workflow:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,7 @@ Given an inheritance chain `S₀ → S₁ → … → Sₙ`:
16221622
- **`null` at any depth deletes that key** from the effective object (per RFC 7396). The principal use case is to revert an ancestor-set value and let the trait-schema's `default` re-apply via the materialization step described in the Completeness check below — that is, a descendant writes `"<key>": null` to "fall back to the schema default" without picking a specific value. If the deleted key is `required` and has no `default`, the completeness check (OP#13) fails for non-abstract types (the descendant must then either mark itself abstract or accept that "delete + required + no default" is an unresolvable contract). Authors who want `null` as an *intended* trait value cannot express it via this merge and must use a sentinel value documented as part of the trait shape.
16231623
- Defaults declared in the effective trait-schema MUST be materialized into the effective traits object before the Completeness check runs (per ADR-0003): for every property declared in the effective trait-schema with a `default` and not present in the chain-merged object, the registry MUST substitute the default value. The Completeness check below (OP#13) operates on the resulting *materialized* effective traits object.
16241624
- A publisher who wants a trait value to be **locked** across all descendants of a base type SHOULD declare `"const": <value>` for that property in `x-gts-traits-schema`. A descendant attempting to override the value will fail the standard JSON Schema validation that runs against the effective trait-schema (per the Completeness check below). No GTS-specific "immutability" rule is required — `const` is the mechanism.
1625+
- `const` constrains the **value** of a property, not its presence: per standard JSON Schema it asserts nothing when the property is absent. A publisher who additionally wants the trait to survive an RFC 7396 `null` deletion SHOULD either list the property in the containing object schema's `required` array (deletion then fails the Completeness check for non-abstract types) or declare a `default` equal to the `const` value (deletion then becomes a no-op, since materialization restores the value before validation). This is the general presence rule for traits — it is not specific to `const`: any optional inherited trait without a `default` can be removed by a descendant.
16251626
- A descendant MAY redeclare a trait value with the same value the ancestor already declared (idempotent restatement).
16261627
- See [`adr/0004-x-gts-traits-merge-strategy.md`](adr/0004-x-gts-traits-merge-strategy.md) for the rationale.
16271628

adr/0001-derivation-form.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ This ADR does **not** make GTS a [JSON Schema Dialect](https://json-schema.org/l
5656

5757
## Considered Options
5858

59+
- Option 1 — Strict canonical form
60+
- Option 2 — GTS Type Schema as a JSON Schema Extension (dialect-agnostic) *(chosen)*
61+
5962
Both options use the same running example.
6063

6164
### Running example used in this section
@@ -207,7 +210,7 @@ P-OK validates; P-BAD fails. Syntactically valid and semantically compatible —
207210

208211
## Decision Outcome
209212

210-
Chosen: **Option 2 — GTS Type Schema as a JSON Schema Extension (dialect-agnostic).**
213+
Chosen option: **Option 2 — GTS Type Schema as a JSON Schema Extension (dialect-agnostic).**
211214

212215
Key normative consequences:
213216

adr/0002-x-gts-traits-schema.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ ADR-0001 commits GTS to being an **extension of JSON Schema** (dialect-agnostic;
4141

4242
## Considered Options
4343

44-
Two options. Option 2 has two sub-variants (2A and 2B) which we evaluate inside Option 2.
44+
- Option 1 — Trait-type as a separately-registered GTS Type (URI value)
45+
- Option 2 — `x-gts-traits-schema` is a JSON Schema subschema, in two sub-variants:
46+
- Option 2A — Subschema + implicit chain aggregation *(chosen)*
47+
- Option 2B — Subschema + explicit composition by the author
48+
49+
Option 2's sub-variants share the keyword's value space and differ only in who composes the declarations along the chain; they are evaluated inside Option 2 below.
4550

4651
### Option 1 — Trait-type as a separately-registered GTS Type (URI value)
4752

@@ -229,7 +234,7 @@ By construction, any value satisfying the effective trait-schema also satisfies
229234

230235
## Decision Outcome
231236

232-
Chosen: **Option 2A — `x-gts-traits-schema` is a JSON Schema subschema (object OR boolean); the registry composes declarations along the `$id` chain via `allOf`.**
237+
Chosen option: **Option 2A — `x-gts-traits-schema` is a JSON Schema subschema (object OR boolean); the registry composes declarations along the `$id` chain via `allOf`.**
233238

234239
Normative consequences:
235240

adr/0003-x-gts-traits-completeness.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ ADR-0001 commits GTS to being an extension of JSON Schema (dialect-agnostic); AD
9292

9393
## Considered Options
9494

95+
- Option 1 — No spec-level enforcement (author's responsibility)
96+
- Option 2 — Validate at instance creation time
97+
- Option 3 — Validate at type registration (fail fast) *(chosen)*
98+
9599
Three top-level options on **when (or whether) to enforce completeness**.
96100

97101
### Option 1 — No spec-level enforcement (author's responsibility)
@@ -223,7 +227,7 @@ Three ways to make the registration succeed:
223227

224228
## Decision Outcome
225229

226-
Chosen: **Option 3 — validate at type registration; non-abstract types MUST be complete.**
230+
Chosen option: **Option 3 — validate at type registration; non-abstract types MUST be complete.**
227231

228232
### Definition of "complete"
229233

@@ -254,7 +258,7 @@ At the registration of type T:
254258
- **Non-abstract type with required-no-default and no explicit value.** Registration fails. Author resolves by (a) providing `x-gts-traits` value, (b) declaring a `default` in the schema, or (c) marking the type abstract.
255259
- **Final non-abstract type.** Same rule as any non-abstract — must be complete. No special bullet needed.
256260

257-
## Implications
261+
### Implications
258262

259263
- **OP#13 (Schema Traits Validation)** includes this rule; the operation explicitly conditions the completeness step on `x-gts-abstract != true`.
260264
- **§9.7.5** carries the normative wording of the completeness check in the "Validation" bullet block, expressed in terms of "non-abstract types."

0 commit comments

Comments
 (0)