Skip to content

Fix CI Ruff failures and install MkDocs dependencies in Vercel builds#48

Merged
quantumdynamics927-dotcom merged 3 commits intomainfrom
copilot/fix-ci-cd-pipeline-errors
Apr 4, 2026
Merged

Fix CI Ruff failures and install MkDocs dependencies in Vercel builds#48
quantumdynamics927-dotcom merged 3 commits intomainfrom
copilot/fix-ci-cd-pipeline-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 4, 2026

The CI test matrix was failing before tests ran because Ruff rejected newly added Neon database scripts. Separately, the Vercel deployment attempted to run mkdocs build without installing the documentation toolchain.

  • CI lint failures

    • Removed duplicate/unused imports and invalid no-op f-strings in the Neon integration script.
    • Applied Ruff-driven cleanup to the migration script and database module so the Python 3.10–3.13 matrix can progress past linting.
  • Packaging / deploy config

    • Added a dedicated docs optional dependency group in pyproject.toml for the MkDocs toolchain.
    • Updated vercel.json to install .[web,database,docs] so the deploy environment includes the docs builder it invokes.
  • Targeted cleanup

    • Kept the change surface narrow to the files involved in the failure path: Neon integration helpers, database module typing/import cleanup, and Vercel install configuration.

Example of the deploy-side change:

{
  "installCommand": "python3 -m venv .vercel-venv && ./.vercel-venv/bin/python -m pip install --upgrade pip setuptools wheel && ./.vercel-venv/bin/python -m pip install -e .[web,database,docs]"
}

Copilot AI and others added 3 commits April 4, 2026 01:53
Agent-Logs-Url: https://github.com/quantumdynamics927-dotcom/QPyth/sessions/ed476ffc-1ea5-43ae-9624-0d3544d77b41

Co-authored-by: quantumdynamics927-dotcom <247722560+quantumdynamics927-dotcom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/quantumdynamics927-dotcom/QPyth/sessions/ed476ffc-1ea5-43ae-9624-0d3544d77b41

Co-authored-by: quantumdynamics927-dotcom <247722560+quantumdynamics927-dotcom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/quantumdynamics927-dotcom/QPyth/sessions/ed476ffc-1ea5-43ae-9624-0d3544d77b41

Co-authored-by: quantumdynamics927-dotcom <247722560+quantumdynamics927-dotcom@users.noreply.github.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
q-pyth Ready Ready Preview, Comment Apr 4, 2026 2:02am

@quantumdynamics927-dotcom quantumdynamics927-dotcom marked this pull request as ready for review April 4, 2026 02:02
Copilot AI review requested due to automatic review settings April 4, 2026 02:02
@quantumdynamics927-dotcom quantumdynamics927-dotcom merged commit 6bb4813 into main Apr 4, 2026
11 checks passed
@quantumdynamics927-dotcom quantumdynamics927-dotcom deleted the copilot/fix-ci-cd-pipeline-errors branch April 4, 2026 02:02
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
quantumpytho/modules/database.py 66.66% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR unblocks CI and Vercel deployments by addressing Ruff lint failures in the Neon database scripts and ensuring the MkDocs toolchain is installed in the Vercel build environment.

Changes:

  • Add a docs optional dependency group (MkDocs + theme/extensions) and include it in the all extra.
  • Update vercel.json to install .[web,database,docs] so mkdocs build can run during Vercel builds.
  • Apply Ruff-driven cleanup/formatting to Neon integration scripts and database-related modules.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vercel.json Installs the new docs extra in Vercel so MkDocs is available at build time.
pyproject.toml Introduces docs optional dependencies and adds them to the all extra.
quantumpytho/modules/database.py Typing/import cleanup and formatting changes related to Ruff.
migrate.py Ruff formatting cleanups (lists, trailing commas, whitespace).
server.py Minor formatting changes around optional DB wiring/messages.
test_neon_integration.py Removes unused imports/duplicate imports and fixes Ruff formatting issues.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 262 to 264
# Create a disabled instance
_db_instance = NeonDatabase.__new__(NeonDatabase)
_db_instance.config = DatabaseConfig()
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

get_database() returns a “disabled” _db_instance when psycopg2 isn’t available, but it still sets config = DatabaseConfig() (which may read a non-empty DATABASE_URL). That can make db.config.is_configured true even though the instance cannot execute queries (no pool), causing runtime errors in callers that only gate on is_configured.

Adjust the disabled-instance branch to ensure is_configured is false (e.g., override database_url to "" / use a dedicated disabled config) or raise ImportError from get_database() when PSYCOPG2_AVAILABLE is false so callers can reliably disable DB features.

Suggested change
# Create a disabled instance
_db_instance = NeonDatabase.__new__(NeonDatabase)
_db_instance.config = DatabaseConfig()
# Create a disabled instance with an explicitly disabled config so
# callers can reliably use `config.is_configured` to gate DB usage.
_db_instance = NeonDatabase.__new__(NeonDatabase)
_db_instance.config = DatabaseConfig(database_url="")

Copilot uses AI. Check for mistakes.
Comment thread server.py
Comment on lines 46 to 56
# Database integration (optional)
try:
from quantumpytho.modules.database import (
get_database,
init_schema,
log_api_request,
log_quantum_job,
save_vqe_result,
)

DATABASE_AVAILABLE = True
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

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

DATABASE_AVAILABLE is set based on whether quantumpytho.modules.database imports, but that module intentionally swallows ImportError for psycopg2 and still imports successfully. As a result, DATABASE_AVAILABLE can be True even when the database dependency isn’t installed, leading to repeated runtime failures in get_database()/log_api_request paths.

Consider importing and checking PSYCOPG2_AVAILABLE (or similar) to set DATABASE_AVAILABLE accurately, or make the database module raise ImportError when psycopg2 is missing so this guard behaves as intended.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants