Skip to content

refactor(ai): delete the pass-through package facades and the two stagepipeline protocols nothing implements #1002

Closed

Description

@dan-petty

Ready: implementation plan (refined 2026-10-17 at 3dd7fa6)

This section supersedes any text below that conflicts with it.

Decisions

  • Whether this lands before or after refactor(ai): one agent runtime behind one construction point, with no silent fallback #1005: before. refactor(ai): one agent runtime behind one construction point, with no silent fallback #1005 deletes names that three files deleted here re-export (src/devops_cli/ai/__init__.py:48 and :66-75, src/devops_cli/ai/agents/__init__.py:294, src/devops_cli/ai/agents/pydantic_agent.py:227-236, which also re-exports pydantic_ai.agent.Agent at :14-30). Landing first, this item removes those re-exports wholesale and refactor(ai): one agent runtime behind one construction point, with no silent fallback #1005 edits no facade; landing after refactor(ai): one agent runtime behind one construction point, with no silent fallback #1005 would save this item only one import line (src/devops_cli/ai/pydantic_ai_bridge.py:19). The tests of refactor(ai): one agent runtime behind one construction point, with no silent fallback #1005's targets import from ai.pydantic_ai_bridge and ai.durable directly (tests/test_pydantic_ai_concurrency.py:29, tests/test_pydantic_ai_native_capabilities.py:36, tests/test_pydantic_ai_workflows.py:19), so they are unaffected.
  • What refactor(ai): one agent runtime behind one construction point, with no silent fallback #1005 drops once this lands: every facade edit, and the clause of its first criterion about ai/agents/pydantic_agent.py:5-7 re-exporting pydantic_ai.agent.Agent, because that file is deleted here.
  • Whether this lands before refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001: yes, PR 1 first. The facades re-export ai.client, ai.direct and ai.providers names (ai/__init__.py:16-44, pydantic_agent.py:212-225, :365-370) that refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 rebuilds, so with PR 1 merged refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 touches no facade.
  • Whether any MCP, plugin or documentation entry point relies on devops_cli.ai.<name> attribute access: no. The only script is devops_cli.entry:main (pyproject.toml:76), no configuration file in the repository names a facade attribute, and the three knowledge-base pages that teach facade imports change in PR 1.
  • Whether fix(cli): cli start-up imports no telemetry when the bridge is off, and timing tests stop asserting host speed #858 must land first: no, it has landed; tests/test_cli_startup_imports.py is its test, and PR 2 extends it.
  • Where a re-pointed import goes: to the module that defines the name (for example PydanticAgent from ai/agents/agent.py, BaseCapability from ai/agents/capabilities.py:64, AgentTool from ai/agents/tools.py:28, list_mcp_tools and run_mcp_server from ai/mcp/server.py:3085, :3104), or to pydantic_ai for a pydantic-ai name.
  • How facade imports stay gone: a test pins that the four __init__.py files hold a docstring and nothing else, so Python itself rejects a non-submodule import from them; one AST test also walks the Python code blocks of the knowledge-base pages, which nothing imports. The wider rule "no __init__ imports a sibling package" is not adopted, as the 2026-10-02 amendment says, and test_no_circular_imports_in_decoupled_subsystems no longer exists.
  • What happens to tests that assert a name is reachable through a facade: they lose the facade targets (devops_cli.ai, devops_cli.ai.agents, devops_cli.ai.agents.pydantic_agent, devops_cli.ai.mcp) and keep any other target, such as devops_cli.ai.tools; a test left with no target is deleted. They are the 11 test_package_reexports and test_public_package_reexports tests in tests/test_pydantic_ai_format_prompt.py:277, _profiles_and_providers.py:333, _run.py:116, _function_signature.py:207, _retries.py:191, _tools.py:243, _template.py:97, _result.py:140, _settings.py:130, _ollama.py:251 and _mcp.py:208, and the facade modules in tests/test_codebase_hygiene_and_shims.py:100-135, whose removed-class checks stay on the defining modules. test_ai_agents_and_providers_import_no_model_sdks (tests/test_cli_startup_imports.py:185) imports devops_cli.ai.agents.agent instead of the emptied package.
  • Whether the suppression ceilings move: yes, down by what PR 1 removes. DEFAULT_C901_SUPPRESSION_CEILING goes from 51 to 49 (src/devops_cli/config/defaults.py:701; the markers at ai/__init__.py:8 and ai/agents/__init__.py:290), src type: ignore from 91 to 90 (:708; pipeline/stage.py:49), and the ai/pipeline_protocol.py entry leaves tests/fixtures/swallowed_failures_ceilings.json:46 through uv run python tests/test_swallowed_failures_ratchet.py --lower. Ceilings only go down.
  • Why the startup amendment is its own PR: measured at 3dd7fa6, devops --version and devops --help already load none of the six packages and finish in 0.3 s, while 31 of 39 groups' --help load pydantic-ai, fastmcp and opentelemetry in 2 to 3.5 s. Only one cause is a facade deleted here (commands/mcp.py:10 through ai/mcp/__init__.py). The others: the module-level pydantic_ai._ssrf imports at src/devops_cli/core/validation.py:17 and src/devops_cli/http/egress.py:29, reached by most groups through http/__init__.py; import pydantic_ai.exceptions at src/devops_cli/exceptions/ai.py:8, reached by roadmap through roadmap/intake_model.py:27; and module-level AI imports in the ai, review and scan command modules (for example commands/ai_cost.py:11, ai/review/__init__.py:18).
  • How the private pydantic_ai._ssrf imports stop loading pydantic-ai at startup: they move to first use, behaviour unchanged. In core/validation.py the module-level network tuples built from _PRIVATE_NETWORKS (:43-62) become functools.cache functions, and http/egress.py imports is_cloud_metadata_ip inside _refusal (:80). refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 keeps its criterion to replace the private API; this item only defers the import, so neither waits for the other.
  • How the exception module stops importing pydantic-ai: the 15 classes in exceptions/ai.py that subclass pydantic_ai.exceptions (:182-514) move to src/devops_cli/ai/exceptions.py, which already imports pydantic-ai, and the 11 aliases of pydantic-ai exceptions (exceptions/ai.py:724-734) are deleted, their users importing from pydantic_ai.exceptions. exceptions/ai.py keeps only classes based on DevOpsCLIError. Six src modules and four test files import a moved name.
  • How the AI command groups stop loading pydantic-ai at --help: their command modules import AI modules inside the command functions, and annotations that name AI types use TYPE_CHECKING. Typer reads only signatures and help text to render --help.
  • How the budget is enforced without a flaky test: each --version, --help and group --help (from _COMMAND_SPECS, src/devops_cli/main.py:34-78) runs in its own subprocess, which asserts that none of the six packages is in sys.modules and that the -X importtime cumulative time of devops_cli.main and the group's command module is within the budget. A command over budget is measured twice more and fails only if all three runs are over, with the ten slowest imports listed. The budgets are constants in config/defaults.py: 0.5 s for --version and --help, 1.0 s for a group's --help.
  • What "dry runs import only what their plan needs" means, testably: k8s deploy-stack --dry-run loads none of pydantic-ai, fastmcp, qdrant-client and opentelemetry, and ai benchmark --dry-run and review path --dry-run load none of kubernetes, docker and qdrant-client. A dry run sends no request, so it needs no client for the services it would call.
  • Whether the priority changes to P1, as the amendment proposed: no change here. Priority belongs to the roadmap tooling, and this plan does not set it.
  • src/devops_cli/pipeline/, which test(infra): infrastructure tests run on edge fakes #1335 also lists: deleted here; test(infra): infrastructure tests run on edge fakes #1335 drops it.

