Skip to content

Epic: migrate CacheRoute to the RFC-defined canonical package architecture #157

Open

Description

@rickisba

Status

PR #158 completed the Phase A namespace foundation:

  • established src/cacheroute;
  • moved the compatibility implementation to cacheroute.compat;
  • retained a tested temporary cacheroute_compat forwarding 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:

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.contracts packages.
  • 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.integrations and implements CacheRoute-owned ports.
  • Scheduler, Proxy, Instance, and KDN implementations live under cacheroute.services and must not import one another's internal modules.
  • CLI, Uvicorn application factories, demo orchestration, settings composition, and dependency injection live under cacheroute.entrypoints.
  • cacheroute.compat contains 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

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/contracts to cacheroute.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.lmcache implementing 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:

  1. KDN;
  2. Scheduler;
  3. Proxy;
  4. 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.dev or examples.
  • 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_compat at its documented milestone.
  • Switch packaging to canonical src-only discovery.

Coordination

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:

Refs #159
Refs #141

Activity

  1. changed the title [-]Repository architecture: consolidate Python packages under a unified src/cacheroute namespace[/-] [+]Epic: migrate CacheRoute to the RFC-defined canonical package architecture[/+] on Jul 30, 2026
  2. rickisba commented on Jul 31, 2026

    @rickisba
    CollaboratorAuthor

    Phase 1A is now tracked by #170.

    Scope: remove repository-only doc, env, log, scripts, and test namespaces from the wheel while preserving all current root runtime packages, runtime package data, direct source-checkout scripts, and behavior.

    data and 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

  3. rickisba commented on Jul 31, 2026

    @rickisba
    CollaboratorAuthor

    Phase 2 implementation begins with #172.

    This is the first real Python ownership migration after the packaging boundary work: canonicalize RuntimeProfile and the dependency-light KDN v1 contract foundation under src/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.

  4. rickisba commented on Aug 3, 2026

    @rickisba
    CollaboratorAuthor

    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/observability before 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

  5. rickisba commented on Aug 4, 2026

    @rickisba
    CollaboratorAuthor

    A documentation-governance slice is now tracked by #180.

    It creates doc/developer-handbook/README.md as 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

  6. rickisba commented on Aug 4, 2026

    @rickisba
    CollaboratorAuthor

    The canonical observability ownership milestone is complete through merged PR #179 (merge commit 5562c223ad8900a5ced473ce10982ca7f827f117) and completed Issue #178.

    cacheroute.observability / cacheroute.observability.v1 now live under the approved src/cacheroute namespace, 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 root cacheroute_observability direction was not retained.

    This Epic remains open because integrations, services, entrypoints, root-package retirement, and broader compatibility cleanup are still unfinished.

  7. rickisba commented on Aug 4, 2026

    @rickisba
    CollaboratorAuthor

    Canonical observability migration continues through #182.

    The new slice reuses cacheroute.observability from 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.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions