fix: ignore hidden directories during server discovery#259
Conversation
Agent-Logs-Url: https://github.com/plugboard-dev/plugboard/sessions/0bdaf24d-13ed-4323-8342-0f9fe1e414ab Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/plugboard-dev/plugboard/sessions/0bdaf24d-13ed-4323-8342-0f9fe1e414ab Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/plugboard-dev/plugboard/sessions/0bdaf24d-13ed-4323-8342-0f9fe1e414ab Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
| assert process_route.called | ||
|
|
||
|
|
||
| def test_cli_server_discover_ignores_hidden_directories(tmp_path: Path) -> None: |
There was a problem hiding this comment.
Parametrize the existing test to avoid duplication
There was a problem hiding this comment.
Updated in fe09f85 by folding the duplicated coverage into the existing discovery test as a parametrized set of cases.
Agent-Logs-Url: https://github.com/plugboard-dev/plugboard/sessions/95e9b248-3b2e-44b6-8916-b2c37aa87c09 Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/plugboard-dev/plugboard/sessions/95e9b248-3b2e-44b6-8916-b2c37aa87c09 Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
| except (ModuleNotFoundError, ImportError, SyntaxError) as e: | ||
| logger.warning(f"Failed to import module {module_name}: {e}") | ||
|
|
||
| def _walk(current_path: Path) -> None: |
There was a problem hiding this comment.
Actually keep the inplace update to dirs as it is less code @copilot
There was a problem hiding this comment.
Updated in 58f2032 to restore the os.walk + dirs[:] pruning approach, while keeping the module-name handling a bit cleaner with Path.relative_to(...).with_suffix("").
Agent-Logs-Url: https://github.com/plugboard-dev/plugboard/sessions/2d8dca45-18df-4778-8cbe-25c9bccbf641 Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/plugboard-dev/plugboard/sessions/2d8dca45-18df-4778-8cbe-25c9bccbf641 Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
|
Benchmark comparison for |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Benchmark comparison for |
Summary
plugboard server discovercould fail when the target directory contained a hidden virtualenv such as.venv, because discovery attempted to recurse into and import files from hidden paths. This change makes discovery skip hidden directories while preserving normal module discovery.Changes
Discovery traversal
os.walk.dirs[:]so discovery does not descend into.venvand similar paths.Path(...).relative_to(...).with_suffix("").Regression coverage