Fix ActivationRegistry scope handling and ActivationFn deserialization panic#110
Fix ActivationRegistry scope handling and ActivationFn deserialization panic#110HyperCodec merged 5 commits intodevfrom
Conversation
Co-authored-by: HyperCodec <72839119+HyperCodec@users.noreply.github.com>
get_random_connection take &self instead of &mut self
|
bruh you did the wrong thing |
|
@copilot I intended for you to work on the following part of the thread:
just add those changes to this PR. |
…on panic Co-authored-by: HyperCodec <72839119+HyperCodec@users.noreply.github.com>
Done in commit 4777194:
|
get_random_connection take &self instead of &mut self
Fixes two bugs in
src/activation.rsrelated toNeuronScope::NONEhandling and unsafe deserialization behavior, plus correctsget_random_connectionto take&selfinstead of&mut self.Changes
src/neuralnet.rs: Changedget_random_connectionreceiver from&mut selfto&selfsince it only reads from the network.src/activation.rs: Fixedactivations_in_scopeto return an emptyVecwhenscope == NeuronScope::NONE, instead of returning all activations. Also added a guard to filter out activations whose own scope isNONEfrom all scope queries. Previously, sinceNeuronScope::NONEhas no bits set, every bitflagscontainscheck would returntrue, causingactivations_in_scope(NeuronScope::NONE)to incorrectly return all registered activations.src/activation.rs: FixedActivationFn::deserializeto returnErr(serde::de::Error::custom(...))instead of callingpanic!when the activation function name is not found in the registry. Panicking insideDeserializeallows malformed or untrusted input to crash consumers; serde expects aD::Errorto be returned instead.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.