@@ -106,13 +106,13 @@ Codemods live in `src/compile/codemods/`:
106106
107107```
108108src/compile/codemods/
109- ├── mod.rs # Framework + CODEMODS registry
110- ├── helpers.rs # take_key, insert_no_overwrite, rename_key, ConflictPolicy
111- ├── 0001_engine_id_split.rs
112- ├── 0002_permissions_field.rs
113- └── 0003_safeoutput_renames.rs
109+ ├── mod.rs # Framework + CODEMODS registry
110+ ├── helpers.rs # take_key, insert_no_overwrite, rename_key, ConflictPolicy
111+ └── 0001_repos_unified.rs # Legacy repositories: + checkout: → repos: codemod
114112```
115113
114+ (New codemods are appended as ` <NNNN>_<id>.rs ` files.)
115+
116116The filename prefix is a zero-padded sequence number (` <NNNN> ` ). It
117117sorts files naturally in directory listings; the ** registry order**
118118in ` mod.rs ` is what determines runtime order, not the filename.
@@ -163,6 +163,9 @@ mod tests {
163163Two edits in ` src/compile/codemods/mod.rs ` :
164164
165165``` rust
166+ // Filenames start with a digit, so #[path] is required to map the module
167+ // name (valid Rust identifier) to the file path (starts with a digit).
168+ #[path = " 0001_engine_id_split.rs" ]
166169mod m0001_engine_id_split ; // <-- add module declaration
167170
168171pub static CODEMODS : & [& 'static Codemod ] = & [
@@ -338,18 +341,20 @@ fn describe(v: &Value) -> &'static str {
338341 "already-migrated" case. We never overwrite an existing object
339342 form. The ` bail! ` on unexpected shapes is the manual-migration
340343 escape hatch.
341- 4 . ** Two-line registry append:**
344+ 4 . ** Registry append (three lines) :**
342345
343346 ``` rust
347+ #[path = " 0001_engine_id_split.rs" ]
344348 mod m0001_engine_id_split ;
345349
346350 pub static CODEMODS : & [& 'static Codemod ] = & [
347351 & m0001_engine_id_split :: CODEMOD ,
348352 ];
349353 ```
350354
351- That's it. The registry-uniqueness and filename-prefix tests
352- keep passing.
355+ The ` #[path = ...] ` attribute is required because Rust module
356+ identifiers cannot start with digits, but the file name does.
357+ The registry-uniqueness and filename-prefix tests keep passing.
353358
354359## Tests
355360
0 commit comments