Repository navigation
chore(query): drop unused rag extras and the executor's dead template directory - #127
Merged
Merged
Conversation
… directory The `rag` optional-dependency group (chromadb, langchain) has no consumer anywhere in the package, tests, docs, or skills; installing `pt-snap-cli[rag]` pulled two large dependencies and enabled nothing. QueryExecutor also carried its own template loader: a non-recursive `*.yaml` glob over the `template_dir` that QueryService passed in. Every packaged template lives in a category subdirectory, so that glob never matched and `_configs` stayed empty on the product path; lookups always fell through to the registry, which is the real (recursive, category- inferring) loader. Keeping a second loader with different semantics only invited drift. Remove the `template_dir` parameter and `_load_templates()`, construct the executor with the context alone, and document that the registry is the sole loader for packaged templates while `load_config()` / `register_template()` remain the explicit runtime-attachment APIs. Add tests pinning registry fallback and runtime-override precedence. Fixes #121
6 of 7 tasks
6 of 7 tasks
Keep main's v1/v2 callstack layout executor while dropping the dead non-recursive template_dir loader.
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Two leftovers that no longer match the implementation:
1.
ragoptional dependencies are unused.pyproject.tomldeclaredrag = ["chromadb>=0.4.0", "langchain>=0.1.0"], but nothing insrc/,tests/,benchmarks/,docs/, orskills/imports or mentions them.pip install "pt-snap-cli[rag]"pulled two large dependency trees and enabled nothing. The group is removed;devis now the only extra.2.
QueryExecutorhad a template loader that could never load anything.QueryService._get_executor()passedtemplate_dir=.../query/templates, andQueryExecutor._load_templates()globbed*.yamlnon-recursively. Every packaged template lives in a category subdirectory (basic/,business/,statistical/), so the glob never matched,_configsstayed empty on the product path, and_find_template()always fell through to the registry — the real loader, which is recursive and inferscategoryfrom the directory. Two loaders with different semantics for the same files is an invitation to drift, andAGENTS.mdonly ever described the registry one.Changes (option A from #121, the minimal one):
template_dirparameter,_template_dir, and_load_templates()fromQueryExecutor;QueryServiceconstructs it with the context alone.load_config()/register_template()as the explicit runtime-attachment APIs (they are exercised bytests/query/test_executor.py); runtime-registered templates still take precedence over registry entries of the same name.src/pt_snap_cli/query/AGENTS.mdnow states that the registry is the sole loader for packaged templates and what_configsholds.warningsimport.execute_on_all_devices()andvalidate_output()are left as-is; #121 only asked for a decision, and they remain covered public API of the executor.🔗 Related Issue
Fixes #121
🧪 Testing
New tests in
tests/query/test_executor.py:test_packaged_templates_resolve_through_registry_only— a fresh executor has_configs == {}yet resolvesleak_detectionand lists it, pinning the registry fallback.test_runtime_registered_template_shadows_registry—register_template()still overrides a registry template of the same name.Full suite (macOS, Python 3.13.11):
771 passed, 1 xfailed.ruff check ./black --check .clean.tomllibconfirmsoptional-dependencies == ['dev']. End-to-end:pt-snap importof a fixture followed bypt-snap query --template-use memory_peakstill returns the peak row through the service path.✅ Checklist
Snapshot Runtime Provenance
Snapshot provenance decision: no-update
Snapshot provenance no-update reason: This PR changes pyproject.toml extras, the query executor/service, query AGENTS.md, and executor tests; no files under src/pt_snap_cli/snapshot/ are touched.
📋 Additional Notes
Merge order relative to #126 (parameter validation) does not matter; the two PRs touch different parts of
executor.py/query_service.pyand both apply cleanly onmain.