Skip to content
Edit this page

Standardization review

This review covers the current src/titancore package, public contracts, facades, provider composition, module layout, and their tests and guidance. The former src/titanspan namespace no longer exists.

Findings and fixes

Priority Finding Resolution
High Cache, database, and logging facades could return standalone resources belonging to another owner while an ambient application was selected. All three select the current application before considering standalone resources.
High A valid scoped container with a false truth value lost ownership to the ambient application. Application selection distinguishes None explicitly. Configuration and environment facades reuse that selection.
High Container calls read class annotations instead of constructor annotations, and failed on callable instances and partial callbacks. Annotation resolution uses the actual constructor, call method, or underlying function while preserving the original invocation signature.
Medium Callback invocation forced all inputs into keyword arguments, breaking positional-only parameters and treating variadic parameters as dependencies. Python's inspect.BoundArguments owns argument placement and defaults. Unsupported explicit arguments still raise errors.
High Asynchronous callable tool objects failed native schema inference or could return an unawaited coroutine. Tools adapt the bound call method before native schema inference and async detection. Blocking functions retain thread execution.
Medium Repeated model-facing tool names could silently overwrite each other in the native graph. The tool adapter rejects duplicate names before execution with a module-owned AI error.
Medium The workflow contract omitted existing graph construction, update streaming, and event methods. The protocol now includes those public operations with the concrete implementation's types.
Medium Conversation history lacked public contracts, public package exports, and facade access. Add read-only Message and Conversation protocols, export the existing concrete projections, and forward history selection through AI.
Medium Agent and workflow contracts accepted only sync iterables although implementations supported async iterables. Both protocols retain lazy sync and async inputs. A typed application integration verifies the boundary.
Medium Route compilation also owned the middleware route subclass and its closure factory. Move this responsibility into routing/middleware_route.py, retaining FastAPI's route reconstruction behavior and a Base-prefixed upstream class alias.
Low Env omitted explicit exports, and support class resolution imported its container annotation at runtime. Add Env exports and postpone the annotation import. Fix the stale Support guidance path.
Medium Three unit tests remained outside module directories; standalone logging tests depended on leaked ambient application state. Move tests into infrastructure/container directories, update focused CI targets, and isolate the standalone logging owner.
Medium README, architecture, roadmap, and agent guidance described implemented AI workflows as future work; roadmap content was duplicated. Document current AI composition and limitations, retain one canonical roadmap, and link it from the documentation site.

Regression evidence

  • tests/unit/facades/test_owner_selection.py verifies resource ownership and explicit scoped selection, including a falsy container.
  • tests/unit/container/test_call_resolution.py verifies constructor and callable annotations, partial callbacks, positional defaults, variadic inputs, and invalid explicit arguments.
  • tests/unit/ai/test_tools.py exercises real native tool adaptation, awaiting callable objects, duplicate names, and invalid definitions.
  • tests/integration/ai/test_application_composition.py composes real application providers, facades, typed contracts, Redis history, and workflow checkpoints. It verifies async inputs and rejects use after shutdown.
  • Existing routing integration tests retain middleware order and included router behavior after the internal class move.

The provider integration uses the real model SDK and graph engine with an in-process HTTP transport. It makes no paid model requests. Redis checkpoint operations use a real Redis server with JSON and search capabilities.

Retained boundaries

Protocols stay in contracts, facades remain proxies, and providers use service_provider.py with <Module>ServiceProvider names. Concrete repository implementations retain the RepositoryContract alias. Module exceptions share their owning exceptions.py file.

The native resolver stays within container and HTTP integration modules. SQLAlchemy, Psycopg, pgvector, and Alembic own PostgreSQL mechanics; Redis owns cache transport and atomic operations. The concrete database adapter retains Alembic configuration while its application contract stays independent of native migration types.

The framework does not add a second resolver, scheduler, memory store, or provider registry. Console, distributed queues, RAG, and MCP integrations remain future work. See the AI guide for implemented behavior and persistence and capacity boundaries.

Follow-up API examples

Request injection now accepts plain opaque service annotations with @inject. Pydantic continues to identify valid HTTP data schemas, and native request contexts keep their FastAPI behavior. Existing explicit annotation metadata retains its meaning. Sync and async HTTP tests verify service resolution, request/body/query validation, framework request aliases, and OpenAPI inputs.

The runnable hello-world example registers Route.get("/welcome", (WelcomeController, "show")) in routes/api.py and resolves its service through the controller constructor. A separate function action demonstrates plain parameter injection. The application example has one service, provider, and controller class per file.