test(install): cover install flow; add probe cache + ban-risk guardrails - #602
Open
rakeshbishtn wants to merge 1 commit into
Open
test(install): cover install flow; add probe cache + ban-risk guardrails#602rakeshbishtn wants to merge 1 commit into
rakeshbishtn wants to merge 1 commit into
Conversation
- tests/test_install_flow.py: 25 tests for _detect_environment, safe/dry-run side-effect isolation, --channels=all expansion, channel normalization, probe cache TTL semantics, doctor --refresh, cookie ban-risk warning - probe.py: TTL cache for probe_command (10s default) so repeated doctor runs reuse fresh results; clear_probe_cache() forces a full re-probe - cli.py: doctor --refresh flag; _warn_cookie_ban_risk printed when saving Twitter/X or Xiaohongshu cookies (account-ban risk, throwaway-account advice) - doctor.py: ban-risk line in the report when cookie-based channels active - conftest.py: autouse fixture clears the probe cache per test
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.
Summary
Addresses three weaknesses identified in the install/doctor path:
1. Install flow had no direct test coverage
New
tests/test_install_flow.py(25 tests):_detect_environment()local/server classification (SSH, container markers, headless+virt, clean local)~/.agent-reach/tools, safe mode never writes config or persists a proxy, dep-check helpers never execute installers--channels=allexpands to exactly the supported set (cookie/manual-only channels excluded); channel names normalize case/whitespace; unknown channels exit 2 before any side effect2. Doctor accuracy / probe churn
probe_command()now has a TTL cache (10s default, keyed by binary+args+env) so repeateddoctorruns reuse fresh results instead of re-executing every upstream CLIagent-reach doctor --refreshflag forces a full re-probeclear_probe_cache()exported for programmatic invalidationtests/conftest.pyautouse fixture clears the cache per test so a real host probe can never poison a mocked test3. Cookie account-ban risk was README-only
configure twitter-cookies/xhs-cookiesnow print a targeted ban-risk warning (throwaway-account advice) at the moment credentials are saveddoctorreport adds a ban-risk line when cookie-based channels (twitter/xiaohongshu/reddit/xueqiu) are activeVerification
doctor --refresh --jsonand the configure warning verified liveNotes
probe_commandsignature is backward compatible (use_cache=Truedefault; existing callers unchanged)