Skip to content

Add script to generate missing async methods for PGMQOperation#37

Merged
jason810496 merged 5 commits into
ci/add-ast-based-script-for-async-methodsfrom
copilot/sub-pr-36
Jan 5, 2026
Merged

Add script to generate missing async methods for PGMQOperation#37
jason810496 merged 5 commits into
ci/add-ast-based-script-for-async-methodsfrom
copilot/sub-pr-36

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 5, 2026

Description

Added compelete_missing_async_methods_for_operation.py script and supporting AST transformer module to automatically generate missing async methods for the PGMQOperation class, mirroring the existing queue functionality.

Changes

  • scripts/compelete_missing_async_methods_for_operation.py: Main script following the same pattern as the queue version

    • Analyzes PGMQOperation class for missing async methods
    • Generates async counterparts with proper transformations
    • Interactive prompting for applying changes with backup
  • scripts/scripts_utils/operation_ast.py: AST transformer for operation-specific transformations

    • Converts SessionAsyncSession in parameters
    • Wraps session.execute() and session.commit() with await
    • Transforms docstrings to indicate async behavior
    • Robust docstring parsing with length validation

Both files follow the PEP 723 inline script metadata format for dependency specification.

Status

  • In progress
  • Ready for review
  • Done

Checklist

  • Read the Contributing Guide
  • Passes tests
  • Linted ( we use pre-commit with ruff )
  • Updated documentation

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 5, 2026 11:56
…tion_ast helper

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
…nnecessary method

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on adding complete missing async methods Add script to generate missing async methods for PGMQOperation Jan 5, 2026
Copilot AI requested a review from jason810496 January 5, 2026 12:02
@jason810496 jason810496 marked this pull request as ready for review January 5, 2026 16:28
@jason810496 jason810496 merged commit 9697d5e into ci/add-ast-based-script-for-async-methods Jan 5, 2026
jason810496 added a commit that referenced this pull request Jan 6, 2026
* Initial plan

* Add compelete_missing_async_methods_for_operation.py script and operation_ast helper

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Fix path resolution bug in operation_ast.py

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Address code review feedback: improve docstring handling and remove unnecessary method

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Improve docstring handling robustness with better length checks

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
jason810496 added a commit that referenced this pull request Jan 6, 2026
* Add pre-commit hooks and scripts for async method checks in PGMQueue

Distinguish sync and async operations in PGMQueue

- Introduced a pre-commit hook to check for missing async methods in PGMQueue.
- Added scripts to identify and generate missing async methods.
- Created utility functions for AST manipulation and method transformation.
- Established configuration for project paths and console output.

* Refactor code transformation scripts from ast to libcst (#35)

* Initial plan

* Refactor AST-based code to use libcst for better code transformation

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Fix: only wrap call expressions in await, not literals

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Ask whether to apply change

* Apply missing async methods

* Correct files for check-sync-async-method-for-queue pre-commit

* Add check for operation as well

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com>

* Add script to generate missing async methods for PGMQOperation (#37)

* Initial plan

* Add compelete_missing_async_methods_for_operation.py script and operation_ast helper

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Fix path resolution bug in operation_ast.py

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Address code review feedback: improve docstring handling and remove unnecessary method

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Improve docstring handling robustness with better length checks

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Fix queue await error

* Add script to generate missing async tests for PGMQOperation using CST (#39)

* Add pre-commit hooks and scripts for async method checks in PGMQueue

Distinguish sync and async operations in PGMQueue

- Introduced a pre-commit hook to check for missing async methods in PGMQueue.
- Added scripts to identify and generate missing async methods.
- Created utility functions for AST manipulation and method transformation.
- Established configuration for project paths and console output.

* Refactor code transformation scripts from ast to libcst (#35)

* Initial plan

* Refactor AST-based code to use libcst for better code transformation

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Fix: only wrap call expressions in await, not literals

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Ask whether to apply change

* Apply missing async methods

* Correct files for check-sync-async-method-for-queue pre-commit

* Add check for operation as well

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com>

* Initial plan

* Add compelete_missing_test_for_operation.py script with CST-based approach

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Fix code review feedback: remove redundant code and use Tuple from typing

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Finalize test_operation

* Fix _check_pg_partman_ext naming

---------

Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Add script to generate missing async tests using CST transformations (#38)

* Add pre-commit hooks and scripts for async method checks in PGMQueue

Distinguish sync and async operations in PGMQueue

- Introduced a pre-commit hook to check for missing async methods in PGMQueue.
- Added scripts to identify and generate missing async methods.
- Created utility functions for AST manipulation and method transformation.
- Established configuration for project paths and console output.

* Refactor code transformation scripts from ast to libcst (#35)

* Initial plan

* Refactor AST-based code to use libcst for better code transformation

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Fix: only wrap call expressions in await, not literals

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Ask whether to apply change

* Apply missing async methods

* Correct files for check-sync-async-method-for-queue pre-commit

* Add check for operation as well

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com>

* Initial plan

* Add complete_missing_test_for_queue.py script with CST-based approach

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Apply ruff formatting to test generation scripts

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Address code review feedback: fix path resolution, type hints, and documentation

Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Fix missing async replacment for compelete test queue

* Fix imports for async fixtures

---------

Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>

* Unifing script name for queue

* Add missing async test methods for queue, fix check_pg_partman_ext

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
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.

2 participants