Delivery

  1. PR 1 (M): the facades and the dead protocols. ai/__init__.py, ai/agents/__init__.py, github/__init__.py and ai/mcp/__init__.py become docstrings; ai/agents/pydantic_agent.py, src/devops_cli/pipeline/ and ai/pipeline_protocol.py are deleted with tests/test_pipeline_engine.py and tests/test_pipeline_protocol.py; every importer names the defining module. Tests first: a test that the four __init__.py files parse to a single docstring expression; an AST test that no from devops_cli.ai import, from devops_cli.ai.agents import, from devops_cli.ai.mcp import or from devops_cli.github import in src, tests or a knowledge-base Python block names anything but a submodule. Files: the four __init__.py files; the 16 src importers of pydantic_agent (11 under src/devops_cli/ai/harness/, ai/pydantic_ai_bridge.py:19, ai/ext_langchain.py:8, ai/review/pipeline.py:33, ai/agents/pipeline.py:5, plus ai/agents/__init__.py itself); commands/ai.py:1058 and :1240; commands/mcp.py:10; ai/knowledge_base/devops_cli/python_packages.md:126 and ai/knowledge_base/devops_cli/libraries/pydantic_ai.md:54, :82; config/defaults.py; tests/fixtures/swallowed_failures_ceilings.json; the 56 test files that import from ai.agents.pydantic_agent or through a facade (including the three patch("devops_cli.ai.agents.PydanticAgent") targets in tests/test_ai_cmd.py); changelog.d/1002.md. Refs refactor(ai): delete the pass-through package facades and the two stagepipeline protocols nothing implements #1002.
  2. PR 2 (M): --version, --help and every group's --help load none of pydantic-ai, kubernetes, docker, fastmcp, qdrant-client and opentelemetry, within the budget. Tests first: extend test_cli_help_imports_no_telemetry (tests/test_cli_startup_imports.py:36-83) to the six packages, --version and every _COMMAND_SPECS group, with the budget check; it fails today for 31 groups. Files: src/devops_cli/core/validation.py, src/devops_cli/http/egress.py, src/devops_cli/exceptions/ai.py, src/devops_cli/ai/exceptions.py, the six src importers of moved exceptions, src/devops_cli/commands/mcp.py, src/devops_cli/commands/ai*.py, src/devops_cli/commands/review.py, src/devops_cli/commands/scan.py, src/devops_cli/commands/roadmap.py if still needed, src/devops_cli/config/defaults.py, tests/test_cli_startup_imports.py, the four test files importing moved exceptions. Refs refactor(ai): delete the pass-through package facades and the two stagepipeline protocols nothing implements #1002.
  3. PR 3 (S): dry runs. Tests first: one parametrized subprocess test runs k8s deploy-stack --dry-run, ai benchmark --dry-run and review path --dry-run offline, with the model edge faked, and asserts the module sets above. Files: the command modules and helpers the test points at, tests/test_cli_startup_imports.py. Closes refactor(ai): delete the pass-through package facades and the two stagepipeline protocols nothing implements #1002.

