Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a9bd021
move-2-fastapi
galshubeli Aug 21, 2025
6254299
update-dep
galshubeli Aug 21, 2025
e2185d1
red-dep
galshubeli Aug 21, 2025
9fdb9cc
fix-github-auth
galshubeli Aug 21, 2025
ca15399
PR should go to staging
gkorland Aug 21, 2025
5d83637
Merge pull request #92 from FalkorDB/depbot
gkorland Aug 21, 2025
2d1e095
update deps
gkorland Aug 21, 2025
2a6547c
Merge branch 'staging' into depbot
gkorland Aug 21, 2025
689ece0
Merge pull request #93 from FalkorDB/depbot
gkorland Aug 21, 2025
f83e8cf
update-ver-ign
galshubeli Aug 21, 2025
200a418
fix-inst
galshubeli Aug 21, 2025
9cb79e7
fix demo
gkorland Aug 21, 2025
ead7353
Merge pull request #94 from FalkorDB/fix-demo
gkorland Aug 21, 2025
9b2be20
Merge branch 'main' into staging
gkorland Aug 21, 2025
88220c6
update-mysql
galshubeli Aug 21, 2025
2fae72c
rm-vecelignore
galshubeli Aug 21, 2025
01181f9
fix landing page
gkorland Aug 21, 2025
975a5dc
Merge pull request #96 from FalkorDB/landing-fix
gkorland Aug 21, 2025
4a7449a
Merge branch 'staging' into fastapi
gkorland Aug 21, 2025
e99a8ba
Merge branch 'staging' into fastapi
gkorland Aug 21, 2025
d8abc69
refactor imports
gkorland Aug 21, 2025
1f04885
Merge pull request #97 from FalkorDB/fastapi
gkorland Aug 21, 2025
4e7e08a
fix e2e test to work with flask
gkorland Aug 21, 2025
eeea600
Merge pull request #99 from FalkorDB/fix-tests
gkorland Aug 21, 2025
fa56d03
fix testsd
gkorland Aug 21, 2025
39df81a
Merge branch 'staging' into fix-tests
gkorland Aug 21, 2025
e59adbf
Merge pull request #100 from FalkorDB/fix-tests
gkorland Aug 21, 2025
e41d8b8
update fastapi:
gkorland Aug 21, 2025
ddb031e
Merge branch 'staging' into fix-tests
gkorland Aug 21, 2025
cc71bd9
Merge pull request #101 from FalkorDB/fix-tests
gkorland Aug 21, 2025
8d575df
fix tests
gkorland Aug 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ This file provides essential information for coding agents working with the Quer

## Repository Overview

QueryWeaver is an open-source Text2SQL tool that transforms natural language into SQL using graph-powered schema understanding. Built with Python/Flask and FalkorDB (graph database), it provides a web interface for natural language database queries with OAuth authentication.
QueryWeaver is an open-source Text2SQL tool that transforms natural language into SQL using graph-powered schema understanding. Built with Python/FastAPI and FalkorDB (graph database), it provides a web interface for natural language database queries with OAuth authentication.

**Key Technologies:**
- **Backend**: Python 3.12+, Flask 3.1+, FalkorDB (Redis-based graph database)
- **Backend**: Python 3.12+, FastAPI 0.115.0+, FalkorDB (Redis-based graph database)
- **AI/ML**: LiteLLM with Azure OpenAI/OpenAI integration for text-to-SQL generation
- **Testing**: pytest for unit tests, Playwright for E2E testing
- **Dependencies**: pipenv for package management
- **Authentication**: Flask-Dance with Google/GitHub OAuth
- **Authentication**: authlib with Google/GitHub OAuth
- **Deployment**: Docker support, Vercel configuration

**Repository Size**: ~50 Python files, medium complexity web application with comprehensive test suite.
Expand Down Expand Up @@ -81,11 +81,11 @@ make lint
```bash
# Development server with debug mode
make run-dev
# OR manually: pipenv run flask --app api.index run --debug
# OR manually: pipenv run uvicorn api.index:app --host "localhost" --port "5000" --reload

# Production mode
make run-prod
# OR manually: pipenv run flask --app api.index run
# OR manually: pipenv run uvicorn api.index:app --host "localhost" --port "5000"
```

