-
Notifications
You must be signed in to change notification settings - Fork 0
Bugfix/backend fixes and test suite stabilization #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2b38a98
4425353
6da791c
56a6fd2
7676051
d5d1fb3
e9541ce
0ae2db5
31bf847
60186c4
5e75bf2
77a0b9a
2cd2f6b
c04d1bc
3b96d0a
535fe72
9199144
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| name: New model | ||
| version: 0.0.1 | ||
| schema: v1 | ||
| models: | ||
| - provider: anthropic | ||
| model: claude-3-7-sonnet-latest | ||
| apiKey: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| name: Claude 3.7 Sonnet | ||
| roles: | ||
| - chat | ||
| - edit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| name: New prompt | ||
| version: 0.0.1 | ||
| schema: v1 | ||
| prompts: | ||
| - name: New prompt | ||
| description: New prompt | ||
| prompt: Please write a thorough suite of unit tests for this code, making sure | ||
| to cover all relevant edge cases |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| name: New rule | ||
| version: 0.0.1 | ||
| schema: v1 | ||
| rules: | ||
| - Always give concise responses |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [flake8] | ||
| max-line-length = 100 | ||
| exclude = .git,__pycache__,build,dist | ||
| ignore = E203, W503 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # GitHub Actions Workflows | ||
|
|
||
| This directory contains GitHub Actions workflows for the EmailIntelligence project. | ||
|
|
||
| ## Workflows | ||
|
|
||
| ### 1. CI Workflow (`ci.yml`) | ||
| - **Trigger**: Push to `main` or `scientific` branches, and pull requests targeting these branches | ||
| - **Purpose**: Runs comprehensive tests, linting, and type checking for all code changes | ||
| - **Features**: | ||
| - Python 3.11 testing | ||
| - pytest with coverage reporting | ||
| - Code formatting checks (black, isort) | ||
| - Linting (flake8) | ||
| - Type checking (mypy) | ||
|
|
||
| ### 2. Dependabot Auto-Merge (`dependabot-auto-merge.yml`) | ||
| - **Trigger**: Pull requests opened, synchronized, or reopened | ||
| - **Purpose**: Automatically merges Dependabot pull requests when CI passes | ||
| - **Safety Features**: | ||
| - Only runs for PRs created by `dependabot[bot]` | ||
| - Uses GitHub's native PR status checks (no bash JSON parsing) | ||
| - Waits for CI workflow completion before proceeding | ||
| - Verifies PR is mergeable and not in draft state using GitHub context | ||
| - Comprehensive error handling for GitHub CLI operations | ||
| - Adds approval comment before enabling auto-merge | ||
| - Uses GitHub's auto-merge feature for safety | ||
|
|
||
| ## Security Considerations | ||
|
|
||
| The Dependabot auto-merge workflow includes several safety measures: | ||
| 1. **Identity Verification**: Only runs for PRs from `dependabot[bot]` | ||
| 2. **CI Dependency**: Waits for and requires CI workflow success | ||
| 3. **Native GitHub Checks**: Uses GitHub's built-in PR status instead of fragile parsing | ||
| 4. **Merge Readiness**: Verifies PR is in a mergeable state using GitHub context | ||
| 5. **Error Handling**: Comprehensive error handling with graceful degradation | ||
| 6. **Approval Process**: Automatically approves and adds explanatory comment | ||
|
|
||
| ## Setup Requirements | ||
|
|
||
| For the workflows to function properly, ensure: | ||
| 1. The repository has the necessary permissions for GitHub Actions | ||
| 2. The `GITHUB_TOKEN` has sufficient permissions for auto-merge operations | ||
| 3. Branch protection rules (if any) are compatible with auto-merge | ||
| 4. All dependencies are properly defined in `pyproject.toml` | ||
|
|
||
| ## Customization | ||
|
|
||
| To modify the auto-merge behavior: | ||
| - Edit the conditions in the workflow `if` statement (line 15) | ||
| - Adjust the CI check name in the `wait-for-check` action (line 23) | ||
| - Modify the merge strategy (currently uses `--merge`, could use `--squash` or `--rebase`) | ||
| - Change timeout values for CI wait (currently 600 seconds) | ||
|
|
||
| ## Architecture Improvements | ||
|
|
||
| The workflows have been optimized for: | ||
| - **Reliability**: Native GitHub API usage instead of bash JSON parsing | ||
| - **Simplicity**: Single-purpose jobs without unnecessary complexity | ||
| - **Error Handling**: Comprehensive error checking with graceful degradation | ||
| - **Performance**: Eliminates duplicate test runs by trusting CI results | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,43 @@ | ||||||||||||||||
| name: CI | ||||||||||||||||
|
|
||||||||||||||||
| on: | ||||||||||||||||
| push: | ||||||||||||||||
| branches: [ main, scientific ] | ||||||||||||||||
| pull_request: | ||||||||||||||||
| branches: [ main, scientific ] | ||||||||||||||||
|
|
||||||||||||||||
| jobs: | ||||||||||||||||
| test: | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
|
|
||||||||||||||||
| steps: | ||||||||||||||||
| - name: Checkout code | ||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||
|
|
||||||||||||||||
| - name: Set up Python | ||||||||||||||||
| uses: actions/setup-python@v4 | ||||||||||||||||
| with: | ||||||||||||||||
| python-version: '3.11' | ||||||||||||||||
|
Comment on lines
+18
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update GitHub Actions to use the latest version. The static analysis tool correctly identified that Apply this diff to update the action: - - name: Set up Python
- uses: actions/setup-python@v4
- with:
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.7)18-18: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) 🤖 Prompt for AI Agents |
||||||||||||||||
|
|
||||||||||||||||
| - name: Install uv | ||||||||||||||||
| uses: astral-sh/setup-uv@v3 | ||||||||||||||||
| with: | ||||||||||||||||
| version: "latest" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install dependencies | ||||||||||||||||
| run: | | ||||||||||||||||
| uv sync --dev | ||||||||||||||||
|
|
||||||||||||||||
| - name: Run tests | ||||||||||||||||
| run: | | ||||||||||||||||
| uv run pytest backend/ -v --tb=short --cov=backend --cov-report=xml | ||||||||||||||||
|
|
||||||||||||||||
| - name: Run linting | ||||||||||||||||
| run: | | ||||||||||||||||
| uv run flake8 backend/ | ||||||||||||||||
| uv run black --check backend/ | ||||||||||||||||
| uv run isort --check-only backend/ | ||||||||||||||||
|
|
||||||||||||||||
| - name: Type checking | ||||||||||||||||
| run: | | ||||||||||||||||
| uv run mypy backend/ --show-error-codes --no-strict-optional | ||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Dependabot Auto-Merge | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| checks: read | ||
|
|
||
| jobs: | ||
| auto-merge: | ||
| runs-on: ubuntu-latest | ||
| if: github.actor == 'dependabot[bot]' && github.event.pull_request.mergeable_state == 'clean' && !github.event.pull_request.draft | ||
|
|
||
|
Comment on lines
+15
to
+16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Workflow guard skips all Dependabot merges
- if: github.actor == 'dependabot[bot]' && github.event.pull_request.mergeable_state == 'clean' && !github.event.pull_request.draft
+ if: github.actor == 'dependabot[bot]' && !github.event.pull_request.draft🤖 Prompt for AI Agents |
||
| steps: | ||
| - name: Wait for CI checks to complete | ||
| uses: fountainhead/action-wait-for-check@v1.2.0 | ||
| id: wait-for-ci | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| checkName: test | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| timeoutSeconds: 600 | ||
| intervalSeconds: 10 | ||
|
|
||
| - name: Auto-merge Dependabot PR | ||
| if: steps.wait-for-ci.outputs.conclusion == 'success' | ||
| run: | | ||
| set -e | ||
| echo "CI checks passed. Auto-merging Dependabot PR #${{ github.event.pull_request.number }}" | ||
|
|
||
| # Approve the PR first | ||
| if ! gh pr review ${{ github.event.pull_request.number }} --approve --body "✅ CI checks passed! Auto-merging this Dependabot PR."; then | ||
| echo "Failed to approve PR. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Enable auto-merge | ||
| if ! gh pr merge --auto --merge ${{ github.event.pull_request.number }}; then | ||
| echo "Failed to enable auto-merge. Checking if already enabled..." | ||
| # Check if auto-merge is already enabled | ||
| if gh pr view ${{ github.event.pull_request.number }} --json autoMergeRequest --jq '.autoMergeRequest' | grep -q "null"; then | ||
| echo "Auto-merge failed and is not enabled. Manual intervention required." | ||
| exit 1 | ||
| else | ||
| echo "Auto-merge is already enabled." | ||
| fi | ||
| fi | ||
|
|
||
| echo "Auto-merge successfully enabled for PR #${{ github.event.pull_request.number }}" | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,45 +1,87 @@ | ||||||||
| jsons | ||||||||
| node_modules | ||||||||
| dist | ||||||||
| # General | ||||||||
| .DS_Store | ||||||||
| server/public | ||||||||
| Thumbs.db | ||||||||
| generated-icon.png | ||||||||
|
|
||||||||
| # Logs | ||||||||
| logs/ | ||||||||
| *.log | ||||||||
|
|
||||||||
| # Node / frontend | ||||||||
| node_modules/ | ||||||||
| dist/ | ||||||||
| vite.config.ts.* | ||||||||
| *.tar.gz | ||||||||
| .vscode/settings.json | ||||||||
| npm-debug.log* | ||||||||
| yarn-debug.log* | ||||||||
| yarn-error.log* | ||||||||
| pnpm-lock.yaml | ||||||||
| package-lock.json | ||||||||
| uv.lock | ||||||||
|
Comment on lines
+17
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not ignore package manager lockfiles. Filtering out Apply this diff to fix the issue: - pnpm-lock.yaml
- package-lock.json
- uv.lock📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||
|
|
||||||||
| # Python caches and artifacts | ||||||||
| __pycache__/ | ||||||||
| *.py[cod] | ||||||||
| *$py.class | ||||||||
| .pytest_cache/ | ||||||||
| .mypy_cache/ | ||||||||
| .cache/ | ||||||||
| htmlcov/ | ||||||||
|
|
||||||||
| # Python virtual environment created by launch.py | ||||||||
| # Virtual environments | ||||||||
| venv/ | ||||||||
| .venv/ | ||||||||
| env/ | ||||||||
| ENV/ | ||||||||
| .Python | ||||||||
|
|
||||||||
| # Environment & secret files | ||||||||
| .env | ||||||||
| .env.* | ||||||||
| *.env | ||||||||
| !.env.example | ||||||||
| jsons/* | ||||||||
| token.json | ||||||||
| credentials.json | ||||||||
| apikey.json | ||||||||
|
|
||||||||
| # Ignore configuration and local environment files | ||||||||
| *.local.config | ||||||||
| *.local.json | ||||||||
| *.local.yaml | ||||||||
| *.local.yml | ||||||||
| config.local.* | ||||||||
| # Build / packaging | ||||||||
| build/ | ||||||||
| dist/ | ||||||||
| *.egg-info/ | ||||||||
| pip-wheel-metadata/ | ||||||||
| *.egg | ||||||||
| *.whl | ||||||||
|
|
||||||||
| # Ignore hidden files and directories, except for specific exceptions | ||||||||
| .* | ||||||||
| !docs/.gitkeep | ||||||||
| # Databases | ||||||||
| *.sqlite3 | ||||||||
| *.db | ||||||||
| *.db-journal | ||||||||
|
|
||||||||
| # Ignore Python cache and diagnostic files | ||||||||
| __pycache__/ | ||||||||
| # Coverage | ||||||||
| .coverage | ||||||||
| .coverage.* | ||||||||
| coverage.xml | ||||||||
| coverage/ | ||||||||
| *.cover | ||||||||
|
|
||||||||
| # IDEs / editors | ||||||||
| .vscode/ | ||||||||
| .vscode/settings.json | ||||||||
| .idea/ | ||||||||
| *.iml | ||||||||
| *.sublime-project | ||||||||
| *.sublime-workspace | ||||||||
| .history | ||||||||
|
|
||||||||
| # Misc | ||||||||
| diagnosis_message.txt | ||||||||
| # Ignore config files generated by local runs | ||||||||
| *.local.config | ||||||||
| *.local.json | ||||||||
| *.local.yaml | ||||||||
| *.local.yml | ||||||||
| config.local.* | ||||||||
| config/*.local.* | ||||||||
|
|
||||||||
| # Ignore all dotfiles (hidden files) | ||||||||
| .* | ||||||||
| # Keep the docs placeholder | ||||||||
| !docs/.gitkeep | ||||||||
| __pycache__/ | ||||||||
| diagnosis_message.txt | ||||||||
|
|
||||||||
| # Ignore the jsons folder which may contain local data/secrets | ||||||||
| jsons/ | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Update line references to match actual CI workflow.
The customization section references line numbers that may not align with the actual CI workflow structure. The
wait-for-checkaction and specific line references should be verified against the actual workflow files.🏁 Script executed:
Length of output: 3038
Update README.md workflow customization section to use correct references
In
.github/workflows/README.md, replace the hard-coded line numbers for the job-levelifclause, thecheckNamein the wait-for-check step, merge strategy flag, and timeout settings so they align with the actual.github/workflows/dependabot-auto-merge.yml.🤖 Prompt for AI Agents