Acceptance criteria

  • src/devops_cli/ai/__init__.py, src/devops_cli/ai/agents/__init__.py, src/devops_cli/github/__init__.py and src/devops_cli/ai/mcp/__init__.py hold a docstring and nothing else, and a test pins it.
  • src/devops_cli/ai/agents/pydantic_agent.py, src/devops_cli/pipeline/, src/devops_cli/ai/pipeline_protocol.py, tests/test_pipeline_engine.py and tests/test_pipeline_protocol.py are deleted.
  • The AST test finds no facade import of a non-submodule name in src, tests or the knowledge-base pages.
  • DEFAULT_C901_SUPPRESSION_CEILING is 49, the src type: ignore ceiling is 90, and tests/fixtures/swallowed_failures_ceilings.json has no ai/pipeline_protocol.py entry.
  • devops --version, devops --help and every group's --help load none of pydantic-ai, kubernetes, docker, fastmcp, qdrant-client and opentelemetry, and stay within 0.5 s and 1.0 s of import time; the test lists the slowest imports when it fails.
  • rg -n "^import pydantic_ai|^from pydantic_ai" src/devops_cli/exceptions src/devops_cli/core/validation.py src/devops_cli/http/egress.py prints nothing.
  • The three dry runs load only what their plan needs, as decided above.
  • Every new and changed test runs offline, with no model, network or cluster.
  • changelog.d/1002.md lists the removed import paths under ### Removed; CHANGELOG.md is untouched.
  • uv run devops ci passes.
  • Pending a person: the PR records python -X importtime -c "import devops_cli.main" totals and devops ai --help wall time, before and after.

