Repository navigation
refactor(ai): complete model seam test migrations and client fake ducking (#1001) - #1707
Merged
Merged
Conversation
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1001
Description
This final pull request completes the AI model seam implementation (#1001, ADR 0007), migrating remaining test suites away from internal
LLMClientmonkeypatches to the shared in-memorymodel_fakefixture, completing client fake ducking, retiring privatepydantic_ai._ssrfimports acrosssrc/, and publishing the changelog entry.Changes Delivered in Part 5
Caller Test Migrations:
tests/test_ai_prewarm.py: MigratedTestCLIPrewarmCommandtests to usemodel_fakeand itspreload_calls/set_preload_resultshelpers rather than patchingLLMClient.preload_models.tests/test_ai_chaos_model.py: Migratedtest_injector_spans_and_max_retriesaway from patchingLLMClient.tests/test_ai_cmd.py: Migrated interactive chat, agents LLM generation, prewarm, streaming turn, and invariant seeding tests to themodel_fakefixture.Client Ducking Completion (
tests/support/fakes/model.py):backend_infoproperty ("fake (localhost)") and minimal_config(_FakeConfig) toModelFakematchingLLMClientinterfaces expected by CLI commands (devops ai chat,devops ai test).factory_calls,preload_calls,set_preload_results,set_available_models, andset_list_models_errorhelpers.ModelFake.answerand_resolve_answerso sequentially queued answers execute in order and repeat the final entry cleanly.Factory Seam Refinement (
src/devops_cli/ai/client/factory.py):_client_override.record_factory_callwhen present to capture factory invocation details during test assertions._handle_overridekeeping McCabe cyclomatic complexity <= 10.SSRF Import Retirement (
src/devops_cli/http/egress.py):pydantic_ai._ssrfwith public boundary helperfrom devops_cli.core.validation import is_cloud_metadata_ip.Changelog Fragment & Tracking:
changelog.d/1001.mddocumenting the unified model seam, client factory consolidation, egress SSRF guards, and caller migrations under### Changedand### Removed.docs/agent/tasks/task-1001-one-model-seam.mdwith Part 5 details and marked all deliverables complete.Validation
devops cicompleted locally with 100% passing status (pytest & coverage, bandit, mypy strict, ruff check, ruff format, actionlint, zizmor, deptry, docs, devcontainer).tests/test_model_contract.py), fixture tests (tests/test_model_fixture.py), and migrated suites (tests/test_ai_cmd.py,tests/test_ai_prewarm.py,tests/test_ai_chaos_model.py) all pass.