|
| 1 | +# CALM Schema - AI Assistant Guide |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +The `calm/` directory holds the **CALM JSON Meta Schema** — the authoritative definition of |
| 6 | +the Common Architecture Language Model. Everything here is specification, not application code: |
| 7 | +JSON Schema documents under `meta/`, reference components (`controls/`, `interfaces/`), worked |
| 8 | +examples, and the governance process that controls how the schema evolves. |
| 9 | + |
| 10 | +Also include all rules from [the root level AGENTS.md](../AGENTS.md). |
| 11 | + |
| 12 | +The human-facing governance process lives in [`README.md`](README.md) and is authoritative. |
| 13 | +This guide is the machine-facing summary of *how to make a schema change correctly* — read it |
| 14 | +before editing anything under `calm/`. |
| 15 | + |
| 16 | +## Directory Layout |
| 17 | + |
| 18 | +``` |
| 19 | +calm/ |
| 20 | +├── draft/<issue-number>/ # In-progress schema changes (freely editable) |
| 21 | +│ ├── meta/ # the proposed schema documents |
| 22 | +│ └── prototype/ # examples demonstrating the change |
| 23 | +├── release/<version>/ # Published, IMMUTABLE releases (1.0, 1.1, 1.2, …) |
| 24 | +│ └── meta/ # the published schema documents |
| 25 | +├── release/<version>-rcN/ # Release candidates (e.g. 1.0-rc1) — siblings of the release, during testing |
| 26 | +├── controls/ # Golden-source standardised control definitions |
| 27 | +├── interfaces/ # Golden-source standardised interface definitions |
| 28 | +├── architecture/ # Reference architectures (e.g. calm-1.json, calm-2.json) |
| 29 | +└── getting-started/ # Tutorial material |
| 30 | +``` |
| 31 | + |
| 32 | +## Critical Rules for Schema Changes |
| 33 | + |
| 34 | +### 1. Never edit a released schema |
| 35 | + |
| 36 | +Everything under `calm/release/<version>/` is **immutable** once published. Each schema is pinned |
| 37 | +by its `$id` (e.g. `https://calm.finos.org/release/1.2/meta/interface.json`), and existing |
| 38 | +architectures resolve against those URLs. Editing a released schema is a silent breaking change. |
| 39 | + |
| 40 | +To change the schema, you create or edit a **draft** — never a release. |
| 41 | + |
| 42 | +### 2. All schema work goes in `calm/draft/<issue-number>/` |
| 43 | + |
| 44 | +- A schema change starts with a GitHub issue (see step 1 of the workflow below). |
| 45 | +- The proposed schema lives in `calm/draft/<issue-number>/meta/`. |
| 46 | +- Worked examples demonstrating the change live in `calm/draft/<issue-number>/prototype/`. |
| 47 | +- Drafts are **freely editable** — iterate without restriction; acceptance as a draft is not a |
| 48 | + guarantee it will be released. |
| 49 | + |
| 50 | +### 3. Provide prototype examples |
| 51 | + |
| 52 | +A schema change without an example is incomplete. Add at least one example architecture under |
| 53 | +`prototype/` that exercises the new or changed construct, so reviewers and tooling can validate it. |
| 54 | + |
| 55 | +## Schema Change Workflow |
| 56 | + |
| 57 | +1. **Propose** — open a GitHub issue using the |
| 58 | + [Schema Change Proposal template](https://github.com/finos/architecture-as-code/issues/new?template=Schema_change_proposal.md). |
| 59 | +2. **Draft** — implement the change in `calm/draft/<issue-number>/meta/`, with examples in |
| 60 | + `calm/draft/<issue-number>/prototype/`. |
| 61 | +3. **Review** — schema PRs require approval from at least one member of the |
| 62 | + [`calm-schema-governance`](https://github.com/orgs/finos/teams/calm-schema-governance) team. |
| 63 | +4. **Validate** — when selected for release, the draft must pass validation against the CALM CLI |
| 64 | + and CALM Hub, including backward-compatibility checks. |
| 65 | +5. **Release** — a Release Candidate is published under `calm/release/`, tested by the community |
| 66 | + for four weeks, then promoted to an official release with a changelog (and migration guide for |
| 67 | + breaking changes). |
| 68 | + |
| 69 | +See [`README.md`](README.md) for the full governance detail, roles, and release policy. |
| 70 | + |
| 71 | +## Tooling Impact |
| 72 | + |
| 73 | +Schema changes ripple into the TypeScript tooling — account for these when proposing a change: |
| 74 | + |
| 75 | +- **Validation rules** — structural JSON Schema constraints are enforced by the meta schema, but |
| 76 | + cross-reference and semantic checks (e.g. "a referenced interface exists on the target node") |
| 77 | + live in Spectral rules under `shared/src/spectral/`. A schema change that adds a referential |
| 78 | + constraint usually needs a matching Spectral rule and tests. |
| 79 | +- **Bundled schemas** — `shared` resolves schemas via its schema directory; a new schema version |
| 80 | + must be wired in there for the CLI and Hub to recognise it. |
| 81 | +- **CLI + Hub** — both must validate cleanly against a new schema before it is released. |
| 82 | + |
| 83 | +When tightening a constraint (e.g. adding `additionalProperties: false`, adding a `required` |
| 84 | +field, or narrowing a type), treat it as **potentially breaking**: only existing draft schemas may |
| 85 | +change freely; the same change against a release requires a new version and migration guidance. |
0 commit comments