Current references

  • ai/__init__.py __getattr__ with its C901 marker: src/devops_cli/ai/__init__.py:8
  • ai/agents/__init__.py eager imports and __getattr__: src/devops_cli/ai/agents/__init__.py:7-288, :290
  • pydantic_agent.py re-exports of pydantic_ai.agent, ai.direct, ai.durable, ai.providers: src/devops_cli/ai/agents/pydantic_agent.py:14-30, :212-225, :227-236, :365-370
  • ai/mcp/__init__.py imports: src/devops_cli/ai/mcp/__init__.py:5-12, :109
  • github/__init__.py re-exports: src/devops_cli/github/__init__.py:27, :129
  • StagePipeline: src/devops_cli/pipeline/pipeline.py:32, src/devops_cli/ai/pipeline_protocol.py:62
  • PydanticAgent importers through the package: src/devops_cli/commands/ai.py:1058, :1240
  • commands/mcp.py facade import: src/devops_cli/commands/mcp.py:10
  • Knowledge-base facade imports: src/devops_cli/ai/knowledge_base/devops_cli/python_packages.md:126, src/devops_cli/ai/knowledge_base/devops_cli/libraries/pydantic_ai.md:54, :82
  • Ceilings: src/devops_cli/config/defaults.py:701, :708; tests/fixtures/swallowed_failures_ceilings.json:46
  • Private pydantic-ai imports: src/devops_cli/core/validation.py:17-21, :43-62; src/devops_cli/http/egress.py:29, :80
  • Exception subclasses and aliases of pydantic-ai: src/devops_cli/exceptions/ai.py:8, :182-514, :724-734
  • Command registry: src/devops_cli/main.py:34-78
  • Startup test: tests/test_cli_startup_imports.py:36-83, :185

Dependencies and order


Context & Rationale

About 3,700 lines of re-export serve between 0 and 11 source importers, and the documented stage protocol has two copies and no implementer. Checked at 9c879ae.

  • ai/__init__.py (1,153 lines): a 663-line __getattr__ with 33 if name in {...} blocks and a 479-name __all__. Its first statement already does import_module(f"devops_cli.ai.{name}"), so the remaining ~650 lines serve no source importer; one source module (gateway_tune.py) and 11 test files import through it.
  • ai/agents/__init__.py (1,213 lines) eagerly imports 8 submodules, including pydantic_agent.py (931 lines, a 435-name re-export of pydantic_ai), then a 374-line __getattr__ routes lazily to 16 sibling packages (ai.durable, ai.tools, ai.harness, ...): a child re-exporting its parent's siblings, the shape test_no_circular_imports_in_decoupled_subsystems exists to police. 35 source modules import something under ai.agents and each pays the eager pydantic_ai import; 2 use the package path (15 test files do).
  • github/__init__.py: 107 names, 0 users. ai/mcp/__init__.py: 120 names, 3 users.
  • StagePipeline exists twice (pipeline/pipeline.py:32, ai/pipeline_protocol.py:62) with zero implementers outside their own packages; only tests/test_pipeline_engine.py (8 tests) and tests/test_pipeline_protocol.py (4) use them. The review uses MultiAgentPipeline and review/stages/ (2 files); Remove the review stage modules the pipeline never calls #530 removed the stage modules nothing called.
  • exceptions/__init__.py (86 names, 21 used by 52 modules) hides 17 files behind a small interface and stays.
  • feat(cli): public re-export surface consolidation #424 consolidated the lists; refactor(config): the config barrel and the unused config names go, and the package inits stop re-exporting #776 covers config/__init__.py and is not repeated here.

