Skip to content

resolve Linux path casing and invalid lint targets in python-precommit.yml #160

Description

@codeCraft-Ritik
           AGENTQL REPOSITORY ANALYSIS & BUG REPORT REPORT

================================================================================
Repository: https://github.com/tinyfish-io/agentql.git
Total Files Audited: 105+ (Python, JavaScript, Google Colab, GitHub Workflows, Templates)


  1. TOP 5 IDENTIFIED BUGS SUMMARY

  1. [HIGH] CI/CD Failure in .github/workflows/python-precommit.yml

    • Issue: Case-sensitive path mismatch (examples/Python vs examples/python), non-existent Pylint targets (application_examples examples), and invalid working-directory keyword on action step.
    • Impact: Python CI checks never trigger on PRs on Linux runners and fail when run manually.
  2. [HIGH] Colab Crash in examples/python/run_script_online_in_google_colab/main.ipynb

    • Issue: Typo import from google.colab import user_data (with underscore) followed by userdata.get(...) without underscore, plus missing await on browser.new_page().
    • Impact: Fatal ImportError and NameError crash on Cell 6 for all Google Colab users.
  3. [MEDIUM] Runtime AttributeError in .templates/python/template_async.py

    • Issue: Query defines search_btn, but code executes await response.search_button.click().
    • Impact: Any new project started with this async template crashes on the first run.
  4. [MEDIUM] Broken Pagination & Infinite Loop in examples/js/collect-paginated-ecommerce-data/main.js & examples/python/collect_paginated_ecommerce_listing_data/main.py

    • Issue: In JS, paginationInfo is an Array, so paginationInfo.hasNextPage is undefined, causing infinite scraping of page 2. In Python, missing break when has_next_page is False.
    • Impact: Wastes API credits and fills datasets with duplicate items.
  5. [MEDIUM] ESM/CommonJS Mismatches in examples/js/perform-sentiment-analysis/main.js & examples/js/use-remote-browser/main.js

    • Issue: CommonJS require('openai/index.mjs') throws ERR_REQUIRE_ESM, and use-remote-browser uses ES module syntax in a CommonJS package.
    • Impact: Scripts fail to run directly under standard Node.js runtime.

================================================================================
2. COMPLETE GITHUB ISSUE & PR SUBMISSION TEMPLATE (BUG 1)


A. GITHUB ISSUE TITLE

fix(ci): resolve Linux path casing and invalid lint targets in python-precommit.yml


B. GITHUB ISSUE BODY

🐛 Bug Description

The Python CI workflow in .github/workflows/python-precommit.yml currently fails or silently skips checks on pull requests due to three issues:

  1. Linux Path Casing Mismatch (examples/Python vs examples/python):
    The workflow defines path filters and working directories as examples/Python (with a capital P). Because GitHub Actions runs on ubuntu-latest (case-sensitive Linux ext4 filesystem) and the actual repository folder is examples/python, the workflow never triggers on PR changes and fails with Directory not found if executed.

  2. Non-Existent Pylint Targets:
    Line 43 runs pylint --disable=R,C application_examples examples. Neither application_examples nor examples exists in examples/python, causing Pylint to immediately crash with exit code 2 (Cannot find 'application_examples').

  3. Misconfigured Step Properties:
    working-directory is placed under uses: isort/isort-action@master, which is invalid syntax for action steps. Running lint and format checks via poetry run ensures the correct virtual environment is used.


🔍 Steps to Reproduce

  1. Push a commit modifying any file in examples/python/.
  2. Notice that the GitHub Actions path trigger examples/Python/** fails to match on case-sensitive Linux runners.
  3. Running pylint application_examples examples locally inside examples/python fails immediately:
    pylint: error: Cannot find 'application_examples'

🛠️ Proposed Solution / Code Diff

--- a/.github/workflows/python-precommit.yml
+++ b/.github/workflows/python-precommit.yml
@@ -4,7 +4,7 @@ on:
pull_request:
types: [opened, synchronize, reopened]
paths:

  •  - "examples/Python/**"
    
  •  - "examples/python/**"
    

jobs:
python-pre-commit:
@@ -34,23 +34,22 @@ jobs:
# ----- install dependencies -----
#----------------------------------------------
- name: Install dependencies

  •    working-directory: ./examples/Python
    
  •    working-directory: ./examples/python
       run: |
         poetry install --no-interaction --no-root --with dev
    
     - name: Lint check
    
  •    working-directory: ./examples/Python
    
  •    run: pylint --disable=R,C application_examples examples
    
  •    working-directory: ./examples/python
    
  •    run: poetry run pylint --disable=R,C $(git ls-files '*.py')
    
     - name: Code style check
    
  •    working-directory: ./examples/Python
    
  •    run: black . --check
    
  •    working-directory: ./examples/python
       run: poetry run black . --check
    
     - name: Imports sort check
    
  •    working-directory: ./examples/Python
    
  •    uses: isort/isort-action@master
    
  •    working-directory: ./examples/python
    
  •    run: poetry run isort --check-only .
    
     - name: Static check
    
  •    working-directory: ./examples/Python
    
  •    working-directory: ./examples/python
       uses: jakebailey/pyright-action@v2
    

📄 Full Fixed Workflow File (.github/workflows/python-precommit.yml):

name: Python Pre-commit checks

on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "examples/python/**"

jobs:
python-pre-commit:
name: Pre-commit checks
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

  - name: Install Python
    uses: actions/setup-python@v4
    with:
      python-version: "3.11"

  #----------------------------------------------
  #  -----  install & configure poetry  -----
  #----------------------------------------------
  - name: Install Poetry
    uses: snok/install-poetry@v1
    with:
      version: 1.8.3
      virtualenvs-create: false
      virtualenvs-in-project: true
      installer-parallel: true

  #----------------------------------------------
  #  ----- install dependencies -----
  #----------------------------------------------
  - name: Install dependencies
    working-directory: ./examples/python
    run: |
      poetry install --no-interaction --no-root --with dev

  - name: Lint check
    working-directory: ./examples/python
    run: poetry run pylint --disable=R,C $(git ls-files '*.py')

  - name: Code style check
    working-directory: ./examples/python
    run: poetry run black . --check

  - name: Imports sort check
    working-directory: ./examples/python
    run: poetry run isort --check-only .

  - name: Static check
    working-directory: ./examples/python
    uses: jakebailey/pyright-action@v2
    continue-on-error: true
    with:
      pylance-version: latest-release

C. GITHUB PULL REQUEST (PR) TITLE

fix(ci): fix python-precommit path casing and lint targets (#issue_number)


D. GITHUB PULL REQUEST (PR) DESCRIPTION

Summary of Changes

  • Fixed Path Casing: Changed examples/Python to examples/python so that GitHub Actions triggers and executes properly on case-sensitive Linux (ubuntu-latest) runners.
  • Fixed Pylint Target Paths: Replaced non-existent directory arguments (application_examples examples) with $(git ls-files '*.py') executed through Poetry.
  • Unified Tooling with Poetry: Configured black, isort, and pylint to run consistently via poetry run using the dependencies defined in examples/python/pyproject.toml.
    ================================================================================

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions