You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -36,6 +25,7 @@ Highlight important bits of the PR that will make the review faster. If there ar
36
25
-[ ] Commit sequence broadly makes sense and commits have useful messages
37
26
-[ ] New tests are added if needed and existing tests are updated. See [Running tests](https://github.com/input-output-hk/cardano-node-wiki/wiki/Running-tests) for more details
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+78Lines changed: 78 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,3 +30,81 @@ source-repository-package
30
30
```
31
31
32
32
These lines are **comments** (ignored by cabal) but are consumed by Nix tooling to fetch the package source. The hash is computed using a different fetch method than the `sha256` in `flake.nix` (which uses `fetchgit`), so the two values will **intentionally differ**. Do **not** flag a mismatch between a `--sha256:` comment in `cabal.project` and the corresponding `sha256` in `flake.nix` as an error.
33
+
34
+
## Breaking Change Detection (CRITICAL)
35
+
36
+
When reviewing PRs, you MUST rigorously check for breaking changes and verify they are correctly classified in the changelog fragment (`.changes/*.yml`). This is the single most important aspect of PR review for this project. cardano-api is a foundational library -- downstream consumers (cardano-cli, cardano-node, dApps, tooling) break silently when we get this wrong.
37
+
38
+
### What constitutes a breaking change
39
+
40
+
Any of the following in an **exposed module** is a breaking change. Exposed modules are those listed under `exposed-modules:` in the `library` stanza of a `.cabal` file. Changes to `other-modules:` (internal modules) are NOT breaking unless they affect the behaviour of exposed API.
41
+
42
+
#### Type-level breaks
43
+
- Removing or renaming an exported type, data constructor, type class, or type family
44
+
- Adding a field to a record that uses non-record syntax (positional constructors)
45
+
- Adding a required field to a record constructor (even with named fields)
46
+
- Removing a field from any data constructor
47
+
- Changing the type of an existing field or function argument
48
+
- Changing a type synonym or type family equation
49
+
- Narrowing a type signature (making it less polymorphic) on an exported function
50
+
- Adding a new constraint to an exported function's type signature
51
+
- Changing the kind of a type variable
52
+
- Removing a type class instance that was previously exported
53
+
54
+
#### Value-level breaks
55
+
- Removing or renaming an exported function or value
56
+
- Changing the number or order of arguments to an exported function
57
+
- Changing default values or smart constructor behaviour in ways that alter semantics
58
+
- Changing the semantics of an exported function (different return value for same input) -- this is a **behavioural** break even if the type signature is unchanged
59
+
60
+
#### Module-level breaks
61
+
- Removing an exposed module entirely
62
+
- Removing re-exports from an exposed module (e.g. a module that re-exported `Foo(..)` no longer does)
63
+
- Moving a definition from an exposed module to an internal module without re-exporting it
64
+
65
+
#### Dependency-level breaks
66
+
- Bumping a major version of a dependency that is transitively exposed in the public API (e.g. types from `cardano-ledger-api` appear in cardano-api's signatures)
67
+
- Removing a dependency whose types appear in the public API
68
+
69
+
#### Things that are NOT breaking
70
+
- Adding new exported functions, types, or modules (this is `feature` or `compatible`)
71
+
- Adding new type class instances (unless orphans that could cause overlap)
72
+
- Adding optional fields with defaults to records using `HasField` / lenses
73
+
- Changes to internal modules (`Cardano.Api.Internal.*`, `other-modules:`) that do not change exposed behaviour
74
+
- Documentation, test, or refactoring changes with no API surface impact
75
+
- Performance improvements with identical semantics
76
+
77
+
### Verifying the changelog fragment
78
+
79
+
Every PR must include a `.changes/*.yml` file. When reviewing:
80
+
81
+
1.**Check the `kind:` field** -- if the PR contains ANY breaking change from the list above, the kind MUST include `breaking`. A PR marked as `feature`, `compatible`, `bugfix`, or anything else that introduces a breaking change is **incorrectly classified** and must be flagged.
82
+
83
+
2.**Check the `project:` field** -- the project must match whichever package's exposed API changed. The projects are: `cardano-api`, `cardano-api-gen`, `cardano-rpc`, `cardano-wasm`.
84
+
85
+
3.**Check the `description:`** -- for breaking changes, the description MUST clearly state what broke and what downstream consumers need to do to adapt. Vague descriptions like "update API" are not acceptable for breaking changes.
86
+
87
+
4.**If no changelog fragment exists**, flag the PR as incomplete. Every PR requires one.
88
+
89
+
5.**If multiple packages are affected**, there should be separate changelog fragments for each, or a single fragment listing multiple projects.
90
+
91
+
### How to review for breaking changes
92
+
93
+
When reviewing a diff:
94
+
95
+
1. First, identify which files are in exposed modules by cross-referencing with the `exposed-modules:` list in the relevant `.cabal` file.
96
+
2. For each changed exposed module, check every removed or modified line against the breaking change categories above.
- Changes to re-export modules like `Cardano.Api` (the main entry point re-exports heavily)
103
+
4. If a change touches `Cardano.Api` or `Cardano.Api.Experimental` (the main re-export modules), scrutinize especially carefully -- these are the most widely imported modules.
104
+
105
+
### Err on the side of caution
106
+
107
+
When uncertain whether something is breaking:
108
+
-**Flag it as potentially breaking** and ask the author to confirm
109
+
- It is far worse to miss a breaking change than to over-flag one
110
+
- A false positive costs a conversation; a false negative costs every downstream consumer
0 commit comments