fix(init): Python root-entrypoint + env-only directory selection (#173)#181
fix(init): Python root-entrypoint + env-only directory selection (#173)#181skakri wants to merge 1 commit into
Conversation
Two init-scanner UX refinements for Python dir selection (the walker floor already handles the safety-critical part — these are about what `init -y` writes): - Root entrypoints alongside a package dir: a repo with root manage.py/main.py AND a package dir wrote only the package binding, omitting the root files, because `.` (the aggregate bucket) was never recognized as DIRECTLY containing source. Root files now key under `.` in direct_dir_counts, and a new python_root_has_direct_source makes `.` a default when the root holds real entrypoints — so both `.` and the package dir are offered. - env-only repos no longer promote `.`: when every .py lives under a dependency tree (env/.venv/site-packages/…), the fallback would pick `.` on aggregate count and write python=["."] over installed deps. The fallback now skips `.` for Python unless the root directly contains real source. Added tests for both (realistic env-only repo; root entrypoints + package dir); existing venv-only test still green.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
SCIP oracle — resolution reportHeuristic→compiler edge resolution per corpus. Δ compares resolved-after to the
resolved = |
💡 Codex Reviewrag-rat/crates/rag-rat-cli/src/init/scan.rs Lines 122 to 126 in 04de235 . for env-only Python
In an env-only repo where the scan finds Python only under a dependency component such as ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
| Branch | fix/python-init-dir-selection |
| Testbed | ubuntu-latest |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
- LL Hits (hits)
- Estimated Cycles (cycles)
- RAM Hits (hits)
- Total read+write (reads/writes)
- Instructions (instructions)
- L1 Hits (hits)
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Estimated Cycles | cycles x 1e6 | Instructions | instructions x 1e6 | L1 Hits | hits x 1e6 | LL Hits | hits x 1e6 | RAM Hits | hits x 1e3 | Total read+write | reads/writes x 1e6 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| rag_pipeline::pipeline::index cargo_resolver:resolver_config() | 📈 view plot | 1,215.13 x 1e6 | 📈 view plot | 801.58 x 1e6 | 📈 view plot | 1,117.18 x 1e6 | 📈 view plot | 17.42 x 1e6 | 📈 view plot | 309.70 x 1e3 | 📈 view plot | 1,134.91 x 1e6 |
| rag_pipeline::pipeline::query_cold cargo_resolver:resolver_built_config() | 📈 view plot | 241.10 x 1e6 | 📈 view plot | 154.62 x 1e6 | 📈 view plot | 230.96 x 1e6 | 📈 view plot | 1.95 x 1e6 | 📈 view plot | 11.30 x 1e3 | 📈 view plot | 232.92 x 1e6 |
| rag_pipeline::pipeline::query_warm cargo_resolver:resolver_index() | 📈 view plot | 232.87 x 1e6 | 📈 view plot | 149.16 x 1e6 | 📈 view plot | 223.19 x 1e6 | 📈 view plot | 1.85 x 1e6 | 📈 view plot | 12.46 x 1e3 | 📈 view plot | 225.05 x 1e6 |
|
| Branch | fix/python-init-dir-selection |
| Testbed | ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result seconds (s) (Result Δ%) | Upper Boundary seconds (s) (Limit %) |
|---|---|---|---|
| index_time/full_rebuild_cargo | 📈 view plot 🚷 view threshold | 4.77 s(+27.34%)Baseline: 3.75 s | 5.79 s (82.48%) |
Fixes #173. Two init-scanner UX refinements for Python directory selection. The safety-critical part (the walker flooring
site-packages/.venv/venv/__pycache__) already shipped in #167 — these are about whatinit -ywrites.1. Root entrypoints alongside a package dir
A repo with root
manage.py/main.pyand a package dir wrote only the package binding, omitting the root files:.(the aggregate bucket every file increments) was never recognized as directly containing source. Now root-level files key under.indirect_dir_counts, and a newpython_root_has_direct_sourcemakes.a default when the root holds genuine entrypoints — so both.and the package dir are offered.2. env-only repos no longer promote
.When every
.pylives under a dependency tree (env/,.venv/…/site-packages, …), the no-default fallback would pick.on aggregate count and writepython = ["."](over installed deps). The fallback now skips.for Python unless the root directly contains real source — so an env-only repo gets no Python binding rather than a wrong one.Tests
root_entrypoints_default_alongside_a_package_dir—manage.py+myapp/→ both.andmyappare defaults.fallback_does_not_promote_dot_when_python_lives_only_under_a_dependency_tree— realistic env-only repo (.carries the aggregate count) → no default.fallback_does_not_promote_a_venv_only_python_repostays green; fullrag-ratsuite + fmt + clippy clean. The count-keying change is Python-guarded in the selection logic, so other languages' dir selection is unaffected.Last of the #167 Python follow-ups (with #172 / PR #180 and #174 / PR #179).