Skip to content

fix(test): de-flake test_doctor_runs_on_brain#157

Merged
Gradata merged 1 commit intomainfrom
fix/doctor-runs-on-brain-flake
May 1, 2026
Merged

fix(test): de-flake test_doctor_runs_on_brain#157
Gradata merged 1 commit intomainfrom
fix/doctor-runs-on-brain-flake

Conversation

@Gradata
Copy link
Copy Markdown
Owner

@Gradata Gradata commented May 1, 2026

Root cause:
test_doctor_runs_on_brain calls diagnose(brain_dir=...) which defaults to include_cloud=True. The cloud probes (_check_cloud_config, _check_cloud_reachable, _check_cloud_auth) check ~/.gradata/config.toml and dial api.gradata.ai. In CI runners (and on dev machines without cloud credentials) cloud_config returns fail because [cloud] credentials are missing, which flips overall status to broken. The test only intends to assert the local brain is healthy.

Fix:
Pass include_cloud=False to scope the doctor to local brain checks (python, sqlite, system.db, manifest, etc.) — exactly what the fixture sets up. No production behavior changes; doctor implementation untouched.

Result: 4112 pass, 4 skipped, 0 fail (local pytest -m "not integration").

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4d208aa8-4f78-4efc-af3e-32b7ea3d4eb3

📥 Commits

Reviewing files that changed from the base of the PR and between 0e57fc3 and 2c053bd.

📒 Files selected for processing (1)
  • Gradata/tests/test_pattern_graduation_integration.py

📝 Walkthrough

Summary

  • Test fix for test_doctor_runs_on_brain: Modified integration test to call diagnose(brain_dir=..., include_cloud=False) to prevent cloud-dependent probes from causing flaky test failures in CI and dev environments
  • Root cause addressed: Cloud probes that read ~/.gradata/config.toml and contact api.gradata.ai were marking the brain as "broken" when cloud credentials were missing, despite the local brain being healthy
  • Scope change: Test now validates only local brain health (Python, SQLite, system.db, manifest, etc.) instead of including cloud infrastructure checks
  • No behavioral changes: Assertion remains unchanged (report["status"] must be "healthy" or "degraded"); no production code or doctor implementation modifications
  • Test results: Local test run confirmed 4112 passed, 4 skipped, 0 failed

Walkthrough

An integration test for the doctor diagnostic function was modified to pass include_cloud=False when invoking the diagnosis, restricting health checks to local brain state only while maintaining the same status assertion criteria.

Changes

Cohort / File(s) Summary
Test Modification
Gradata/tests/test_pattern_graduation_integration.py
Updated test_doctor_runs_on_brain to pass include_cloud=False parameter to gradata._doctor.diagnose, limiting health probes to local brain diagnostics and excluding cloud-dependent checks.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

bug

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/doctor-runs-on-brain-flake

Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Gradata Gradata merged commit 23a4857 into main May 1, 2026
8 of 9 checks passed
@Gradata Gradata deleted the fix/doctor-runs-on-brain-flake branch May 1, 2026 18:01
@coderabbitai coderabbitai Bot added the bug Something isn't working label May 1, 2026
Gradata added a commit that referenced this pull request May 1, 2026
…135) (#158)

Closes #135. Bundles handoff-watchdog.js + handoff-inject.js under src/gradata/hooks/assets/claude_code/. Adds install_js_hooks() + JS_HOOK_REGISTRY at STANDARD profile, --include-watchdog CLI flag, package-data wiring. 7 new unit+integration tests pass; full suite 4118 passed, 1 known flake (now fixed in #157).

Co-authored-by: Oliver <oliver@spritesai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant