Skip to content

test: expand unit coverage to ~80% (codex/testing-coverage-refresh) - #75

Merged
jmagar merged 16 commits into
mainfrom
codex/testing-coverage-refresh
Jun 15, 2026
Merged

test: expand unit coverage to ~80% (codex/testing-coverage-refresh)#75
jmagar merged 16 commits into
mainfrom
codex/testing-coverage-refresh

Conversation

@jmagar

@jmagar jmagar commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Lands the parked codex/testing-coverage-refresh work onto main. 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.rs suites).

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-html and a CI coverage-summary job using cargo-llvm-cov + nextest.

Merge reconciliation

The branch forked at 1.20.1, before main advanced to 1.21.3 (PRs #73/#74). I merged origin/main in; 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 parallel 1.20.21.20.12 CHANGELOG entries (never released on main) are consolidated into a single 1.21.4 entry; main's 1.21.01.21.3 entries are preserved.

Verification

  • cargo fmt --check
  • cargo clippy --all-targets ✅ (no warnings)
  • cargo nextest run (canonical CI runner) ✅ 1826 passed, 2 skipped

Note: plain cargo test shows 2 failures in cli::setup::plugin_options — a pre-existing env-var parallelism race (these tests mutate process-global env under a shared-process model). nextest's process-per-test isolation avoids it, which is why CI is green and this PR adopts nextest as canonical.


Summary 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

    • Broadened sidecar test suites across setup, runtime auth/inventory refresh, notifications, agent streams (journald/syslog), Docker ingest (client/supervisor), CLI parsing/output, receiver wiring, and error‑signature DB contracts.
    • Added just coverage / just coverage-html and a CI coverage job using cargo-llvm-cov + nextest.
    • CI now runs tests with cargo nextest for env‑isolated execution and adds a separate doctest step to maintain previous coverage.
    • Deterministic admin REST coverage for /api/file-tails in the live smoke harness when CORTEX_API_ADMIN_TOKEN is set.
    • Bumped to 1.21.4 and consolidated unreleased changelog entries into 1.21.4.
  • Bug Fixes

    • Deploy: --hosts parsing trims entries and drops empties to avoid invalid host targets.

Written for commit 6366c8e. Summary will update on new commits.

Review in cubic

jmagar added 14 commits June 12, 2026 16:40
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.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jmagar, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 84882727-6b73-43f5-ac23-13bf9ba17430

📥 Commits

Reviewing files that changed from the base of the PR and between 99c6c0c and 6366c8e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock and included by **/*
📒 Files selected for processing (86)
  • .github/workflows/ci.yml
  • .github/workflows/docker-publish.yml
  • .github/workflows/publish-crates.yml
  • CHANGELOG.md
  • CLAUDE.md
  • Cargo.toml
  • Justfile
  • README.md
  • docker-compose.prod.yml
  • docs/CONFIG.md
  • docs/RELEASE.md
  • docs/SECURITY.md
  • docs/SETUP.md
  • docs/architecture.md
  • docs/contracts/config-schema.md
  • docs/contracts/runtime-lifecycle.md
  • docs/mcp/ENV.md
  • docs/mcp/TESTS.md
  • docs/reviews/ingestion-full-review.md
  • docs/runbooks/deploy.md
  • docs/sessions/2026-06-14-coverage-to-80.md
  • mcpb/manifest.json
  • server.json
  • src/agent.rs
  • src/agent/docker.rs
  • src/agent/journald.rs
  • src/agent/syslog_sender.rs
  • src/agent_deploy_tests.rs
  • src/app/os_adapter.rs
  • src/app/service_tests.rs
  • src/app/services/imports.rs
  • src/cli/config_cmd_tests.rs
  • src/cli/config_toml_tests.rs
  • src/cli/dispatch_command_log.rs
  • src/cli/dispatch_surface_gap.rs
  • src/cli/dispatch_surface_gap_tests.rs
  • src/cli/dispatch_surface_tests.rs
  • src/cli/heartbeat_agent.rs
  • src/cli/output_ai_more_tests.rs
  • src/cli/output_ai_tests.rs
  • src/cli/output_graph_tests.rs
  • src/cli/output_logs_tests.rs
  • src/cli/output_ops_tests.rs
  • src/cli/parse_admin_tests.rs
  • src/cli/parse_ai_more_tests.rs
  • src/cli/parse_ai_tests.rs
  • src/cli/parse_config_tests.rs
  • src/cli/parse_logs_tests.rs
  • src/cli/run.rs
  • src/cli/setup/plugin_options_tests.rs
  • src/cli_tests.rs
  • src/db/error_signatures.rs
  • src/db/graph_inventory_tests.rs
  • src/db/pool_tests.rs
  • src/docker_ingest/client.rs
  • src/docker_ingest/client_tests.rs
  • src/docker_ingest/supervisor_tests.rs
  • src/docs_tests.rs
  • src/doctor_tests.rs
  • src/heartbeat_agent_tests.rs
  • src/inventory/device_tests.rs
  • src/inventory/projects_tests.rs
  • src/inventory/remote_configs_tests.rs
  • src/lib.rs
  • src/logging/aurora.rs
  • src/main.rs
  • src/main_tests.rs
  • src/notifications/digest.rs
  • src/notifications/dispatcher.rs
  • src/notifications/evaluator.rs
  • src/notifications/queue.rs
  • src/receiver_tests.rs
  • src/runtime/inventory_refresh_tests.rs
  • src/runtime_tests.rs
  • src/setup.rs
  • src/setup/agent_command_tests.rs
  • src/setup/ai_index.rs
  • src/setup/ai_watch.rs
  • src/setup/debug_wrapper.rs
  • src/setup/doctor.rs
  • src/setup/firstrun.rs
  • src/setup/heartbeat_agent.rs
  • src/setup/systemd.rs
  • src/setup_tests.rs
  • tests/TEST_COVERAGE.md
  • tests/test_live.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/testing-coverage-refresh

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

jmagar added 2 commits June 15, 2026 10:29
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.
@jmagar
jmagar merged commit 3ab151f into main Jun 15, 2026
14 checks passed
@jmagar
jmagar deleted the codex/testing-coverage-refresh branch June 15, 2026 15:09
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