Deletion test: pure pass-through. Two source import lines and about 26 test import lines re-point to the owning module; nothing else moves.

Scope & Deliverables

Strategic Alignment

Scope added 2026-10-02: checked at 38517a8, with corrections. ai/agents/pydantic_agent.py is not mainly a re-export of pydantic_ai. Of its 435 names, 377 come from 27 devops_cli.ai modules and 58 from pydantic_ai. 17 source modules import it: 12 under ai/harness/, ai/pydantic_ai_bridge.py:18, ai/ext_langchain.py:8, ai/agents/pipeline.py:29, ai/review/pipeline.py:34 and ai/agents/__init__.py:45. So deleting it re-points about 17 source modules, not 2. commands/ai.py:1009 and :1172 import PydanticAgent through the package. The whole src/devops_cli/pipeline/ package (__init__.py, models.py, stage.py, pipeline.py, 280 lines) has no importer in src, not only its StagePipeline; with ai/pipeline_protocol.py (168 lines) only the two test files use them. Two knowledge-base pages teach the facade path: ai/knowledge_base/devops_cli/python_packages.md:137 and ai/knowledge_base/devops_cli/libraries/pydantic_ai.md:54,83. #921's key question leaves deleting the unused StagePipeline to a refactor item, and this is that item.

Acceptance criteria

  • ai/__init__.py, ai/agents/__init__.py, github/__init__.py and ai/mcp/__init__.py hold a docstring and nothing else.
  • ai/agents/pydantic_agent.py is deleted. Its 17 source importers import from the module that defines each name, or from pydantic_ai.
  • The src/devops_cli/pipeline/ package and ai/pipeline_protocol.py are deleted, with tests/test_pipeline_engine.py and tests/test_pipeline_protocol.py.
  • Every from devops_cli.ai import, from devops_cli.ai.agents import, from devops_cli.ai.mcp import and from devops_cli.github import in src, tests and the knowledge-base pages names a submodule, as ai/gateway_tune.py:28 and ai/tools/registry.py:161 already do. An AST test checks it. At 38517a8, 88 such lines exist (6 in src), most of them importing re-exported names.
  • A test pins that the four emptied __init__.py files import nothing. The wider rule in the deliverable ("no __init__ imports a sibling package") is not adopted here: 13 other package __init__.py files import outside their package at 38517a8 (for example ai/personas, ai/review, ai/tools, core, models, commands/k8s). The PR lists them for a later item.
  • ARCHITECTURE.md no longer names StagePipeline or devops_cli.pipeline. docs: hand-written docs name only commands, options and components that exist #921 (v0.2.28) rewrites ARCHITECTURE.md:187 to say the protocol exists but is unused; this item removes that text, or docs: hand-written docs name only commands, options and components that exist #921 drops it if this item lands first.
  • The new and changed tests run offline, with no model, network or cluster.
  • changelog.d/1002.md lists the removed import paths under ### Removed. CHANGELOG.md is not edited.
  • uv run devops ci passes.
  • (person-run) The PR records python -X importtime -c "import devops_cli.main" totals before and after.

Key questions

Amended 2026-10-04: a startup budget for help, version and dry runs

