test: add install smoke matrix#228
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
📝 Walkthrough
WalkthroughParametrized pytest smoke test runs ChangesCLI Install Smoke Test
🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs:
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.22.0)OpenGrep fatal error (exit code 2): �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Gradata/tests/test_install_smoke_matrix.py`:
- Around line 105-108: The assertions that check legacy event names use exact
line matching against legacy_event_lines and miss variants like "pre_tool_use:
[]" or indented keys; update the checks that reference legacy_event_lines and
the string literals "pre_tool_use:", "post_tool_use:", and "session_end:" to
perform substring or regex-style matching against each line (e.g., assert not
any('pre_tool_use:' in line or re.match(r'^\s*pre_tool_use\b', line) for line in
legacy_event_lines)) so the test fails on any line containing those event names
regardless of trailing value or leading whitespace.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: a48acd42-ce48-4e9a-8c09-f31ab900049c
📒 Files selected for processing (1)
Gradata/tests/test_install_smoke_matrix.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: pytest (py3.11)
- GitHub Check: pytest (py3.12)
- GitHub Check: pytest macos-latest / py3.12
- GitHub Check: pytest ubuntu-latest / py3.12
- GitHub Check: pytest windows-latest / py3.12
- GitHub Check: pytest macos-latest / py3.11
- GitHub Check: pytest ubuntu-latest / py3.11
- GitHub Check: pytest windows-latest / py3.11
🧰 Additional context used
📓 Path-based instructions (1)
Gradata/tests/**/*.py
📄 CodeRabbit inference engine (Gradata/AGENTS.md)
Gradata/tests/**/*.py: SetBRAIN_DIRenvironment variable viatmp_pathin conftest.py for test isolation — ensure_paths.pymodule cache refreshes when callingBrain.init()directly inside tests
Add unit tests intests/test_*.pyfor every CI push without LLM calls (deterministic); mark integration tests with@pytest.mark.integrationand skip them by default (they hit real LLM APIs)
Files:
Gradata/tests/test_install_smoke_matrix.py
🔇 Additional comments (5)
Gradata/tests/test_install_smoke_matrix.py (5)
13-38: LGTM!
60-89: LGTM!
90-104: LGTM!Also applies to: 109-115
7-7: ⚡ Quick winConfirm
tomllibcompatibility (Python >= 3.11)Project metadata sets
requires-python = ">=3.11", soimport tomllibis supported and notomlibackport is required.
41-57: EnsureBRAIN_DIRisn’t needed for the subprocessinstallsmoke test when--brainis passed
_run_install()strips existingGRADATA_*env vars and setsHOME/USERPROFILE/XDG_CONFIG_HOME, but does not setBRAIN_DIR. Insrc/gradata/cli.py, theinstallpath importsBrainand derives abrain_dirfrom CLI args, but the code shown doesn’t establish whether it relies solely on the--brainargument (vs falling back toBRAIN_DIR). Ifsrc/gradata/_paths.py/Braincan consultBRAIN_DIRwhen resolving the brain root, the test should set it (or the guideline should be scoped specifically to in-processBrain.init()usage).
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Gradata/src/gradata/cli.py`:
- Around line 522-523: The call to Brain.init(verification_dir) can spawn
interactive onboarding and must be forced non-interactive during install
verification; change the call site that assigns verification_brain to call
Brain.init with an explicit non-interactive flag (e.g.
Brain.init(verification_dir, non_interactive=True) or the equivalent parameter
your Brain.init API exposes such as
interactive=False/force_non_interactive=True) so onboarding will not read from
TTY and the install --agent verification path will not block.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 51670d10-51f3-4163-8aea-097c5f3a04e4
📒 Files selected for processing (1)
Gradata/src/gradata/cli.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: pytest ubuntu-latest / py3.12
- GitHub Check: pytest ubuntu-latest / py3.11
- GitHub Check: pytest macos-latest / py3.11
- GitHub Check: pytest (py3.12)
- GitHub Check: pytest macos-latest / py3.12
- GitHub Check: pytest windows-latest / py3.12
- GitHub Check: pytest windows-latest / py3.11
- GitHub Check: pytest (py3.11)
🧰 Additional context used
📓 Path-based instructions (1)
Gradata/src/**/*.py
📄 CodeRabbit inference engine (Gradata/AGENTS.md)
Gradata/src/**/*.py: Prefersentence-transformersfor local embeddings,google-genaifor Gemini embeddings,cryptographyfor AES-GCM encrypted system.db,bm25sfor BM25 rule ranking, andmem0aifor external memory adapters — guard all optional dependency imports withtry / except ImportErrorat the call site, never at module level
Maintain strict layering: Layer 0 (Primitives: _types.py, _db.py, _events.py, _paths.py, _file_lock.py; Patterns: contrib/patterns/) must never import from Layer 1 (Enhancements: enhancements/, rules/) or Layer 2 (Public API: brain.py, cli.py, daemon.py, mcp_server.py)
Never use bareexcept: pass— use typed exceptions or at minimumlogger.warning(...)withexc_info=Trueto avoid silent failure in a memory product
Never import from out-of-scope sibling directories../Sprites/or../Hausgem/withingradata/*code — that is a layering bug
Never leak private-sibling paths into public docs/code — no references to../Sprites/,../Hausgem/, email addresses, OneDrive paths, or Sprites-specific examples from insidegradata/*
Use atomic-write helper when writing JSON files to prevent corruption from mid-write crashes
Files:
Gradata/src/gradata/cli.py
| verification_brain = Brain.init(verification_dir) | ||
| try: |
There was a problem hiding this comment.
Force non-interactive Brain.init in install verification path.
Brain.init(verification_dir) may enter interactive onboarding on TTY stdin, which can stall install --agent when GRADATA_VERIFY_INSTALL is enabled. This verification bootstrap should be explicitly non-interactive.
Proposed fix
- verification_brain = Brain.init(verification_dir)
+ verification_brain = Brain.init(verification_dir, interactive=False)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| verification_brain = Brain.init(verification_dir) | |
| try: | |
| verification_brain = Brain.init(verification_dir, interactive=False) | |
| try: |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Gradata/src/gradata/cli.py` around lines 522 - 523, The call to
Brain.init(verification_dir) can spawn interactive onboarding and must be forced
non-interactive during install verification; change the call site that assigns
verification_brain to call Brain.init with an explicit non-interactive flag
(e.g. Brain.init(verification_dir, non_interactive=True) or the equivalent
parameter your Brain.init API exposes such as
interactive=False/force_non_interactive=True) so onboarding will not read from
TTY and the install --agent verification path will not block.
Summary
gradata install --agent ...path.Test Plan
python3 -m pytest tests/test_install_smoke_matrix.py -q→ 4 passedpython3 -m pytest tests/test_cli_install_agent.py tests/test_hook_adapters.py tests/test_install_smoke_matrix.py -q→ 17 passedCloses GRA-1680