refactor: extract inline tests to sibling _tests.rs files (130 god-files)#835
Conversation
|
Important Review skippedToo many files! This PR contains 274 files, which is 124 over the limit of 150. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (274)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7664b51 to
8c3ee51
Compare
|
closing/reopening to retrigger CI after fmt fix (empty commit didn't trigger) |
|
damn this is too big of a PR 😅 in an ideal case small PRs are great.. helps debug things better. i agree with the design decision. if we can resolve the merge conflicts then will merge this asap before it breaks future code @jwalin-shah |
…les)
Moves inline `#[cfg(test)] mod tests { ... }` blocks out of 137 oversized
source files into sibling `*_tests.rs` files referenced via
`#[path = "..."] mod tests;`. Purely mechanical: test bodies and production
code are byte-identical, only the location changes.
Motivation: keep production files under the project's ~500-line guideline so
Claude-assisted tooling (smart_outline, llm-tldr, grep-based navigation)
doesn't have to chew through ~50% test scaffolding to understand a module.
One import tweak: threads/ops_tests.rs needs an explicit
`use crate::openhuman::threads::title::collapse_whitespace;` because the
original inline tests referenced a helper that the containing ops.rs module
does not import or re-export (inline tests could see it via crate-internal
visibility; the sibling needs it in scope).
Verification: `cargo build --tests --manifest-path Cargo.toml` green.
(Note: `cargo test --lib` silently skips `tests/*.rs` — always use
`cargo build --tests` to catch extraction errors.)
Intentionally NOT extracted (multi-block test files — non-mechanical):
- src/openhuman/channels/runtime/dispatch.rs (two separately-named mods)
- src/openhuman/life_capture/index.rs (five #[cfg(test)] blocks)
No behavior change, no API change, no test additions/removals.
Forces a real file change so GitHub Actions re-runs Type Check on this PR after the earlier fmt-only commit didn't trigger workflows.
6cdd623 to
47a43c8
Compare
|
Rebased onto main (49 commits ahead), all 21 merge conflicts resolved. |
# Conflicts: # src/openhuman/agent/prompts/mod.rs # src/openhuman/config/schema/load.rs # src/openhuman/integrations/parallel.rs # src/openhuman/local_ai/ops.rs # src/openhuman/local_ai/schemas.rs # src/openhuman/local_ai/service/public_infer.rs
…OpenHuman to version 0.53.0
…ruct; cleanup local AI suggestion tests
Upstream's tinyhumansai#835 (refactor: extract inline tests to sibling _tests.rs) collided with this branch's inline-test edits in 4 memory-tree files. Resolution: take upstream's external-file declaration in each main .rs and migrate the chunk_id 4-arg + new fanout tests into the existing _tests.rs siblings: * bucket_seal.rs / bucket_seal_tests.rs — 4-arg chunk_id + fanout_at_l1_triggers_l2_seal + upper_level_does_not_seal_below_fanout * global_tree/digest_tests.rs — 4-arg chunk_id (2 callsites) * score/mod_tests.rs — 4-arg chunk_id (1 callsite) * store_tests.rs — 4-arg chunk_id (1 callsite) catalog.rs collided with upstream's two new notifications_* Capability entries — kept all three side by side. Tests: source_tree 39/39, full memory_tree suite 336/336, bin compiles. The level-aware should_seal, truncate_for_embed, LLM summariser, and quota-meter fixes from the prior commits all merged cleanly outside the conflict regions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ation) Resolves conflicts after main absorbed: - tinyhumansai#835 inline-test extraction to sibling _tests.rs files - tinyhumansai#803 memory namespaces (Memory trait gained `namespace` arg + `namespace_summaries`) - tinyhumansai#839 memory_tree retrieval RPC handlers - install.sh resolver / smoke test changes Conflict resolutions: - src/openhuman/agent/prompts/mod.rs + mod_tests.rs: kept branch's snapshot_pair production code (UserFilesSection now prefers session-frozen MemorySnapshot over workspace files), then applied tinyhumansai#835's extraction by moving the inline mod tests block to mod_tests.rs sibling. Tests retain the `curated_snapshot: None` additions from 1976ba4. - src/openhuman/agent/harness/subagent_runner/ops.rs + ops_tests.rs: same pattern — kept branch's session-snapshot wiring, extracted inline tests to ops_tests.rs sibling. - src/core/all.rs: kept both webview_apis (main) and life_capture + curated_memory (branch) controller registrations. - scripts/install.sh: kept branch's clearer "Resolved URL was empty…" diag and the test_install.sh resolver-unit-test job in installer-smoke.yml. Compatibility patches: - ops_tests.rs NoopMemory updated to new Memory trait (namespace arg on store/get/list/forget, RecallOpts on recall, added namespace_summaries). - help/prompt.rs test fixture gets curated_snapshot: None. cargo build --tests passes locally on darwin-aarch64.
…les) (tinyhumansai#835) Co-authored-by: Jwalin Shah <jshah1331@gmail.com> Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
) (tinyhumansai#1010) Co-authored-by: Jwalin Shah <jshah1331@gmail.com>
Summary
Moves inline
#[cfg(test)] mod tests { ... }blocks out of 130 oversized source files into sibling*_tests.rsfiles referenced via#[path = \"...\"] mod tests;. Purely mechanical: test bodies and production code are byte-identical, only the location changes.Motivation
Keep production files under the project's ~500-line guideline so Claude-assisted tooling (
smart_outline,llm-tldr, grep-based navigation) doesn't have to chew through ~50% test scaffolding to understand a module. Median file in this PR shed 300–900 lines of test boilerplate from the source view.How it was done
#[cfg(test)]block in each file<base>_tests.rs```rust
#[cfg(test)]
#[path = "_tests.rs"]
mod tests;
```
Verification
Non-goals
Test plan