The owner (2026-10-04): help and dry-run commands are "way slower than they need to be", although the CPU is idle. Measured the same day, best of two:

  • devops --version takes 3.0 s, and so does devops --help. devops ai benchmark --help takes 10.5 s. A bare interpreter starts in 0.03 s, and Typer, Rich and Click together import in 0.13 s (Textual alone in 0.32 s).

  • python -X importtime -c 'import devops_cli.main' spends 2.3 s, 1.5 s of it importing pydantic-ai. The chain is devops_cli.core.cli → devops_cli.exceptions → exceptions.ai → pydantic_ai.exceptions → pydantic_ai, then its agent, capabilities and MCP modules, then fastmcp's client. These facades and eager re-exports are what this item deletes.

  • uv run adds about 1.5 s per call. It checks the environment and, with UV_COMPILE_BYTECODE set, prints "Bytecode compiled 12637 files" every time.

  • devops --version, devops --help and every devops <group> [<command>] --help import no pydantic-ai, kubernetes, docker, fastmcp, qdrant-client or opentelemetry module. A test runs each in a subprocess and asserts the absence through sys.modules. Exception modules define their classes without importing pydantic-ai.

  • A startup budget, as a named constant and a test: devops --help and devops --version within 0.5 s of import time (-X importtime cumulative for devops_cli.main), and any --help within 1.0 s. The test fails with the slowest imports listed.

  • --dry-run paths import only what their plan needs. One test covers a dry run of ai benchmark, k8s deploy-stack and review path.

  • Priority? Proposed: raise to P1. Every command, every agent loop and every test subprocess pays the startup cost, and the gate budget (CI speed is P0) pays it too.

Update 2026-10-08: refinement

#921 removed StagePipeline from ARCHITECTURE.md; drop that criterion. src/devops_cli/pipeline/ and ai/pipeline_protocol.py:62 remain, unimported in src. Extend tests/test_cli_startup_imports.py (#858) to --version, every group's --help, and kubernetes, docker, fastmcp and qdrant-client. #1005 no longer deletes ai/direct.py. #1335 lists pipeline/; whichever lands second drops it there.

