fix: clean cargo warnings and add unit tests (#45) #46
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_router!46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_warnings_tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #45.
Summary
Clears every warning emitted by
cargo check/build/clippy/testondevelopment, somake lintandmake test-all(which runcargo clippy --workspace --all-targets -- -D warnings) are green again. Also adds 55 unit tests for previously untested pure-logic modules.Warning fixes
crates/hero_router/src/server/mcp.rs— 7 dead-code warningsDeleted 7 unused helpers that formed a self-contained island (
named_to_positional+coerce_value/coerce_to_{array,bool,integer,number,string}). The current MCP dispatch path inmcp.rsalready passes MCP arguments through as-is to the backend service (see the comment// Pass arguments through as-is; only coerce empty/missing into params object rather than null). These helpers were stranded by the earlier switch made in commit77a9066(fix(mcp): pass named args through instead of named->positional conversion).crates/hero_router/src/python_codegen.rs:539— clippycollapsible_ifCollapsed a nested
if let Some(components) = … { if !components.is_empty() { … } }into a singleif let+&&let-chain. Let-chains have been stable since Rust 1.88; the workspace pins 1.93.crates/hero_router/src/server/terminal.rs— 2 clippyunnecessary_castDropped two
as i64casts where the source expression was alreadyi64(lines 64 and 181 in the pre-PR file).Test additions (16 → 71)
config.rsserver_socket_pathaliasmanifest.rscache.rsSourceKind::from_source,derive_group_namewell-known sockets vs stem fallback,ServiceEntry::has_openrpc/has_web/primary_protocol,RouterCache::upsertincluding ghost-eviction and pinned-survival,sorted_entrieshealthy-first + case-insensitive title order, context filtering,get_by_name_or_titlepriority chain,get_entries_by_groupOpenRPC-first sort,stats,mark_scanned,set/get_contexts,McpLogpush/recent/service-normalized filter/clear,RouterLogpush/delete_ids/cleargenerator/markdown.rs$refresolution into the Types sectiongenerator/html.rshtml_escapeXSS coverage (ampersand precedence, quotes, single-quotes, no-op), document skeleton, socket vs URL rendering, status badge, escaping of title/description, empty-methods placeholder, method accordion + HTML-escaped example request, method-count badgeAll new tests are synchronous or
tokio::testasync — no sockets, no network, tempdir only where persistence is involved (manifest). Total runtime <10 ms.Misc
cargo fmt --allreformatting was already in progress on the branch (mostly argument-list reflows inmain.rs,routes.rs,hero_inspector_app/**); it is included here so the tree is fmt-clean andmake test-allpasses end-to-end.Verification