Important: If you're preparing a production deployment or have changed frontend code, run `make build-prod` (or `make build-dev` for a development build) first to produce the static bundle used by the app.
Expand Down Expand Up @@ -125,7 +125,7 @@ make clean
**CRITICAL**: Create `.env` file from `.env.example` and configure these essential variables:

```bash
# REQUIRED for Flask to start
# REQUIRED for FastAPI to start
FLASK_SECRET_KEY=your_super_secret_key_here
FLASK_DEBUG=False

Expand Down Expand Up @@ -188,23 +188,23 @@ pipenv run pytest tests/ -k "not e2e"
```

### 5. Port Conflicts
**Error**: Flask app fails to start on port 5000
**Error**: FastAPI app fails to start on port 5000
**Solution**: Check if port is in use, kill conflicting processes or change port

## Project Architecture & Layout

### Core Application Structure
```
api/ # Main application package
├── index.py # Flask application entry point
├── index.py # FastAPI application entry point
├── app_factory.py # Application factory pattern
├── config.py # AI model configuration and prompts
├── agents/ # AI agents for query processing
│ ├── analysis_agent.py # Query analysis
│ ├── relevancy_agent.py # Schema relevance detection
│ └── follow_up_agent.py # Follow-up question generation
├── auth/ # Authentication modules
├── routes/ # Flask route handlers
├── routes/ # FastAPI route handlers
│ ├── auth.py # Authentication routes
│ ├── graphs.py # Graph/database routes
│ └── database.py # Database management routes
Expand Down Expand Up @@ -234,7 +234,7 @@ tests/
- `vercel.json`: Deployment configuration

### Key Dependencies
- **Flask ecosystem**: Flask, Flask-Dance (OAuth)
- **FastAPI ecosystem**: FastAPI, Authlib (OAuth)
- **Database**: falkordb, psycopg2-binary (PostgreSQL support)
- **AI/ML**: litellm (LLM abstraction), boto3 (AWS)
- **Development**: pytest, pylint, playwright
Expand Down Expand Up @@ -290,7 +290,7 @@ Before submitting any changes, run these validation steps:
## Key Files to Understand

### Application Entry Points
- `api/index.py`: Main Flask app entry point
- `api/index.py`: Main FastAPI app entry point
- `api/app_factory.py`: Application factory with OAuth setup (lines 1-50 contain core configuration)

### Configuration & Prompts
Expand All @@ -300,7 +300,7 @@ Before submitting any changes, run these validation steps:
### Core Logic
- `api/agents/`: Contains the AI agents that process natural language queries
- `api/loaders/`: Database schema loading and graph construction
- `api/routes/`: Flask routes for web interface and API
- `api/routes/`: FastAPI routes for web interface and API

### Testing Infrastructure
- `tests/conftest.py`: Pytest fixtures and test configuration
Expand Down
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
target-branch: "staging"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/app"
target-branch: "staging"
schedule:
Comment on lines +10 to 16
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Targeting staging is sensible; verify branch protections and automations

Directing Dependabot PRs to staging is aligned with your flow. Ensure:

  • CI required checks are configured for staging.
  • Any auto-merge rules or Renovate-equivalent workflows are updated to act on staging.
  • Backports/merges from staging to main are scheduled to avoid security updates stalling on main.

Quick checks to confirm:


🏁 Script executed:

#!/bin/bash
# Ensure branch protection and CI for staging
gh api repos/:owner/:repo/branches/staging/protection || echo "No branch protection on staging"
rg -nP -C2 'on:\s*\n\s*push:.*branches:.*\[[^\]]*staging' -g '.github/workflows/*.yml' || echo "No workflows triggering on staging push"
rg -nP -C2 'on:\s*pull_request:.*branches:.*\[[^\]]*staging' -g '.github/workflows/*.yml' || echo "No PR workflows for staging"

Length of output: 982


🏁 Script executed:

#!/bin/bash
set -e

echo "Listing workflow directory contents:"
find .github/workflows -maxdepth 1 -type f

echo -e "\nFinding all YAML workflow files:"
find .github/workflows -type f \( -iname '*.yml' -o -iname '*.yaml' \)

echo -e "\nSearching for ‘staging’ references in workflow files:"
rg -n 'staging' .github/workflows || echo "No references to 'staging' found in workflows"

Length of output: 954


CI and Branch Protection for staging Are Missing – Action Required

Our scan shows:

  • The GitHub API query for branch protection on staging returned a 403, indicating it’s either unprotected or inaccessible by your integration.
  • A ripgrep search across all workflows in .github/workflows/ found no references to staging, so no CI runs or PR checks are configured for that branch.

Please address the following before merging Dependabot PRs into staging:

• Configure branch protection for staging (at minimum, require status checks).
• Update your workflows in .github/workflows/ to include both push and pull_request triggers on staging:

  • Add under on.push.branches: and on.pull_request.branches: the entry "staging".
    • Review any auto-merge or Renovate/Dependabot automations to ensure they target staging.
    • Put in place a clear process or scheduled job to backport security updates from staging into main so hotfixes don’t stall.

Once these are in place, your weekly Dependabot PRs to staging will be properly verified and merged—and any fixes will flow safely to main.

🤖 Prompt for AI Agents
.github/dependabot.yml lines 10-16: branch protection and CI for the staging
branch are missing; add/configure branch protection for "staging" (require
status checks and PR reviews) in the repo settings or via repo protection
config, update all workflows in .github/workflows/ to include "staging" under
both on.push.branches and on.pull_request.branches so CI runs for pushes and PRs
to staging, review Dependabot/auto-merge/Renovate settings to ensure their
target-branch is "staging" (not bypassing protections), and add a
documented/backport process or scheduled job to propagate security fixes from
staging into main.

interval: "weekly"
14 changes: 9 additions & 5 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ jobs:
python -m pip install --upgrade pip
pip install pipenv

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: |
pipenv sync --dev
make install

- name: Install Playwright browsers
- name: Setup development environment
run: |
pipenv run playwright install chromium
pipenv run playwright install-deps
make setup-dev

- name: Create test environment file
run: |
Expand All @@ -63,7 +67,7 @@ jobs:

- name: Run E2E tests
run: |
pipenv run pytest tests/e2e/ --browser chromium --video=on --screenshot=on
make test-e2e
env:
CI: true

Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ build-dev:
build-prod:
npm --prefix ./app run build

test: build-dev ## Run all tests
test-unit test-e2e
test: build-dev test-unit test-e2e ## Run all tests



test-unit: ## Run unit tests only
pipenv run python -m pytest tests/ -k "not e2e" --verbose


test-e2e: build-dev ## Run E2E tests headless
pipenv run python -m pytest tests/e2e/ --browser chromium
pipenv run python -m pytest tests/e2e/ --browser chromium --video=on --screenshot=on


test-e2e-headed: build-dev ## Run E2E tests with browser visible
Expand Down Expand Up @@ -63,11 +63,10 @@ clean: ## Clean up test artifacts
find . -name "*.pyo" -delete

run-dev: build-dev ## Run development server
pipenv run python -m flask --app api.index run --debug
pipenv run uvicorn api.index:app --host 127.0.0.1 --port 5000 --reload

run-prod: build-prod ## Run production server
npm --prefix ./app run build
pipenv run python -m flask --app api.index run
pipenv run uvicorn api.index:app --host 127.0.0.1 --port 5000

docker-falkordb: ## Start FalkorDB in Docker for testing
docker run -d --name falkordb-test -p 6379:6379 falkordb/falkordb:latest
Expand Down
16 changes: 9 additions & 7 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ verify_ssl = true
name = "pypi"

[packages]
litellm = {extras = ["bedrock"], version = "~=1.74.14"}
fastapi = "~=0.116.1"
uvicorn = "~=0.32.0"
litellm = "~=1.74.14"
falkordb = "~=1.2.0"
flask = "~=3.1.0"
psycopg2-binary = "~=2.9.9"
pymysql = "~=1.1.0"
authlib = "~=1.4.0"
itsdangerous = "~=2.2.0"
jsonschema = "~=4.25.0"
tqdm = "~=4.67.1"
boto3 = "~=1.40.11"
psycopg2-binary = "~=2.9.9"
flask-dance = "~=7.1.0"
async-timeout = "~=4.0.3"
mysql-connector-python = "~=9.4.0"
python-multipart = "~=0.0.10"
jinja2 = "~=3.1.4"

[dev-packages]
pytest = "~=8.4.1"
Expand Down
Loading
Loading