Skip to content

test: add package import contract smoke - #244

Merged
delete-cloud merged 1 commit into
mainfrom
codex/release-hardening-g40-import-contract
May 19, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
codex/release-hardening-g40-import-contract

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add package/import contract smoke tests for agentkit and coding_agent boundaries
  • verify top-level coding_agent import keeps heavy dependencies lazy
  • assert wheel package configuration includes both app and framework packages

Verification

  • uv run pytest tests/coding_agent/test_package_import_contract.py tests/coding_agent/test_bootstrap.py -v
  • uv run pytest tests/coding_agent/test_context_system_smoke.py -v
  • uv run pytest tests/coding_agent/action_safety/test_safe_action_smoke.py -v
  • uv run pytest tests/agentkit/runtime/test_pipeline.py -k "build_context or runtime_stage_spans" -v
  • uv run ruff format --check tests/coding_agent/test_package_import_contract.py
  • uv run ruff check tests/coding_agent/test_package_import_contract.py
  • git diff --check -- .

Summary by CodeRabbit

  • Tests

    • Added package import contract validation tests to verify module boundaries, ensure heavy dependencies load only when needed, and confirm correct wheel configuration.
  • Documentation

    • Updated release hardening progress documentation with import contract phase details and verification commands.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@delete-cloud has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 13 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0169df67-b325-450c-9e6d-306381286c4d

📥 Commits

Reviewing files that changed from the base of the PR and between c66af87 and 9071ee3.

📒 Files selected for processing (3)
  • coding-agent/.opencode/prompts/tasks/release-hardening-g40-import-contract.md
  • coding-agent/docs/release_hardening/GOAL_PROGRESS.md
  • coding-agent/tests/coding_agent/test_package_import_contract.py
📝 Walkthrough

Walkthrough

This PR adds release-hardening task G40 to verify package import boundaries. It introduces a test suite ensuring agentkit public APIs do not pull in coding_agent, top-level coding_agent imports keep heavy dependencies lazy, and wheel configuration includes both packages, along with task definition and completion documentation.

Changes

Package Import Contract Testing

Layer / File(s) Summary
Release-hardening task specification
coding-agent/.opencode/prompts/tasks/release-hardening-g40-import-contract.md
Defines G40 task requirements for validating that agentkit imports remain isolated, top-level coding_agent stays lightweight, and wheel includes both packages, with specified pytest and ruff verification commands.
Package import contract test suite
coding-agent/tests/coding_agent/test_package_import_contract.py
Implements four tests: asserting agentkit public classes (Pipeline, PluginRegistry, ToolRegistry, Tape) resolve from agentkit modules; scanning agentkit source files for absent coding_agent references; monkeypatching __import__ to verify top-level coding_agent does not load blocked dependencies like lancedb and tiktoken; validating pyproject.toml wheel configuration includes both src/coding_agent and src/agentkit packages.
G40 completion progress ledger
coding-agent/docs/release_hardening/GOAL_PROGRESS.md
Records G40 phase including task metadata, verification commands, test execution results, pass counts, and remaining package boundary constraints.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#185: Adds or modifies agentkit.__init__.py export wiring that directly affects whether agentkit public imports inadvertently load coding_agent modules.

Poem

🐰 Packages bundled, imports clean and tight,
Agentkit stands separate—a fortress of light,
Heavy deps sleep lazy 'til called upon,
Wheels rolling smooth from dusk to dawn!
Test suite stands guard o'er the boundary line. 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding package import contract smoke tests to verify module boundaries and dependencies.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/release-hardening-g40-import-contract

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
coding-agent/tests/coding_agent/test_package_import_contract.py (1)

60-60: 💤 Low value

Consider whether order-sensitive equality is appropriate.

The test uses exact list equality, so package order in pyproject.toml matters. If the intent is to verify that both packages are present (regardless of order), consider using set comparison:

assert set(packages) == {"src/coding_agent", "src/agentkit"}

However, if strict ordering is part of the contract, the current assertion is correct.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/tests/coding_agent/test_package_import_contract.py` at line 60,
The test currently asserts order-sensitive equality on the packages list (assert
packages == ["src/coding_agent", "src/agentkit"]); if the intent is to only
verify presence regardless of order, change the assertion to a set comparison
(assert set(packages) == {"src/coding_agent", "src/agentkit"}) in the test
function (test_package_import_contract / variable packages) so the test no
longer fails due to ordering; if ordering is intentional, leave the assertion
as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@coding-agent/tests/coding_agent/test_package_import_contract.py`:
- Around line 36-42: The guarded_import function shadows builtins by using
parameter names globals and locals; rename those parameters (for example to
globals_ and locals_) and update all uses inside guarded_import (including the
call to __import__ and any references) to use the new names so you no longer
shadow Python builtins while keeping the same behavior.

---

Nitpick comments:
In `@coding-agent/tests/coding_agent/test_package_import_contract.py`:
- Line 60: The test currently asserts order-sensitive equality on the packages
list (assert packages == ["src/coding_agent", "src/agentkit"]); if the intent is
to only verify presence regardless of order, change the assertion to a set
comparison (assert set(packages) == {"src/coding_agent", "src/agentkit"}) in the
test function (test_package_import_contract / variable packages) so the test no
longer fails due to ordering; if ordering is intentional, leave the assertion
as-is.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 77b58357-bfd7-488f-8027-1fc11aa67e9b

📥 Commits

Reviewing files that changed from the base of the PR and between f2e3b79 and c66af87.

📒 Files selected for processing (3)
  • coding-agent/.opencode/prompts/tasks/release-hardening-g40-import-contract.md
  • coding-agent/docs/release_hardening/GOAL_PROGRESS.md
  • coding-agent/tests/coding_agent/test_package_import_contract.py

@delete-cloud
delete-cloud force-pushed the codex/release-hardening-g40-import-contract branch from c66af87 to 0c02862 Compare May 19, 2026 17:40
@delete-cloud
delete-cloud force-pushed the codex/release-hardening-g40-import-contract branch from 0c02862 to 9071ee3 Compare May 19, 2026 17:41
@delete-cloud
delete-cloud merged commit f08c882 into main May 19, 2026
1 check passed
@delete-cloud
delete-cloud deleted the codex/release-hardening-g40-import-contract branch May 19, 2026 17:51
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