Repository navigation
feat: add shared Context extensions (RFD 61) - #21
Merged
Merged
Conversation
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dispatchers can now attach consumer-owned state to
Contextbefore handing it to command and subcommand handlers.ExtensionsstoresTypeId -> Arc<dyn Any + Send + Sync>and exposesinsert<T>()andget<T>() -> Option<&T>throughextensions()/extensions_mut().ContextretainsClone,Debug,Send, andSync. Clones copy the map and share values through cheap Arc clones, so stored types need neither Clone nor Debug. Replacing an entry affects only that context's map. The borrowed getter avoids an Arc clone for handler reads. README and API docs describe these semantics; consumers using struct literals must migrate toContext::new(args)and assignenvas needed.Validation and consolidated QA/seam review:
cargo check --locked --target wasm32-unknown-unknown --no-default-features --features registrypasses.cargo clippy --locked --all-targets -- -D warningspasses; changed Rust files pass rustfmt checks andgit diff --checkpasses.cargo test --lockedwas run but is not green: the unchanged concurrent token-write test fails with temporary-file collisions. Reproduced independently on origin/main (ead2d1a) withcargo test --locked --test token_file_hardening. Parallel runs also encountered existing update health-probe timeouts; the initially failing probe passes in isolation.cargo test --locked -- --test-threads=1 --skip concurrent_writes_leave_a_complete_private_token_and_no_temp_filespasses. No unrelated token-file or timeout code is changed.Refs dekaruntime/rfd#61.
-codex