fix: address code quality issues from codebase review #107
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.
Summary
Addresses the 8 minor code quality issues identified in #103.
Changes
Item 2: Quadratic list concatenation (P4)
Changed
acc ++ newpatterns to prepend+reverse in:lib/jido/agent/strategy/direct.exlib/jido/agent/strategy/fsm.exlib/jido/agent/state_ops.exItem 3: Completion waiter monitor leak (P3)
monitor_refin waiter struct and use as map key for O(1) lookupProcess.demonitor/2with:flushon completion to prevent stale :DOWN messagesItem 4: Trace context gaps (P3)
TraceContext.ensure_from_signal/1tohandle_info({:scheduled_signal, ...})TraceContext.ensure_from_signal/1tohandle_info({:signal, ...})Item 5: :jido option docs mismatch (P2)
:jidofrom required to optional with default ofJido(global instance)Item 7: Lifecycle robustness (P4)
handle_call({:attach, ...}),handle_call({:detach, ...}), andhandle_cast(:touch, ...)now handle both{:cont, state}and{:stop, reason, state}Item 8: Persistent term cleanup (P4)
Jido.Agent.InstanceManager.CleanupGenServer to clean up persistent_term on supervisor terminationItem 9: Telemetry unit labels (P4)
to_microseconds/1helper to convert native time to microsecondsduration_μslog fields now correctly report microsecondsSkipped
Item 6: String.to_atom safety (P3)
Deferred as it requires API/contract decisions about how to handle unknown string keys.
Testing
mix qualitypasses (format, credo, dialyzer)Closes #103