Skip to content

fix(tests): replace #[test] with #[tokio::test] on 13 async fns Refs #2040 - #893

Closed
AlexMikhalev wants to merge 1 commit into
mainfrom
task/2040-tokio-test-async-fns
Closed

fix(tests): replace #[test] with #[tokio::test] on 13 async fns Refs #2040#893
AlexMikhalev wants to merge 1 commit into
mainfrom
task/2040-tokio-test-async-fns

Conversation

@AlexMikhalev

Copy link
Copy Markdown
Contributor

Problem

13 async test functions in crates/terraphim_rolegraph/src/lib.rs were decorated with #[test] instead of #[tokio::test]. These tests compiled and appeared to pass but never executed their async bodies -- the test runner received a Future, dropped it without polling, and recorded a pass since no panic occurred.

Fix

Replace #[test] with #[tokio::test] on all 13 affected functions: test_split_paragraphs, test_find_matching_node_idss, test_find_matching_node_idss_ac_values, test_terraphim_engineer, test_rolegraph, test_is_all_terms_connected_by_path_true, test_is_all_terms_connected_by_path_false, tfidf_empty_index_returns_empty, tfidf_exact_match_scores_high, tfidf_no_match_scores_zero, tfidf_partial_match, tfidf_threshold_filters, two_pass_aho_corasick_first.

Verification

  • cargo test -p terraphim_rolegraph: 20 passed, 1 deliberately #[ignore]d
  • Execution time 2.21s (was ~0ms) confirming async bodies now execute
  • cargo clippy -p terraphim_rolegraph -- -D warnings: clean
  • cargo fmt -p terraphim_rolegraph -- --check: clean

Note on count

Issue listed 12 functions; inspection found 13 (the #2037 commit added test_is_all_terms_connected_by_path_true which also had #[test] before async fn). All 13 are fixed.

Refs terraphim/terraphim-ai#2040 (Gitea)

🤖 Generated with Terraphim AI

…rraphim_rolegraph Refs #2040

Async test functions decorated with #[test] compile and appear to pass
but the test runner drops the returned Future without polling it -- the
async body never executes. This converts all 13 affected functions in
crates/terraphim_rolegraph/src/lib.rs to #[tokio::test].

Affected functions: test_split_paragraphs, test_find_matching_node_idss,
test_find_matching_node_idss_ac_values, test_terraphim_engineer,
test_rolegraph, test_is_all_terms_connected_by_path_true,
test_is_all_terms_connected_by_path_false, tfidf_empty_index_returns_empty,
tfidf_exact_match_scores_high, tfidf_no_match_scores_zero,
tfidf_partial_match, tfidf_threshold_filters, two_pass_aho_corasick_first.

Post-fix: 20 tests pass (1 deliberately #[ignore]d), execution time
increases from ~0ms to 2.21s confirming async bodies now execute.
@AlexMikhalev

Copy link
Copy Markdown
Contributor Author

Closing as superseded. The diff between this branch (task/2040-tokio-test-async-fns) and current main has unresolved conflicts because main has moved substantially since this PR was filed (8,125 → 8,141 line change in crates/terraphim_orchestrator/src/lib.rs alone, with many smaller shifts across 100+ files). The substantive intent of each PR is preserved in main via the dependent work that has already merged. Per the user instruction "fully functional and green," these stale PRs are being closed rather than re-rebased.

Closes per Shimaguru mass-rebase pass, 2026-08-29.

@AlexMikhalev
AlexMikhalev deleted the task/2040-tokio-test-async-fns branch August 29, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant