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
Copy file name to clipboardExpand all lines: guides/new-version.md
+51-1Lines changed: 51 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,57 @@ This guide is designed to be compatible with LLMs such as Claude Code. Example p
31
31
32
32
<summary>Instructions for LLMs</summary>
33
33
34
-
**Important:** Fetch and read https://rfd.shared.oxide.computer/rfd/0619/raw without summarizing it. This RFD contains the desired state and provides context for operations.
34
+
Follow this guide exactly, systematically, and precisely. Pay attention to section headings.
35
+
36
+
**Background:** Fetch and read https://rfd.shared.oxide.computer/rfd/0619/raw without summarizing it. This RFD contains the desired state and provides context for operations.
37
+
38
+
**Locating files:**
39
+
40
+
- The API trait is at `{api-name}-api/src/lib.rs`.
41
+
- The implementation is typically at `{server-crate}/src/http_entrypoints.rs`, though it may sometimes be in a different file.
42
+
- The versions crate is typically at `{api-name}-types/versions/src/lib.rs` or `{api-name}/types/versions/src/lib.rs`.
43
+
44
+
**Import patterns:**
45
+
46
+
In API traits, always import `latest` and `vN` modules with `use foo_versions::{latest, v1, v2, ...};`. Then, use `vN::path::Type` for prior versions or `latest::path::Type` for the newest versions, never the fully-qualified `foo_versions::vN::path::Type`.
47
+
48
+
**Common mistakes to avoid:**
49
+
50
+
1. Don't use floating identifiers (`latest::`) for prior versions of endpoints.
51
+
2. Don't use versioned identifiers (`vN::`) for the latest version of endpoints.
52
+
3. Don't add types to the API crate. All types should live in the versions crate.
53
+
4. Don't put functional (non-conversion-related) code next to versioned types. Put them in the `impls` module in the versions crate.
54
+
5. The `vN::` impl signatures must exactly match the trait signatures (`vN::` paths).
55
+
6. For trait endpoints with `latest::`, the impl must import the floating identifier **from the types crate**, not the versions crate.
56
+
7. Retain all existing comments. Don't add useless comments. Be extremely sparing with added prose.
57
+
8. Don't make unrelated changes. Focus only on the new version being added.
58
+
59
+
**Order of operations:**
60
+
61
+
1. Determine the next API version number and add it to `api_versions!`.
62
+
2. Add new or changed types to a new version module in the versions crate.
63
+
3. Add type conversions from/to the prior version.
64
+
4. Update re-exports in `latest.rs`.
65
+
5. Update the types crate if new modules are added.
66
+
6. Update the API trait (rename old endpoints, add new endpoints).
67
+
7. Regenerate OpenAPI documents.
68
+
8. Update API implementations.
69
+
9. Move non-conversion methods to newer types if needed.
70
+
71
+
**After each major step, run:**
72
+
73
+
```
74
+
cargo fmt
75
+
cargo check -p {api-crate} -p {server-crate}
76
+
```
77
+
78
+
**After completing all steps, run:**
79
+
80
+
```
81
+
cargo xtask openapi check
82
+
```
83
+
84
+
This verifies that blessed API versions remain compatible and locally-added versions are correctly generated.
0 commit comments