Repository navigation
Phase A: establish the canonical cacheroute src namespace - #158
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b3815604c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,5 +1,5 @@ | |||
| """Compatibility re-export for the dependency-light runtime profile helpers.""" | |||
| from cacheroute_compat.runtime import ( | |||
| from cacheroute.compat.runtime import ( | |||
There was a problem hiding this comment.
Keep canonical imports available in source checkouts
When users follow the documented lightweight-demo flow—installing requirements.txt and running entrypoints from test/—the scripts add only the repository root to sys.path, not src. This import therefore raises ModuleNotFoundError: No module named 'cacheroute' while loading kdn_server.kv_builder; the focused runtime test also fails during collection in a clean checkout unless an undocumented editable install was performed. Add src to the source/test import path or retain a root-visible forwarding bridge.
AGENTS.md reference: AGENTS.md:L91-L96
Useful? React with 👍 / 👎.
Motivation
cacheroutePython namespace under asrc/layout to host compatibility helpers and observability symbols without importing heavyweight runtime services or application config.Description
src/cacheroutewith lightweight__init__.pyand addsrc/cacheroute/compat/runtime.pyby migrating the dependency-light compatibility helpers from the oldcacheroute_compatimplementation while preserving identical behavior and public symbols; addsrc/cacheroute/observability/__init__.pyas an empty dependency-light observability namespace.srclayout by addingpackage-dir = {"" = "src"}and settingwhere = ["src"]inpyproject.toml, and remove the placeholder author email that blocked metadata validation.from cacheroute.compat.runtime import ...) incore/runtime_compat.pyandkdn_server/domain/models.pyand adjust tests accordingly; add a thin forwarding shim package undersrc/cacheroute_compatthat re-exports the canonical module to preserve backward compatibility for Phase A.test/test_runtime_compat.pyasserts legacy-to-canonical forwarding,test/test_namespace_layout.pyvalidates the canonical namespace remains dependency-light, andtest/test_wheel_install.pyupdated to validate the installed-wheel import surface; keep no duplicate implementations and document the forwarding shim for future removal.Testing
python3 -m pip install -e .with build isolation failed due to environment package-index restrictions (could not download build deps); this is an environment network restriction and not a code error.python3 -m pip install -e . --no-build-isolation --no-depssucceeded (editable install without fetching dependencies).python3 -m compileall -q src test scriptssucceeded.python3 -m pytest -q test/test_runtime_compat.py test/test_namespace_layout.py test/test_wheel_install.pysucceeded: all tests passed (12 passed).git diff --checkpassed with no whitespace/errors reported.Notes: The change intentionally limits Phase A to dependency-light packages; core runtime packages (proxy/instance/kdn) were not migrated in this phase and remain discoverable only as source files (they are not packaged under
src/until a follow-up phase). Thecacheroute_compatforwarding shim remains in place to avoid breaking consumers and is documented for removal in a future release.Codex Task