Skip to content

test: cover the least-tested run, render, and package modules#55

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784937637-test-coverage
Open

test: cover the least-tested run, render, and package modules#55
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784937637-test-coverage

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Coverage-only change (no src/ edits). pytest --cov on main reported 91.1% overall with a long tail of near-untested modules; this adds 95 tests targeting the seven weakest ones and lifts the total to 93.5%.

module before after
integrations/updates/package.py 31% 100%
cli/dispatch/setup_wizard/terminal.py 37% 85%
cli/render/job_logs.py 50% 100%
services/runs/transcript.py 60% 100%
integrations/runs/process.py 68% 100%
cli/render/jobs.py 69% 100%
cli/render/config.py 70% 100%

New files: tests/test_run_transcript_projection.py, tests/test_render_jobs.py, tests/test_render_config.py, tests/test_package_integration.py, tests/test_setup_wizard_terminal.py. Process-control cases were appended to the existing tests/test_run_process.py rather than adding another file.

Notable behavior now pinned by tests:

  • project_run_steps — consecutive same-actor text merges into one assistant step, tool_result mutates the matching tool_use step in place (orphan results create their own completed step), agent/error/warning/done/session events map to their step kinds, and context_usage/unhandled kinds are dropped.
  • Render functions — human and --json paths for jobs list/show/cancel/logs/attach, including the no log events and detached-attach paths, plus every RunStatus label; render_config_* for values/entry/set/apply.
  • PsutilRunProcessController error paths — AccessDenied during termination resumes the frozen tree before raising, survivors after kill raise did not stop, and freeze_process_tree suspends each process once, skips children that exit mid-walk, and resumes what it froze on failure. Spawners are tested against a fake Popen so no real worker/executor is launched.
  • InstalledPackageMetadataProvider / read_direct_url — unknown-package fallback, editable direct-URL parsing, and every malformed-payload branch.
  • Wizard terminal helpers run against a real pty: wizard_terminal enters/leaves the alternate screen and restores termios, read_setup_key distinguishes a lone ESC from a full arrow sequence. The remaining uncovered lines there are the ImportError (no-termios) branches.

Why

The lowest-coverage modules are exactly the ones that are painful to debug from a user report: transcript projection, job rendering, and process termination. Locking their behavior down makes future refactors in that area safe to review.

Verification

uv run pytest              # 659 passed
uv run ruff check .        # All checks passed!
uv run --with pytest-cov pytest --cov=src/codealmanac   # 91.09% -> 93.47%

Docs and wiki

  • Not applicable.

Notes for reviewers

  • tests/test_run_process.py gains a FakeProcess stand-in for the psutil tree-walk edge cases that cannot be produced reliably with real processes; the pre-existing real-process tests are untouched.
  • test_setup_wizard_terminal.py monkeypatches sys.stdin to a pty follower; the fixture restores termios and closes both fds.

Link to Devin session: https://app.devin.ai/sessions/0496f5a925d14c40a62d1df692a9d26c
Requested by: @rohans0509

…trol, package metadata

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@rohans0509 rohans0509 self-assigned this Jul 25, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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