Repository navigation
Epic: migrate CacheRoute to the RFC-defined canonical package architecture #157
Description
Status
PR #158 completed the Phase A namespace foundation:
- established
src/cacheroute; - moved the compatibility implementation to
cacheroute.compat; - retained a tested temporary
cacheroute_compatforwarding shim; - reserved
cacheroute.observability; - added source-checkout, wheel, package-parity, Markdown-link, bootstrap, and root-directory governance checks.
This Issue remains open. Phase A did not complete the repository migration.
Target architecture
The original target tree in this Issue mirrored deployment processes directly under cacheroute and is superseded by the reviewed architecture in:
- RFC: redesign CacheRoute package architecture around contracts, domains, integrations, services, and entrypoints #159 — contracts, domains, integrations, services, plugins, entrypoints, packaging policy, dependency direction, and migration phases.
doc/architecture/package-architecture-rfc.mdafter the architecture-guidance PR is merged.
The canonical top-level Python packages are planned as:
cacheroute.contracts
cacheroute.runtime
cacheroute.topology
cacheroute.knowledge
cacheroute.cache
cacheroute.routing
cacheroute.observability
cacheroute.integrations
cacheroute.services
cacheroute.plugins
cacheroute.entrypoints
cacheroute.compat
Do not introduce a generic cacheroute.core dumping ground. Do not mechanically move current root directories into matching package names.
Architectural rules
- Stable cross-process schemas live under versioned
cacheroute.contractspackages. - CacheRoute-owned domain packages do not import FastAPI, Redis, vLLM, LMCache, or deployable service implementations.
- vLLM, LMCache, Redis, and embedding-specific code lives under
cacheroute.integrationsand implements CacheRoute-owned ports. - Scheduler, Proxy, Instance, and KDN implementations live under
cacheroute.servicesand must not import one another's internal modules. - CLI, Uvicorn application factories, demo orchestration, settings composition, and dependency injection live under
cacheroute.entrypoints. cacheroute.compatcontains temporary compatibility only, never permanent implementations.cacheroute.__init__remains empty or metadata-only.- No new functional top-level directory may be added without a dedicated architecture Issue.
- The root README remains a high-level overview; detailed architecture stays under
doc/.
Target repository categories
src/cacheroute/
tests/
examples/
doc/
scripts/
env/
crates/
tests, doc, scripts, env, logs, and generated data must not be installed as Python packages. Runtime package data must be owned by the package that consumes it.
Migration phases
Phase 0 — architecture foundation
- Merge PR Phase A: establish the canonical
cacheroutesrc namespace #158. - Merge the RFC: redesign CacheRoute package architecture around contracts, domains, integrations, services, and entrypoints #159 architecture guidance into
AGENTS.mdanddoc/architecture. - Add automated forbidden-dependency and wheel-allowlist checks.
Phase 1 — packaging and entrypoints
- Remove tests, documentation, scripts, deployment configuration, logs, and generated data from the wheel.
- Introduce one supported CLI:
cacheroute <scheduler|proxy|instance|kdn|dev>. - Add application factories and entrypoint smoke tests.
- Preserve current scripts through narrow temporary wrappers until replacements pass.
Phase 2 — contracts and dependency-light domains
- Move
kdn_server/contractstocacheroute.contracts.v1. - Move Runtime Profile, lifecycle, capability, and topology/resource models into their owning domains.
- Preserve old imports only through tested thin shims with removal milestones.
Phase 3 — external integrations
- Add
cacheroute.integrations.vllm. - Add
cacheroute.integrations.lmcacheimplementing Cache Runtime ports. - Isolate Legacy Redis behavior under
cacheroute.integrations.redis. - Move embedding implementations under
cacheroute.integrations.embeddings.
Phase 4 — services
Migrate in separate reviewable PRs:
- KDN;
- Scheduler;
- Proxy;
- Instance.
Each migration must audit and update normal and dynamic imports, module strings, Uvicorn targets, subprocess commands, Docker/CI/config paths, tests and monkeypatch targets, packaging, README links, and operational entrypoints.
Phase 5 — UI, development orchestration, and native components
- Co-locate UI assets with their owning service packages.
- Move demos to
cacheroute.entrypoints.devorexamples. - Review the Resource Agent as a focused native-component migration, potentially under
crates/.
Phase 6 — compatibility cleanup
- Remove obsolete root runtime packages.
- Remove transition package lists and direct-source bootstraps.
- Remove expired import shims, including
cacheroute_compatat its documented milestone. - Switch packaging to canonical src-only discovery.
Coordination
- RFC: redesign CacheRoute package architecture around contracts, domains, integrations, services, and entrypoints #159 defines the target architecture.
- v0.1.10-4: Add Unified v1 LMCache Gateway, Tier, Adapter, and Queue Observability #141 remains open.
- PR docs: research unified v1 LMCache observability for #141 #156 must rebase onto the merged namespace foundation, move its implementation into
src/cacheroute/observability, resolve its existing review findings, and avoid introducing a permanent root package. - Do not resume broad production instrumentation until the observability contract package is reviewed in its canonical location.
Required validation
Each migration PR must report exact results for its applicable commands and include:
- editable install;
- compileall;
- focused CPU-only regression suites;
- dependency-light import isolation;
- source-checkout entrypoint tests;
- repository-wide stale import and module-string scans;
- local Markdown-link validation;
- clean-copy wheel build and isolated install;
- wheel top-level package allowlist;
git diff --check.
Completion criteria
This Epic may close only when:
- RFC: redesign CacheRoute package architecture around contracts, domains, integrations, services, and entrypoints #159 architecture boundaries are reflected in the implementation;
- canonical contracts, domains, integrations, services, plugins, and entrypoints are established;
- vLLM and LMCache dependencies are isolated behind integration boundaries and domain ports;
- service packages do not import another service's internals;
- only
cacherouteand explicitly approved temporary shims enter the wheel; - root runtime package directories are removed;
- existing runtime behavior, wire values, commands, Docker/CI paths, and documentation links remain validated;
- compatibility shims have explicit removal milestones and no duplicate implementations;
- v0.1.10-4: Add Unified v1 LMCache Gateway, Tier, Adapter, and Queue Observability #141 observability work resides at
cacheroute.observability.
Activity
[-]Repository architecture: consolidate Python packages under a unified src/cacheroute namespace[/-][+]Epic: migrate CacheRoute to the RFC-defined canonical package architecture[/+]rickisba commentedon Jul 31, 2026
Phase 1A is now tracked by #170.
Scope: remove repository-only
doc,env,log,scripts, andtestnamespaces from the wheel while preserving all current root runtime packages, runtime package data, direct source-checkout scripts, and behavior.dataand the unified CLI are explicitly deferred to separate focused audits. This keeps the first implementation PR small and avoids combining packaging cleanup with service or entrypoint migration.Refs #159
rickisba commentedon Jul 31, 2026
Phase 2 implementation begins with #172.
This is the first real Python ownership migration after the packaging boundary work: canonicalize
RuntimeProfileand the dependency-light KDN v1 contract foundation undersrc/cacheroute, while retaining old paths only as identity-preserving forwarding shims.The full knowledge/cache-service contracts and their cache/topology domain models remain separate follow-up slices.
rickisba commentedon Aug 3, 2026
Phase 2 contract ownership is complete through merged PR #177 and closed Issue #176.
The next architecture slice is #178: establish the canonical observability v1 schema and process-local collector under
src/cacheroute/observabilitybefore any broad production instrumentation resumes.#178 also corrects the stale root-package direction in PR #156, requires reuse of canonical RuntimeProfile/contracts/cache vocabulary, and keeps service behavior, Gateway I/O, entrypoints, integrations, and the root README unchanged.
Refs #141
Refs #159
Refs #137
rickisba commentedon Aug 4, 2026
A documentation-governance slice is now tracked by #180.
It creates
doc/developer-handbook/README.mdas the stable developer entry point, maps canonical and transitional ownership, catalogs public APIs/fields/configuration/compatibility, and adds governance requiring Agents to update the relevant handbook chapter in the same PR whenever documented surfaces change.The root README remains high-level and receives only a navigation/table link. No package or service migration is included.
Refs #137
Refs #159
Refs #178
Refs #179
rickisba commentedon Aug 4, 2026
The canonical observability ownership milestone is complete through merged PR #179 (merge commit
5562c223ad8900a5ced473ce10982ca7f827f117) and completed Issue #178.cacheroute.observability/cacheroute.observability.v1now live under the approvedsrc/cacheroutenamespace, reuse canonical runtime/contracts/topology/cache vocabulary by identity, retain explicit package configuration, and are covered by dependency, namespace, source-checkout, governance, clean-wheel, and isolated-install validation. The obsolete rootcacheroute_observabilitydirection was not retained.This Epic remains open because integrations, services, entrypoints, root-package retirement, and broader compatibility cleanup are still unfinished.
rickisba commentedon Aug 4, 2026
Canonical observability migration continues through #182.
The new slice reuses
cacheroute.observabilityfrom merged PR #179, adds one dependency-light propagation helper under the canonical namespace, and instruments the existing Scheduler/Proxy services without moving their packages or introducing a new root directory. Full service-package migration remains outside this Issue and #157 stays open.docs: establish the CacheRoute developer and maintenance handbook