Activity

  1. added
    type/refactor
    scope/ai
    priority/p2-medium
    on Oct 2, 2026
  2. added this to the v0.2.37 milestone on Oct 17, 2026
  3. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    Moved to v0.2.37: v0.2.37 started with fewer than its 16 items and was topped up to 16 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)

  4. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    Amendment (2026-10-18), from the hook-speed investigation: PR 2 also covers running commands

    PR 2 asserts that --version, --help and every group's --help load no pydantic-ai. Every running devops command still imports the whole package, through two module-level imports of one SSRF helper:

    • src/devops_cli/http/egress.py:29 and src/devops_cli/core/validation.py:17-21 import pydantic_ai._ssrf at module level, and importing a submodule runs pydantic_ai/__init__ (agents, MCP, fastmcp, logfire: about 1,000-1,300 extra modules).
    • Every command reaches them: main.py:119 -> telemetry/__init__.py:53 -> telemetry/service_status.py:23-24 -> http/__init__.py:5 -> http/client.py:32 -> egress. There is also a path through telemetry/__init__.py:79 -> waterfall.py:14-15, and through get_tracer via tracer.py:819.
    • On a quiet machine (load 1, 3 runs) import pydantic_ai alone costs 1.65 s, and the command import chain 1.98 s. Every hook-level devops ci test, every pre-push devops ci and every devops gh call pays it.
    • A prototype at 3dd7fa6 moved those imports to their use sites. It passed tests/test_http_egress.py and tests/test_validation.py (155 passed), and cut devops ci test --dry-run from 2,320 to 1,034 modules and from a median 10.36 to 5.15 CPU-s. Making service_status lazy alone, or using a function-level import in egress alone, does not remove the load.

    Proposed additions to PR 2:

    • Import is_cloud_metadata_ip inside _refusal in http/egress.py.
    • In core/validation.py, build the network tables in a functools.cached function that imports _PRIVATE_NETWORKS on first call, and import is_cloud_metadata_ip and is_private_ip at their use sites. #1622 reworked this module, so recheck the line numbers.
    • pydantic-ai's SSRF predicates stay the source of truth; nothing is re-implemented.
    • Tests first, in tests/test_cli_startup_imports.py: a subprocess imports devops_cli.main and devops_cli.commands.ci, calls devops_cli.telemetry.tracer.get_tracer(), imports devops_cli.http, and asserts "pydantic_ai" not in sys.modules. The egress and validation tests keep their behaviour.

    This was drafted as a separate item. It is posted here instead, because it is the same import-budget work PR 2 already does and the agent filing quota is nearly spent.

  5. added
    status/in-progress
    on Oct 18, 2026
  6. added
    priority/p1-high
    and removed
    priority/p2-medium
    on Oct 18, 2026
  7. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1680, merged into release/v0.2.37 as a17b56b.

    Summary

    Fixes #1002 (PR 3 of 3 - Closing PR).

    Adds named startup import budget constants and automated regression tests ensuring devops --help and devops --version finish importing within 0.5 s (-X importtime cumulative for devops_cli.main) and any <command> --help within 1.0 s, reporting the slowest imports on budget breach. Also adds dry-run dependency isolation tests asserting that ai benchmark, k8s deploy-stack, and review path import only what their execution plan requires.

    11 file(s) changed.

    How it was verified

    Check runs at 735af76:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • zizmor: pass
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Service Image: skipping
    • Rule Pack Tests: pass
    • Fail-to-Pass Self-Check: pass
    • Changed-Test Independence: pass
    • Tests & Coverage: pass
    • Fail-to-Pass Check: pass
    • Analyze (python): pass
    • Analyze (actions): pass
    • Static Analysis: pass
    • DevContainer Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1002-delete-facades-and-stagepipeline-protocols.md:

    • Package __init__.py files for devops_cli.ai, devops_cli.ai.agents, devops_cli.ai.mcp, and devops_cli.github hold only single module docstrings.
    • Architectural invariant test test_no_non_submodule_imports_from_ai_and_github_facades enforces zero non-submodule imports from these facades across src/, tests/, and knowledge base docs.
    • Dead modules src/devops_cli/ai/agents/pydantic_agent.py, src/devops_cli/ai/pipeline_protocol.py, and the entire src/devops_cli/pipeline/ package are deleted along with their obsolete test suites.
    • All imports in src/ and tests/ point directly to defining submodules.
    • Suppression ceilings and swallowed failures ratchets are lowered to reflect removed suppressions.
    • Lazy import optimization ensures devops --version, devops --help, and all devops <group> --help commands load zero heavy modules (pydantic_ai, kubernetes, docker, fastmcp, qdrant_client, opentelemetry).
    • SSRF validation helpers in devops_cli.core.validation and devops_cli.http.egress lazified to prevent running commands (devops ci, tracer, http client) from eagerly importing pydantic_ai.
    • Pydantic AI exception classes decoupled into devops_cli.exceptions.ai_pydantic and lazily re-exported in devops_cli.exceptions.ai.
    • Pass-through package facades devops_cli.ai.rag, devops_cli.ai.review, and devops_cli.ai.benchmark made lazy via __getattr__.
    • FastMCP server imports in devops_cli.commands.mcp made lazy inside command functions.
    • Comprehensive startup import isolation tests added in tests/test_cli_startup_imports.py.
    • uv run devops ci passes with 100% success.
    • Defined named startup import budget constants and tests for --version/--help (< 0.5s) and any command --help (< 1.0s), reporting slowest imports on failure.
    • Added dry-run import isolation test verifying ai benchmark, k8s deploy-stack, and review path import only what their plans need.
    • Added changelog fragment changelog.d/1002.md.
  8. added a commit that references this issue on Oct 20, 2026
  9. removed
    status/in-progress
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/aitype/refactor

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions