Skip to content

test: add offline quickstart smoke path#234

Open
Gradata wants to merge 1 commit into
mainfrom
gra-1783-offline-quickstart
Open

test: add offline quickstart smoke path#234
Gradata wants to merge 1 commit into
mainfrom
gra-1783-offline-quickstart

Conversation

@Gradata
Copy link
Copy Markdown
Owner

@Gradata Gradata commented May 29, 2026

Summary

  • Adds examples/offline_quickstart_smoke.py, a zero-credential smoke path that runs directly from a source checkout.
  • Covers CLI init (gradata init --no-interactive) plus SDK output/correction/search/health/manifest calls against a temporary local SQLite brain.
  • Updates quickstart docs so Show HN readers can run the offline proof before cloud sync or social/platform credentials.

Test Plan

  • python3 examples/offline_quickstart_smoke.py
    • returned ok: true, cli_manifest_domain: Sales, OUTPUT: 1, CORRECTION: 1, search_results: 1
  • python3 -m pytest tests/test_offline_quickstart_smoke.py -q
    • 1 passed in 0.69s
  • python3 -m py_compile examples/offline_quickstart_smoke.py tests/test_offline_quickstart_smoke.py
    • passed with no output

Notes:

  • python3 -m ruff ... was attempted in the original worktree but ruff is not installed in the active Python (No module named ruff), so syntax compile was used as local fallback.

Closes GRA-1783

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 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7645f870-939a-4caf-ac87-88bdc99f2901

📥 Commits

Reviewing files that changed from the base of the PR and between a197bff and 189d2bc.

📒 Files selected for processing (3)
  • Gradata/docs/getting-started/quickstart.md
  • Gradata/examples/offline_quickstart_smoke.py
  • Gradata/tests/test_offline_quickstart_smoke.py
📜 Recent 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 windows-latest / py3.11
  • GitHub Check: pytest (py3.11)
  • GitHub Check: pytest windows-latest / py3.12
  • GitHub Check: pytest ubuntu-latest / py3.11
  • GitHub Check: pytest (py3.12)
  • GitHub Check: pytest macos-latest / py3.12
  • GitHub Check: pytest macos-latest / py3.11
🧰 Additional context used
📓 Path-based instructions (1)
Gradata/tests/**/*.py

📄 CodeRabbit inference engine (Gradata/AGENTS.md)

Gradata/tests/**/*.py: Set BRAIN_DIR environment variable via tmp_path in conftest.py for test isolation — ensure _paths.py module cache refreshes when calling Brain.init() directly inside tests
Add unit tests in tests/test_*.py for every CI push without LLM calls (deterministic); mark integration tests with @pytest.mark.integration and skip them by default (they hit real LLM APIs)

Files:

  • Gradata/tests/test_offline_quickstart_smoke.py
🔇 Additional comments (7)
Gradata/docs/getting-started/quickstart.md (1)

5-23: LGTM!

Gradata/examples/offline_quickstart_smoke.py (5)

1-28: LGTM!


31-54: LGTM!


57-62: LGTM!


65-125: LGTM!


128-149: LGTM!

Gradata/tests/test_offline_quickstart_smoke.py (1)

10-32: LGTM!


📝 Walkthrough
  • Adds offline smoke test documentation to quickstart guide, enabling users to test core functionality without cloud credentials or external platform integrations
  • Introduces examples/offline_quickstart_smoke.py with main() and run_smoke() public functions for standalone credential-free SDK/CLI validation
  • Includes helper functions _offline_env(), _run_cli_init(), and _assert_event_count() for offline environment setup and verification
  • Adds pytest test (tests/test_offline_quickstart_smoke.py) validating the smoke script runs successfully without credentials in an isolated environment
  • Tests confirm CLI initialization, SDK operations (output, correction, search, health, manifest generation), and SQLite brain operations work offline
  • No breaking changes or security fixes identified

Walkthrough

The PR adds an offline quickstart verification path with documentation, a Python example script demonstrating credential-free brain initialization and SDK operations, and a pytest test that validates the example runs successfully in isolation without cloud dependencies.

Changes

Offline Quickstart Smoke Test

Layer / File(s) Summary
Offline quickstart documentation
docs/getting-started/quickstart.md
Introduces an offline smoke-test section with commands to clone the repository and run the example script from source, describing how the script initializes a local brain, exercises SDK operations, generates artifacts, and clears cloud credentials.
Offline smoke example script implementation
examples/offline_quickstart_smoke.py
Complete example script that sets up an isolated environment (disables telemetry, removes API credentials, sets PYTHONPATH), provides helpers to run CLI init and validate SQLite event counts, implements core smoke test that exercises SDK (log, correct, apply rules, search, health check), validates manifest domain and required artifacts, checks type safety and schema fields, prints JSON summary, and supports --keep flag for directory retention or auto-cleanup.
Offline smoke script validation test
tests/test_offline_quickstart_smoke.py
Pytest test executes the example script via subprocess with credential-related environment variables removed and telemetry disabled, runs with temporary HOME directory, parses JSON stdout, and asserts success status, CLI domain, event counts, and SDK version field presence.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

docs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test: add offline quickstart smoke path' clearly summarizes the main change—adding a smoke test for the offline quickstart flow.
Description check ✅ Passed The description is directly related to the changeset, detailing the addition of the offline smoke test, documentation updates, and comprehensive test results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 gra-1783-offline-quickstart

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):
┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m
[00.18][ERROR]: Error: exception Glob.Lexer.Syntax_error("malformed glob pattern: missing ']'")
Raised at Glob__Lexer.syntax_error in file "libs/glob/Lexer.mll", line 8, characters 2-26
Called from Glob__Lexer.__ocaml_lex_token_rec in file "libs/glob/Lexer.mll", line 29, characters 26-53
Cal


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

@coderabbitai coderabbitai Bot added the docs label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant