|
| 1 | +# SOW-0034 - Rust 2024 Migration |
| 2 | + |
| 3 | +## Status |
| 4 | + |
| 5 | +Status: open |
| 6 | + |
| 7 | +Sub-state: Queued behind SOW-0033; preliminary validation evidence identifies the migration surfaces that require full analysis. |
| 8 | + |
| 9 | +## Requirements |
| 10 | + |
| 11 | +### Purpose |
| 12 | + |
| 13 | +Migrate the standalone plugin-ipc Rust crate and every Rust target declared by its manifest to Rust edition 2024 without changing protocol behavior or introducing destructor-order regressions. |
| 14 | + |
| 15 | +### User Request |
| 16 | + |
| 17 | +After completing the surgical Netdata vendor-drift backport first, the user requested a full Rust 2024 migration because Rust 2024 is the durable direction for the project. |
| 18 | + |
| 19 | +### Assistant Understanding |
| 20 | + |
| 21 | +Facts: |
| 22 | + |
| 23 | +- `src/crates/netipc/Cargo.toml` currently selects edition 2021. |
| 24 | +- The manifest declares the NetIPC library plus interop and benchmark binaries located under `tests/fixtures/rust/` and `bench/drivers/rust/`. |
| 25 | +- Netdata's Rust workspace already uses edition 2024 and Rust 1.91. |
| 26 | +- A Rust 2024 compatibility lint check found reserved `gen` identifiers in benchmark drivers. |
| 27 | +- The same check found edition-dependent temporary drop-order changes in SHM and UDS connection loops in benchmark and fixture binaries. |
| 28 | +- Windows-only library compatibility changes are handled by SOW-0033, but full Windows target validation is still required for an edition migration. |
| 29 | + |
| 30 | +Inferences: |
| 31 | + |
| 32 | +- This work is broader than a manifest edit because edition 2024 changes keyword parsing, unsafe syntax requirements, and temporary drop scope. |
| 33 | +- Mechanical suppression of the drop-order lint would be unsafe without proving that session and SHM destructors still run in the intended order. |
| 34 | + |
| 35 | +Unknowns: |
| 36 | + |
| 37 | +- The desired standalone plugin-ipc MSRV after migration; Rust edition 2024 itself does not require adopting Netdata's exact workspace MSRV policy. |
| 38 | +- Whether each reported drop-order site is behaviorally neutral or requires an explicit binding/scope change. |
| 39 | +- Whether additional Windows-only edition findings appear under the native Windows CI/toolchain. |
| 40 | +- Whether README, contributor guidance, CI toolchain declarations, or integration guidance state an edition/MSRV contract that must change. |
| 41 | + |
| 42 | +### Acceptance Criteria |
| 43 | + |
| 44 | +- The standalone Rust manifest selects edition 2024 with an explicitly decided and documented MSRV policy. |
| 45 | +- Every library, test, fixture, interop, and benchmark target declared by the manifest builds under edition 2024. |
| 46 | +- All Rust 2024 compatibility findings are implemented or explicitly rejected with evidence; none are silenced without a behavioral explanation. |
| 47 | +- POSIX Rust tests, coverage requirements, interop, and benchmarks remain valid. |
| 48 | +- Native Windows or project-standard Windows validation covers Named Pipe, Windows SHM, typed service, cache, and declared Windows binaries. |
| 49 | +- C/Rust/Go protocol and interoperability contracts remain unchanged and validated. |
| 50 | +- A same-pattern search and artifact maintenance review cover all Rust targets and public guidance. |
| 51 | + |
| 52 | +## Analysis |
| 53 | + |
| 54 | +Sources checked: |
| 55 | + |
| 56 | +- `src/crates/netipc/Cargo.toml` |
| 57 | +- `src/crates/netipc/src/` |
| 58 | +- `bench/drivers/rust/src/main.rs` |
| 59 | +- `bench/drivers/rust/src/bench_windows.rs` |
| 60 | +- `tests/fixtures/rust/src/bin/interop_shm.rs` |
| 61 | +- SOW-0033 validation output |
| 62 | +- Netdata's edition-2024 NetIPC migration commit `3f646983eac1f001ab652b34383a20aaff35f3eb` |
| 63 | + |
| 64 | +Current state: |
| 65 | + |
| 66 | +- The library and its 380 native tests pass on edition 2021 after the SOW-0033 compatibility backport. |
| 67 | +- Rust 2024 compatibility lints for the vendored library and its unit tests pass under SOW-0033. |
| 68 | +- Full `--all-targets` compatibility lints fail only on broader standalone benchmark/fixture migration surfaces discovered so far. |
| 69 | + |
| 70 | +Risks: |
| 71 | + |
| 72 | +- Rust 2024 temporary lifetime changes can alter the order in which failed connection attempts, live sessions, or SHM mappings are dropped. |
| 73 | +- Expanding MSRV without an explicit decision can break supported downstream builders. |
| 74 | +- POSIX-only validation can miss Windows-gated FFI and transport failures. |
| 75 | +- Updating Rust behavior without checking C and Go interoperability can create cross-language release regressions. |
| 76 | + |
| 77 | +## Pre-Implementation Gate |
| 78 | + |
| 79 | +Status: blocked |
| 80 | + |
| 81 | +Problem / root-cause model: |
| 82 | + |
| 83 | +- The standalone crate is edition 2021 while its downstream Netdata workspace is edition 2024. Source-owned library compatibility drift is addressed separately in SOW-0033, but the standalone manifest also compiles benchmark and fixture binaries that contain edition-2024 keyword and temporary-drop-order findings. A safe migration must analyze those runtime lifetimes rather than treating the work as a mechanical manifest change. |
| 84 | + |
| 85 | +Evidence reviewed: |
| 86 | + |
| 87 | +- `src/crates/netipc/Cargo.toml:4` selects edition 2021 and later manifest entries declare interop and benchmark binaries outside the crate directory. |
| 88 | +- `bench/drivers/rust/src/main.rs:260,266` and `bench/drivers/rust/src/bench_windows.rs:521,527` use `gen`, which is reserved in edition 2024. |
| 89 | +- Rust 2024 compatibility lints report temporary drop-order changes at: |
| 90 | + - `tests/fixtures/rust/src/bin/interop_shm.rs:81` |
| 91 | + - `bench/drivers/rust/src/main.rs:400,441,680,818,968,1007` |
| 92 | +- The affected temporaries own `UdsSession` or `ShmContext` values whose `Drop` implementations release transport resources. |
| 93 | +- `netdata/netdata @ 01d56fddc20ac4a73ea74da19e49420cab764ad0`, `src/crates/Cargo.toml:66-67`, uses edition 2024 and Rust 1.91. |
| 94 | + |
| 95 | +Affected contracts and surfaces: |
| 96 | + |
| 97 | +- Rust language edition and MSRV policy. |
| 98 | +- Rust library, unit tests, interop fixtures, and benchmark binaries. |
| 99 | +- POSIX UDS and SHM resource lifetime behavior. |
| 100 | +- Windows Named Pipe and SHM compilation/runtime behavior. |
| 101 | +- CI toolchain declarations, coverage, interop, and benchmark validation. |
| 102 | +- Potential developer and integrator documentation. |
| 103 | + |
| 104 | +Existing patterns to reuse: |
| 105 | + |
| 106 | +- Low-priority Rust validation and coverage scripts under `tests/`. |
| 107 | +- Native Windows validation scripts matching the touched transport/API. |
| 108 | +- Cross-language interop scripts and benchmark generators. |
| 109 | +- Explicit resource-lifetime handling already used in UDS and SHM implementations. |
| 110 | + |
| 111 | +Risk and blast radius: |
| 112 | + |
| 113 | +- Medium: edition migration spans all standalone Rust targets and can change temporary destruction timing. |
| 114 | +- No production service, database, configuration, environment, package installation, network, or runtime process changes are expected. |
| 115 | +- Keep SOW-0033's exact vendor backport isolated in its own completed commit before this migration begins. |
| 116 | + |
| 117 | +Sensitive data handling plan: |
| 118 | + |
| 119 | +- The work requires source, compiler diagnostics, test output, and public repository history only. |
| 120 | +- Durable artifacts will contain no credentials, secrets, customer identifiers, personal data, private endpoints, or production incident details. |
| 121 | + |
| 122 | +Implementation plan: |
| 123 | + |
| 124 | +1. After SOW-0033 closes, inventory every manifest-declared Rust target, Rust toolchain declaration, and edition/MSRV statement. |
| 125 | +2. Analyze every Rust 2024 compatibility diagnostic, with special attention to destructor and resource-release ordering. |
| 126 | +3. Present any irreducible MSRV or lifetime design decisions to the user before implementation. |
| 127 | +4. Apply the decided edition, source, test, CI, and documentation changes. |
| 128 | +5. Validate POSIX, Windows, cross-language interop, coverage, and relevant benchmarks. |
| 129 | + |
| 130 | +Validation plan: |
| 131 | + |
| 132 | +- Run Rust 2024 compatibility lints across all targets before and after implementation. |
| 133 | +- Run formatting, all Rust tests, Rust coverage, POSIX interop, and relevant benchmarks at low scheduler priority. |
| 134 | +- Run the project-standard native Windows validation for Named Pipe, SHM, service, cache, and Rust binaries. |
| 135 | +- Run same-pattern searches for reserved identifiers, unsafe edition findings, and temporary lifetime patterns. |
| 136 | +- Review generated diffs, protocol parity, sensitive data, artifact maintenance, and SOW audit evidence. |
| 137 | + |
| 138 | +Artifact impact plan: |
| 139 | + |
| 140 | +- AGENTS.md: inspect toolchain/validation policy; update only if project-wide requirements change. |
| 141 | +- Runtime project skills: inspect vendoring guidance if edition/MSRV changes affect downstream copying or validation. |
| 142 | +- Specs: update only if supported toolchain or observable resource-lifetime guarantees are specified there. |
| 143 | +- End-user/operator docs: inspect README, getting-started, and integrator guidance for Rust edition/MSRV/build commands. |
| 144 | +- End-user/operator skills: update `docs/netipc-integrator-skill.md` if integration prerequisites or validation commands change. |
| 145 | +- SOW lifecycle: begin only after SOW-0033 is completed; close with every diagnostic implemented, rejected with evidence, or mapped to a real follow-up. |
| 146 | + |
| 147 | +Open-source reference evidence: |
| 148 | + |
| 149 | +- `netdata/netdata @ 01d56fddc20ac4a73ea74da19e49420cab764ad0` |
| 150 | + - `src/crates/Cargo.toml:66-67` |
| 151 | + - `src/crates/netipc/Cargo.toml:4` |
| 152 | + - `src/crates/netipc/src/transport/shm.rs` |
| 153 | + - `src/crates/netipc/src/transport/win_shm.rs` |
| 154 | + |
| 155 | +Open decisions: |
| 156 | + |
| 157 | +- Blocked until SOW-0033 completes because the project permits only one executing SOW at a time. |
| 158 | +- MSRV selection and any non-mechanical resource-lifetime changes require evidence and user decisions after the full pre-implementation inventory. |
| 159 | + |
| 160 | +## Implications And Decisions |
| 161 | + |
| 162 | +1. **Ordering - selected by the user: surgical backport first, full edition migration second.** |
| 163 | + - SOW-0033 must be committed and completed before this SOW moves to `current/`. |
| 164 | +2. **Migration quality - user direction: Rust 2024 is a durable project direction.** |
| 165 | + - Treat this as a complete migration with compatibility and lifetime validation, not a warning-suppression exercise. |
| 166 | + |
| 167 | +## Plan |
| 168 | + |
| 169 | +1. Complete preliminary inventory and present the MSRV/lifetime design evidence after SOW-0033 closes. |
| 170 | +2. Fill the complete ready Pre-Implementation Gate before moving this SOW to `current/`. |
| 171 | +3. Implement and validate the user-decided migration without mixing unrelated changes. |
| 172 | + |
| 173 | +## Execution Log |
| 174 | + |
| 175 | +### 2026-07-28 |
| 176 | + |
| 177 | +- Created as the tracked second step after the user selected the SOW-0033 surgical backport followed by full Rust 2024 migration. |
| 178 | +- Recorded preliminary compiler evidence only; no SOW-0034 implementation started. |
| 179 | + |
| 180 | +## Validation |
| 181 | + |
| 182 | +Acceptance criteria evidence: |
| 183 | + |
| 184 | +- Pending implementation after SOW-0033. |
| 185 | + |
| 186 | +Tests or equivalent validation: |
| 187 | + |
| 188 | +- Preliminary SOW-0033 run: Rust 2024 all-target compatibility linting exposed the benchmark/fixture findings recorded above. |
| 189 | + |
| 190 | +Real-use evidence: |
| 191 | + |
| 192 | +- Pending implementation after SOW-0033. |
| 193 | + |
| 194 | +Reviewer findings: |
| 195 | + |
| 196 | +- Pending implementation after SOW-0033. |
| 197 | + |
| 198 | +Same-failure scan: |
| 199 | + |
| 200 | +- Preliminary diagnostics identify reserved identifiers and drop-order sites; complete scan is pending activation. |
| 201 | + |
| 202 | +Sensitive data gate: |
| 203 | + |
| 204 | +- This pending SOW contains only source paths, public commit hashes, and sanitized compiler-finding summaries. |
| 205 | + |
| 206 | +Artifact maintenance gate: |
| 207 | + |
| 208 | +- AGENTS.md: pending migration analysis. |
| 209 | +- Runtime project skills: pending migration analysis. |
| 210 | +- Specs: pending migration analysis. |
| 211 | +- End-user/operator docs: pending migration analysis. |
| 212 | +- End-user/operator skills: pending migration analysis. |
| 213 | +- SOW lifecycle: remains `open` under `pending/` until SOW-0033 completes and its own gate is ready. |
| 214 | + |
| 215 | +Specs update: |
| 216 | + |
| 217 | +- Pending evidence from migration analysis. |
| 218 | + |
| 219 | +Project skills update: |
| 220 | + |
| 221 | +- Pending evidence from migration analysis. |
| 222 | + |
| 223 | +End-user/operator docs update: |
| 224 | + |
| 225 | +- Pending evidence from migration analysis. |
| 226 | + |
| 227 | +End-user/operator skills update: |
| 228 | + |
| 229 | +- Pending evidence from migration analysis. |
| 230 | + |
| 231 | +Lessons: |
| 232 | + |
| 233 | +- Pending implementation. |
| 234 | + |
| 235 | +Follow-up mapping: |
| 236 | + |
| 237 | +- Pending implementation. |
| 238 | + |
| 239 | +## Outcome |
| 240 | + |
| 241 | +Pending. |
| 242 | + |
| 243 | +## Lessons Extracted |
| 244 | + |
| 245 | +Pending. |
| 246 | + |
| 247 | +## Followup |
| 248 | + |
| 249 | +None yet. |
| 250 | + |
| 251 | +## Regression Log |
| 252 | + |
| 253 | +None yet. |
0 commit comments