Skip to content

Strengthen Copilot review instructions to use imperative phrasing#62584

Merged
kaxil merged 1 commit intoapache:mainfrom
astronomer:strengthen-copilot-review-rules
Feb 27, 2026
Merged

Strengthen Copilot review instructions to use imperative phrasing#62584
kaxil merged 1 commit intoapache:mainfrom
astronomer:strengthen-copilot-review-rules

Conversation

@kaxil
Copy link
Member

@kaxil kaxil commented Feb 27, 2026

Copilot's review agent (claude-sonnet-4.5 -- this model can change) converts rules phrased as "Flag any X" into active search_dir calls against the changed files, but treats passive phrasing (e.g., "Imports at top of file") as informational context it may or may not act on.

This was confirmed by analyzing GitHub Actions logs across PRs #62528 and #62582 — rules like session.commit() and @lru_cache (already imperative) were actively searched, while the passively-phrased import rule was skipped despite reading the relevant code.

Changes: Rewrite all critical rules to use imperative "Flag any..." directives:

  • Imports inside function bodies
  • assert in non-test code
  • time.time() for durations
  • @lru_cache without maxsize
  • session.commit() in airflow-core
  • N+1 query patterns
  • unittest.TestCase subclasses
  • Unspec'd mocks
  • time.sleep / datetime.now() in tests

Complements #62442.

@boring-cyborg boring-cyborg bot added area:dev-tools backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch labels Feb 27, 2026
…hrasing

Copilot's review agent converts rules phrased as "Flag any X" into
active code searches but treats passive phrasing as informational
context. Rewrite all critical rules (imports, assert, time.time,
lru_cache, session.commit, N+1 queries, unittest, unspec'd mocks)
to use imperative directives so the agent reliably flags violations.
@kaxil kaxil force-pushed the strengthen-copilot-review-rules branch from 84678cb to 585fca8 Compare February 27, 2026 19:32
@kaxil kaxil requested a review from ferruzzi February 27, 2026 20:26
@kaxil kaxil merged commit a064538 into apache:main Feb 27, 2026
62 checks passed
@kaxil kaxil deleted the strengthen-copilot-review-rules branch February 27, 2026 20:38
@github-actions
Copy link

Backport failed to create: v3-1-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-1-test Commit Link

You can attempt to backport this manually by running:

cherry_picker a064538 v3-1-test

This should apply the commit to the v3-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

AkshayArali pushed a commit to AkshayArali/airflow_630 that referenced this pull request Feb 28, 2026
…hrasing (apache#62584)

Copilot's review agent converts rules phrased as "Flag any X" into
active code searches but treats passive phrasing as informational
context. Rewrite all critical rules (imports, assert, time.time,
lru_cache, session.commit, N+1 queries, unittest, unspec'd mocks)
to use imperative directives so the agent reliably flags violations.
dominikhei pushed a commit to dominikhei/airflow that referenced this pull request Mar 11, 2026
…hrasing (apache#62584)

Copilot's review agent converts rules phrased as "Flag any X" into
active code searches but treats passive phrasing as informational
context. Rewrite all critical rules (imports, assert, time.time,
lru_cache, session.commit, N+1 queries, unittest, unspec'd mocks)
to use imperative directives so the agent reliably flags violations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants