oxidecomputer / oxidecomputer/omicron
nexus-fm test_util: refactor SimReporter into a plain value
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
SimReporter is currently a handle to a mutable thing: it holds an Arc<ReporterShared> whose restart history sits behind a Mutex, shared with the SimReporters registry. RFD 726 probably wants simulated reporters to be owned immutable values instead.
The reason for this is that the sim's session history is a tree of immutable states (undo, redo, forking a session from any earlier point). This requires that cloning a state is safe, which it wouldn't be if two states share a mutable SimReporter.
Proposed refactor: dissolve ReporterShared into SimReporter, so the registry owns the reporters and tests borrow them from it rather than holding detached handles. This sort of reaches the end state the existing TODO asks for, though in the opposite direction (the TODO proposes moving the rest of the reporter's state into ReporterShared). The churn at the tests' ereport-creation sites is mechanical.
Also note, the per-reporter collector_id carries a separate TODO which we'll probably resolve in the process somehow... I'm guessing we'll just introduce a constructor that takes the collector id as a parameter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in nexus/fm/src/test_util.rs, especially the SimReporter, ReporterShared, SimReporters, and collector_id TODOs around lines 151-184. Read RFD 726 for the immutable session-history motivation, then trace the tests' ereport-creation sites. Done means reporters are owned immutable values, the registry supplies borrows, and the affected tests compile and pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 54/100