Skip to content

Exclude py/cyclic-import from CodeQL scan#234

Merged
chris-colinsky merged 1 commit into
mainfrom
chore/codeql-exclude-cyclic-import
Jul 23, 2026
Merged

Exclude py/cyclic-import from CodeQL scan#234
chris-colinsky merged 1 commit into
mainfrom
chore/codeql-exclude-cyclic-import

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

Adds py/cyclic-import to the CodeQL config's query-filters, clearing three note-level code-scanning alerts on main:

  • src/openarmature/graph/events.py:21
  • src/openarmature/graph/observer.py:37
  • src/openarmature/observability/correlation.py:39

These are the same false-positive class the config already suppresses for the broader rule's sibling, py/unsafe-cyclic-import: CodeQL flags the textual import shape without honoring if TYPE_CHECKING: gates. Every observability -> graph back-edge (correlation, tool_call, metadata) lives inside a TYPE_CHECKING block with from __future__ import annotations; the only runtime leg is graph.events importing the AttributeValue type alias from observability.metadata. The back-edges never execute, so import openarmature.graph.events resolves with no runtime cycle (verified locally).

Consistent with the existing exclusions, pyright's reportImportCycles remains the backstop for genuine runtime cycles, so dropping the CodeQL rule does not lose signal. No source or runtime change.

Config-only; the alerts clear on the next CodeQL analysis of main after merge.

The rule fires on TYPE_CHECKING-gated typed-module cycles between
graph and observability that do not exist at runtime (import of
graph.events resolves clean). It is the broader sibling of
py/unsafe-cyclic-import, already excluded here for the same
reason. Pyright's reportImportCycles remains the backstop for
genuine runtime cycles, so the rule adds only noise.
Copilot AI review requested due to automatic review settings July 23, 2026 19:54

Copilot AI left a comment

Copy link
Copy Markdown

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 updates the repository’s CodeQL configuration to suppress a known false-positive Python query (py/cyclic-import) in order to reduce noise from note-level “cyclic import” alerts that are already covered by pyright’s import-cycle checking.

Changes:

  • Add py/cyclic-import to .github/codeql/codeql-config.yml query-filters excludes.
  • Document the rationale and affected module boundary (graphobservability) alongside the existing py/unsafe-cyclic-import suppression.

@chris-colinsky
chris-colinsky merged commit dcee6b5 into main Jul 23, 2026
6 checks passed
@chris-colinsky
chris-colinsky deleted the chore/codeql-exclude-cyclic-import branch July 23, 2026 19:59
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