test: expand unit coverage to ~80% (codex/testing-coverage-refresh) - #75
Conversation
Reconcile the test-coverage branch with main after PRs #73/#74. All conflicts were version/metadata skew only (no source/test conflicts); the branch forked at 1.20.1 before main bumped to 1.21.3. - Resolve Cargo.toml/Cargo.lock/server.json/mcpb/manifest.json/ docker-compose.prod.yml to main's line, then bump to 1.21.4. - Consolidate the branch's parallel 1.20.2–1.20.12 CHANGELOG entries (never released on main) into a single 1.21.4 entry; keep main's 1.21.0–1.21.3 entries. Verified: cargo fmt --check, cargo clippy --all-targets, and the canonical `cargo nextest run` (1826 passed) all green.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 30 minutes and 37 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (86)
✨ 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 |
The merge surfaced a CI module-size failure: the branch had added a ~170-line inline #[cfg(test)] mod tests to src/cli/dispatch_surface_gap.rs, pushing it to 595 counted lines (>500 limit) and violating the repo's sidecar-test convention. Move the four argument-mapper tests into src/cli/dispatch_surface_gap_tests.rs behind the standard #[path = "..."] mod tests; hook. No behavior change.
The branch's expanded coverage adds many env-mutating tests across the setup, heartbeat, and plugin layers. Their #[serial] usage is uneven and some use a separate ENV_LOCK, so under libtest's shared-process model (cargo test) they race and fail nondeterministically (e.g. a concurrent test clobbers CORTEX_HEARTBEAT_TARGET / CORTEX_PORT mid-assertion). Switch the Tests step in ci.yml, docker-publish.yml, and publish-crates.yml to 'cargo nextest run --locked', which runs each test in its own process — the same runner already used by 'just test' and the coverage job. Add an explicit 'cargo test --doc --locked' step since nextest skips doctests, so test coverage matches the previous invocation.
Summary
Lands the parked
codex/testing-coverage-refreshwork ontomain. Expands focused unit coverage across the setup, runtime, inventory, notification, and ingest layers to lift total line coverage to ~80% (+8,735 lines, almost entirely sidecar*_tests.rssuites).Coverage added across: setup doctor/agent/first-run/systemd/AI-index/AI-watch/heartbeat-agent helpers, CLI global-flag & local-only routing, command-dispatch guardrails, runtime auth & inventory-refresh seams, inventory device/project/remote-config collectors, notification evaluator/dispatcher/queue/digest SQL helpers, Aurora logging, receiver listener wiring, journald/syslog formatting, and error-signature DB contracts. Also adds a mocked Docker Engine HTTP fixture, doc-drift tests, and deterministic admin-REST coverage for
/api/file-tails.Tooling:
just coverage/just coverage-htmland a CI coverage-summary job usingcargo-llvm-cov+ nextest.Merge reconciliation
The branch forked at 1.20.1, before
mainadvanced to 1.21.3 (PRs #73/#74). I mergedorigin/mainin; all conflicts were version/metadata skew only — zero source or test conflicts. Resolved version files to main's line and bumped to 1.21.4. The branch's parallel1.20.2–1.20.12CHANGELOG entries (never released on main) are consolidated into a single1.21.4entry; main's1.21.0–1.21.3entries are preserved.Verification
cargo fmt --check✅cargo clippy --all-targets✅ (no warnings)cargo nextest run(canonical CI runner) ✅ 1826 passed, 2 skippedSummary by cubic
Lifts unit test coverage to ~80% and updates CI to run tests with per‑process isolation via
cargo nextest. Docker docs now prefer the host‑local agent for logs; the legacy central pull path remains with a mocked Docker Engine HTTP fixture.New Features
just coverage/just coverage-htmland a CI coverage job usingcargo-llvm-cov+nextest.cargo nextestfor env‑isolated execution and adds a separate doctest step to maintain previous coverage./api/file-tailsin the live smoke harness whenCORTEX_API_ADMIN_TOKENis set.Bug Fixes
--hostsparsing trims entries and drops empties to avoid invalid host targets.Written for commit 6366c8e. Summary will update on new commits.