← LeaderboardThe Skill Leaderboard
rust-arc-swap-snapshot-reads
Keep related Rust ArcSwap configuration reads in one generation. Reproduce a mixed snapshot and verify reload behavior for old and new readers.
Try your first task
A source-grounded starter task has not been verified for this skill yet.
SKILL.md
name: rust-arc-swap-snapshot-readsdescription: Keep related Rust ArcSwap configuration reads in one generation. Reproduce a mixed snapshot and verify reload behavior for old and new readers.category: developmentrisk: criticalsource: selfsource_type: selfauthor: ShianMikedate_added: "2026-12-03"tags: [rust, arc-swap, snapshots, configuration, testing]Rust ArcSwap snapshot reads
When to Use
- A request reads several related fields from a hot-reloaded
ArcSwapvalue. - A request can observe two individually valid settings that never existed in the same published generation.
- A service needs predictable behavior for in-flight requests during a configuration reload.
Prerequisites
- Identify the published value, its update entry point, and the fields that must agree.
- Trace every
loadorload_fullin one logical operation, including nested helpers. - Define the intended snapshot lifetime and whether a later operation should see a new generation.
Workflow
- Reproduce a mixed generation. Read one field, publish a different valid configuration, then read a related field through the original path. Assert the whole tuple and record which generation supplied each value.
- Load one snapshot per operation. Acquire a guard for a short local lookup or use
load_fullwhen the operation needs an ownedArc. Pass that snapshot or references into it to helpers that need consistent fields. - Publish related settings in one value. Construct and validate the complete replacement before one store. If related fields live in several independent slots, use a single combined snapshot when they must change together.
- Verify readers on both sides of publication. Hold an old snapshot across a controlled writer update and assert the old values stay coherent. A new load should observe the complete replacement.
- Check retention and caller behavior. Review how long code holds generations and how that influences reload behavior. Test the real request and reload paths with representative fixtures.
Example
Run Keep one config generation. Two loads mix the old mode and new batch size. Holding one owned snapshot makes the original operation consistent and still lets later operations see the new configuration.
Limitations
- The fixture covers one store and one reload. Independent mutable fields inside a snapshot need their own consistency policy.
- A long-lived owned snapshot retains that generation. Measure memory and reload overlap in the application.
- The example coordinates one writer. Concurrent read-modify-write updates need a different test of writer semantics.
Safety and Side Effects
- Run the example in a scratch Cargo project. It publishes in-memory fixture data and starts a local writer thread.
- Verify the meaning and lifecycle of retained settings before changing request or reload behavior.