Skip to content

Assert the refusal log with getMessage so the compat tests pass - #70905

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:repair-the-refusal-log-assertions-on-main
Aug 1, 2026
Merged

Assert the refusal log with getMessage so the compat tests pass#70905
potiuk merged 1 commit into
apache:mainfrom
potiuk:repair-the-refusal-log-assertions-on-main

Conversation

@potiuk

@potiuk potiuk commented Aug 1, 2026

Copy link
Copy Markdown
Member

main is currently red on the provider compat jobs. The refusal-logging
assertions in the Amazon secrets tests read record.msg directly, and how a
record carries its payload depends on the Airflow version:

# main — structlog renders the format args before the stdlib record exists
LogRecord(msg="Connection id 'prod--x' contains '--'", args=())
    "prod--x" in r.msg          -> True

# the versions the compat jobs run against — plain stdlib logging
LogRecord(msg="%s id %r contains %r", args=("Connection", "prod--x", "--"))
    "prod--x" in r.msg          -> False        <- the failure
    "prod--x" in r.getMessage() -> True

So the assertions pass on main and fail under Compat 2.11.1:P3.10 and
Compat 3.0.6:P3.10:

assert 0 == 1
  where 0 = sum(refused_id in r.msg for r in refusals)

getMessage() renders in both shapes. The assertion still targets the refused
id rather than the wording, which was the point of moving off the rendered
sentence in the first place — that intent is unchanged, only the accessor.

This is a regression from #70878, where I moved these assertions off
getMessage() while addressing review feedback and verified only against main.
Compat runs on provider PRs, so it surfaced on the next provider PR rather than
on the one that introduced it.

Kept separate from #70899 (the Azure get_config follow-up) so the repair to
main can land on its own.

Test plan

  • providers/amazon/tests/unit/amazon/aws/secrets/ — 73 passed locally
  • Both record shapes checked directly: r.msg matches only the pre-rendered
    one, getMessage() matches both
  • Test-only change; no production code touched
  • ruff format clean
Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 5 (1M context)

Generated-by: Claude Opus 5 (1M context) following the guidelines at
https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions

The refusal-logging assertions in the Amazon secrets tests read record.msg
directly. How a record carries its payload depends on the Airflow version: on
main, structlog renders the format args into msg before the stdlib record exists,
so args is empty and msg holds the final text; on the versions the provider
compat tests run against, plain stdlib logging leaves msg as the format string
with the values in args.

Reading msg therefore passes on main and fails under Compat 2.11.1 and 3.0.6,
which is where these currently break:

  assert 0 == 1
  where 0 = sum(refused_id in r.msg for r in refusals)

getMessage() renders in both shapes. The assertion still targets the refused id
rather than the wording, so rephrasing the warning stays free.

Introduced in apache#70878, where the assertions were moved off getMessage and verified
only against main.
@potiuk
potiuk requested a review from o-nikolas as a code owner August 1, 2026 13:09
@potiuk potiuk added this to the Airflow 3.3.1 milestone Aug 1, 2026
@potiuk potiuk added the backport-to-v3-3-test Backport to v3-3-test label Aug 1, 2026

@henry3260 henry3260 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@potiuk
potiuk merged commit 8146228 into apache:main Aug 1, 2026
82 checks passed
@potiuk
potiuk deleted the repair-the-refusal-log-assertions-on-main branch August 1, 2026 14:39
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-3-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-3-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 8146228 v3-3-test

This should apply the commit to the v3-3-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.

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

Labels

area:providers area:secrets backport-to-v3-3-test Backport to v3-3-test provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants