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/migrating-to-versions-crate.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,11 +43,12 @@ In API traits and their implementations, always import `latest` and `vN` modules
43
43
3. Don't create new re-exports from the API crate.
44
44
4. Don't put functional (non-conversion-related) code next to versioned types. Put them in an `impls` module in the versions crate.
45
45
5. The `vN::` impl signatures must exactly match the trait signatures (`vN::` paths).
46
-
6. For trait endpoints with `latest::`, the impl must import the floating identifier **from the types crate**.
47
-
7. For other types, strongly prefer retaining existing imports. If an existing module imports `iddqd::IdOrdMap` and uses it as `IdOrdMap`, maintain the same pattern in the destination.
48
-
8. Retain all existing comments. Don't add useless comments like "parameter moved from params.rs". Be extremely sparing with added prose.
49
-
9. Don't make any semantic changes. Move code AS IS, as far as possible. This is purely a reorganization.
50
-
10. Do NOT delete any tests. Most tests in the types crate should move into the versions crate's `impls` module. Tests specifically for conversion between versions should be moved to version modules. Tests that use unpublished types can stay in the types crate.
46
+
6. If a prior-version endpoint delegates to a helper function that exclusively serves that old version, the helper's signature must also use `vN::` paths — not floating identifiers from the types crate. Floating identifiers resolve to the latest version today, but will break when the type changes in a future version.
47
+
7. For trait endpoints with `latest::`, the impl must import the floating identifier **from the types crate**.
48
+
8. For other types, strongly prefer retaining existing imports. If an existing module imports `iddqd::IdOrdMap` and uses it as `IdOrdMap`, maintain the same pattern in the destination.
49
+
9. Retain all existing comments. Don't add useless comments like "parameter moved from params.rs". Be extremely sparing with added prose.
50
+
10. Don't make any semantic changes. Move code AS IS, as far as possible. This is purely a reorganization.
51
+
11. Do NOT delete any tests. Most tests in the types crate should move into the versions crate's `impls` module. Tests specifically for conversion between versions should be moved to version modules. Tests that use unpublished types can stay in the types crate.
51
52
52
53
**Order of operations:**
53
54
@@ -405,6 +406,8 @@ impl MyApi for MyApiImpl {
405
406
406
407
If a prior version is turned into a provided method, **remove it from all implementations**.
407
408
409
+
If the implementation delegates to helper functions that exclusively serve prior-version endpoints (e.g. `bgp_admin::get_neighbors_v4`), those helpers must also use `vN::` paths for their parameter and return types — not floating identifiers imported from the types crate.
410
+
408
411
## Update replace statements in client crates
409
412
410
413
Progenitor `replace` statements in client crates should use the `latest` re-exports in the versions crate. Update Progenitor clients to:
Copy file name to clipboardExpand all lines: guides/new-version.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,9 +52,10 @@ In API traits, always import `latest` and `vN` modules with `use foo_versions::{
52
52
3. Don't add types to the API crate. All types should live in the versions crate.
53
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
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.
55
+
6. If a prior-version endpoint delegates to a helper function that exclusively serves that old version, the helper's signature must also use `vN::` paths — not floating identifiers from the types crate.
56
+
7. For trait endpoints with `latest::`, the impl must import the floating identifier **from the types crate**, not the versions crate.
57
+
8. Retain all existing comments. Don't add useless comments. Be extremely sparing with added prose.
58
+
9. Don't make unrelated changes. Focus only on the new version being added.
58
59
59
60
**Order of operations:**
60
61
@@ -432,6 +433,10 @@ If the prior version is a provided method (the common case), no other changes ar
432
433
433
434
The method name has changed, so perform the corresponding updates in the implementation. Remember also to update `latest::` paths to versioned identifiers, mirroring the pattern used in the API trait.
434
435
436
+
#### Helper functions for prior-version endpoints
437
+
438
+
If prior-version endpoint implementations delegate to helper functions that exclusively serve old versions, update those helpers to use `vN::` paths as well — not floating identifiers from the types crate.
439
+
435
440
### Move non-conversion-related methods to newer types
436
441
437
442
Prior versions of types may have non-conversion-related methods or trait implementations defined for them. These methods typically need to be moved over to be implemented on the newer versions.
0 commit comments