Skip to content

Fix Python syntax check silently skipping all nested packages - #1752

Open
Madhavan N (Madhan0zx) wants to merge 1 commit into
microsoft:mainfrom
Madhan0zx:fix/python-syntax-check-recursive-glob
Open

Madhavan N (Madhan0zx) wants to merge 1 commit into
microsoft:mainfrom
Madhan0zx:fix/python-syntax-check-recursive-glob

Conversation

@Madhan0zx

Copy link
Copy Markdown

Summary

The Python Syntax Check workflow compiles files using a single-level shell glob, so it only ever checked the .py files sitting directly in application/single_app/ and silently skipped every nested package.

Measured on the current tree:

Scope Files
application/single_app/*.py (what the workflow compiled) 225
application/single_app/**/*.py (all Python files) 269
semantic_kernel_plugins/ (never checked) 44

The workflow's path filter on line 9 (application/single_app/**.py) correctly triggers on nested files, but the step body then compiled nothing. A PR touching only semantic_kernel_plugins/ would report:

✅ All Python files compiled successfully!

without compiling a single file. That package holds every action plugin (mcp_plugin.py, sql_query_plugin.py, openapi_plugin.py, databricks_plugin.py, yamcs_plugin.py, …), which are surfaced to users in docs/reference/actions/index.md.

Changes

  • .github/workflows/python-syntax-check.yml — replace the for file in *.py glob with a recursive find that walks the whole tree and excludes __pycache__. Coverage goes from 225 to all 269 Python files.
  • functional_tests/test_python_syntax_check_workflow_scope.py — new regression test that guards the discovery logic.

The loop already relied on bash arrays (failed_files=(), ${#failed_files[@]}) and process substitution, so find | sort -z is the same class of construct already in use — no new shell dependencies. Ordering is preserved via sort -z so logs stay readable.

Verification

The exact workflow body was executed against the repository:

  • Clean tree: all 269 files compile, exit 0.

  • Deliberately broken nested file (semantic_kernel_plugins/_tmp_broken_check.py containing def broken(:):

    ❌ 1 file(s) failed compilation:
      - ./semantic_kernel_plugins/_tmp_broken_check.py
    

    The old workflow would have passed this silently.

The new test reports 3/3 passing, and drops to 2/3 when run against the pre-fix workflow — confirming it actually guards the regression:

$ python functional_tests/test_python_syntax_check_workflow_scope.py
✅ Workflow discovers Python files recursively
✅ Nested packages contribute 44 file(s) that the old glob skipped
✅ Workflow find command discovers all 269 Python file(s)
📊 Results: 3/3 tests passed

The test follows the existing functional test conventions in functional_tests/ (version header, per-test functions, emoji status output, non-zero exit on failure). Its bash-dependent check degrades to a skip when no bash is available rather than failing spuriously.

Notes for reviewers

  • The workflow file has zero commit history since 2026-07, so this should not conflict with anything in flight.
  • Fix is confined to CI config; no application code, settings, or API behavior changes.
  • Per the repo's conventions this would normally come with a config.py version bump and a release notes entry. I deliberately left both out to keep the diff to the CI fix plus its test — happy to add them if maintainers prefer.

@Madhan0zx

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

The python-syntax-check workflow compiled application/single_app/*.py with a
single-level glob, so it only checked files directly in that directory. Every
nested package was silently skipped - most notably all 44 files under
semantic_kernel_plugins/, which hold the action plugins. A PR touching only
those files would report "All Python files compiled successfully!" without
compiling anything.

Switch the loop to a recursive find, excluding __pycache__, so all 269 Python
files are checked.

Adds functional_tests/test_python_syntax_check_workflow_scope.py to guard the
discovery logic and confirm nested files are covered.
@Madhan0zx
Madhavan N (Madhan0zx) force-pushed the fix/python-syntax-check-recursive-glob branch from 6f7ada2 to 7e9a5ac Compare October 13, 2026 16:08

This branch has not been deployed

No deployments
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.

1 participant