Skip to content

handle SQLAlchemyError via app exception handler#6

Open
henry3260 wants to merge 190 commits intomainfrom
replace-to-fastapi-custom-exception
Open

handle SQLAlchemyError via app exception handler#6
henry3260 wants to merge 190 commits intomainfrom
replace-to-fastapi-custom-exception

Conversation

@henry3260
Copy link
Copy Markdown
Owner


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@henry3260
Copy link
Copy Markdown
Owner Author

@copilot Code review

Copy link
Copy Markdown

Copilot AI commented Feb 22, 2026

@henry3260 I've opened a new pull request, #8, to work on those changes. Once the pull request is ready, I'll request review from you.

@henry3260 henry3260 force-pushed the replace-to-fastapi-custom-exception branch 2 times, most recently from 4112682 to 1b7646e Compare February 22, 2026 13:23
@henry3260 henry3260 force-pushed the replace-to-fastapi-custom-exception branch from 1b7646e to 196c09f Compare February 22, 2026 14:46
eladkal and others added 23 commits March 9, 2026 10:23
…nd no job identifier is provided (apache#62393)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Co-authored-by: Sameer Mesiah <smesiah971@gmail.com>
Add _validate_grant_type and _SUPPORTED_GRANT_TYPES to centralize
OAuth grant_type validation. Update _get_conn_params and
_get_valid_oauth_token to delegate validation to the new method.

Added a unit test covering supported, unsupported, and missing
grant_type values.

Co-authored-by: Sameer Mesiah <smesiah971@gmail.com>
…2879)

* fix(providers/smtp): fix OAuth2 XOAUTH2 auth in SmtpHook

Three bugs fixed:
1. get_conn() used self._auth_type (constructor default 'basic') instead
   of self.auth_type property, ignoring auth_type set in connection extras.
2. After STARTTLS, ehlo() was not called, causing the server to reject
   subsequent AUTH commands (session state reset by STARTTLS).
3. aget_conn() (async path) had no OAuth2 support at all, only basic auth.

Fixes apache#62775

* fix: use auth_xoauth2() for aiosmtplib async client + ruff format

* ci: retry after cache miss

* fix: update test to use auth_xoauth2 matching actual async implementation

* fix: add auth_xoauth2 mock to async SMTP test fixtures for lowest-deps compat

* ci: retrigger CI (unrelated infra failures)

* ci: retrigger CI (ghcr.io timeout)

* retrigger CI
* Add icon support for theme customization

* Clean code

* Handle failures to load

* Adjust tests

* Custom logo for error pages

* Handle favicon
Adds a 30s timeout to JWKS request (from Authentik or Microsoft) to prevent indefinite hangs. This is a network call for auth metadata which should fail fast if the remote server is unresponsive.
…che#63110)

* fix: ensure Celery tasks are registered at worker startup

Fixes: apache#63043

* fix: add test for celery task registration on import

* remove temporary fix scripts

* chore: add TODO comment for execute_command removal when min Airflow >= 3

* fix: correct indentation of TODO comment in test
…ache#62985)

* Fix CloudwatchTaskHandler not deleting local logs after streaming

In Airflow 3, `CloudwatchTaskHandler` streams logs to CloudWatch in
real-time via structlog processors, so `upload()` was a no-op. However,
`delete_local_copy` was never honoured, causing local log files to
accumulate indefinitely on shared storage (e.g. EFS).

Changes:
- `CloudWatchRemoteLogIO.upload()` now deletes the local log directory
  when `delete_local_copy` is True.
- `CloudwatchTaskHandler.close()` calls `upload()` with the rendered
  log path stored during `set_context()`.
- Path traversal guard prevents deletion outside `base_log_folder`.

* chore: rename newsfragment to PR apache#62985

* Remove provider newsfragment (not used for providers)

* fix: align close() guard and tests with S3/GCS/HDFS convention

Use hasattr(self, "ti") guard in close() like S3/GCS/HDFS handlers.
Fix tests to be version-agnostic by asserting against handler's own
log_relative_path instead of hardcoded filename format.
Bumps [eslint-plugin-perfectionist](https://github.com/azat-io/eslint-plugin-perfectionist) from 4.15.1 to 5.6.0.
- [Release notes](https://github.com/azat-io/eslint-plugin-perfectionist/releases)
- [Changelog](https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/changelog.md)
- [Commits](azat-io/eslint-plugin-perfectionist@v4.15.1...v5.6.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-perfectionist
  dependency-version: 5.6.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…3155)

Bumps [@trivago/prettier-plugin-sort-imports](https://github.com/trivago/prettier-plugin-sort-imports) from 4.3.0 to 6.0.2.
- [Release notes](https://github.com/trivago/prettier-plugin-sort-imports/releases)
- [Changelog](https://github.com/trivago/prettier-plugin-sort-imports/blob/main/CHANGELOG.md)
- [Commits](trivago/prettier-plugin-sort-imports@v4.3.0...v6.0.2)

---
updated-dependencies:
- dependency-name: "@trivago/prettier-plugin-sort-imports"
  dependency-version: 6.0.2
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.3.28 to 19.2.14.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

---
updated-dependencies:
- dependency-name: "@types/react"
  dependency-version: 19.2.14
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…pache#63193)

* make hive cli zooKeeperNamespace and Ssl parameters configurable

* fix static checks

* Update providers/apache/hive/src/airflow/providers/apache/hive/hooks/hive.py

Co-authored-by: GPK <gopidesupavan@gmail.com>

* fix tests

---------

Co-authored-by: romsharon98 <rom.sharon98@gmail.com>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Co-authored-by: GPK <gopidesupavan@gmail.com>
…ely (apache#63104)

* Refactor S3Hook's local file synchronization logic to mach GCSHook. Update tests to cover nested directories and ensure proper logging of deleted files and directories.

* Update S3Hook logging level for deleted files and directories from info to debug to reduce log verbosity.
cetingokhan and others added 26 commits March 11, 2026 19:58
…1890)

* Add workers.celery.resources & workers.kubernetes.resources

* Add newsfragment
…andling (apache#63350)

Enhances the `breeze pr auto-triage` command with better draft PR support,
improved interactive UX, and smarter CI/workflow handling.

Draft PR handling:
- Include draft PRs in workflow approval phase
- Add --include-drafts option to include drafts in auto-triage
- Skip draft PRs with workflows still running
- Hide draft option for PRs that are already drafts
- Add isDraft field to GraphQL queries and PRData dataclass

Interactive UX improvements:
- Use single-keypress input for all prompts (no Enter required)
- Fall back to line-buffered input when no TTY is available
- Remap keys: [m]ark as ready, [r]erun checks, [o]pen in browser,
  [c]omment, [x] close
- Add confirmation prompt before every PR-modifying action
- Show only violations initially, render comment after action choice
- Allow selecting which violations to include in triage comments
- Default to 'mark as ready' for passing PRs
- Colorize author profile and show account age in green for established
  authors
- Continue with next batch automatically after processing

CI and workflow handling:
- Add rerun checks option for PRs with 1-2 failing checks
- Cancel and restart in-progress workflows when rerun-failed finds nothing
- Only suggest rerun checks when PR is at most 50 commits behind
- Skip CI failure flag when checks are running or names unavailable
- Skip CI failure for any PR with workflows currently running
- Try to approve workflows first, suggest draft on failure

Review intelligence:
- Detect stale CHANGES_REQUESTED reviews on accepted PRs and nudge
  follow-up
- Skip workflow approval PRs already commented on without follow-up
- Warn about .github/ and scripts/ changes when reviewing workflow
  approval

Reliability:
- Shut down LLM executor on KeyboardInterrupt for clean exit
- Fix KeyError in batch continuation for author_flagged_count
- Fix missing close_comment argument in draft action
- Skip confirmation prompt when re-running checks in auto-triage
…ist (apache#62344)

* cli: hide connection and variable values in list by default (apache#59844)

- connections list: show only conn_id and conn_type by default
- Add --show-values to display full connection details
- Add --hide-sensitive to mask password, get_uri, and extra when showing values
- variables list: add --show-values and --hide-sensitive for consistency
- Add tests for default hide, show-values, and show-values with hide-sensitive

Fixes apache#59844

Signed-off-by: André Ahlert <andre@aex.partners>

* feat: hide sensitive values by default in CLI connections/variables list

- Add --show-values and --hide-sensitive flags to connections list
- Add --show-values and --hide-sensitive flags to variables list
- Default behavior now shows only IDs/keys, hiding sensitive data
- Optimize variables query to avoid unnecessary decryption
- Implement smart URI credential masking
- Add comprehensive tests for edge cases and security scenarios
- Refactor mapper logic into dedicated classes for maintainability

Closes apache#59844

Signed-off-by: André Ahlert <andre@aex.partners>

* Fix import ordering and test assertions for CLI list commands

Move imports to top of file in connection_command.py and variable_command.py (were incorrectly placed after function/class definitions). Fix test assertions to call command function instead of relying on argparse for SystemExit.

Signed-off-by: André Ahlert <andre@aex.partners>

* Clean up code quality issues and add newsfragment

Signed-off-by: André Ahlert <andre@aex.partners>

---------

Signed-off-by: André Ahlert <andre@aex.partners>
…3312)

* Allow secrets backend kwargs to be set via per-key env vars

Adds support for AIRFLOW__SECRETS__BACKEND_KWARG__<KEY> environment variables
as an alternative to the single AIRFLOW__SECRETS__BACKEND_KWARGS JSON blob.

* Rename newsfragment to match PR number

* Mask per-key backend kwarg env vars in logs at startup

* ci: retrigger CI
Co-authored-by: Anton Nitochkin <nitochkin@google.com>
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Add coverage for connections_path="" to ensure connection IDs are not prefixed.
Extend mount_point=None test to cover non-prefixed keys returning None and avoiding Vault calls.

Co-authored-by: Sameer Mesiah <smesiah971@gmail.com>
Introduce AzureSynapsePipelineAsyncHook as an asynchronous counterpart
to the existing AzureSynapsePipelineHook.

The async hook mirrors the synchronous hook’s credential resolution and
client creation logic while using AsyncArtifactsClient for non-blocking
pipeline run retrieval, status checks, and cancellation operations. It
supports both client-secret and default credential authentication using
their asynchronous Azure identity credential equivalents.

Add unit tests covering async client creation, credential selection,
pipeline run status retrieval, client caching, connection refresh, and
proper cleanup via close() and the async context manager.

Co-authored-by: Sameer Mesiah <smesiah971@gmail.com>
apache#62556)

* Fix ExternalTaskSensor to use timeout parameter in deferrable mode (apache#62516)

ExternalTaskSensor was incorrectly using execution_timeout instead of timeout when deferring in deferrable mode, causing inconsistent behavior across poke, reschedule, and deferrable modes.

Changes:

- Updated execute() to use timedelta(seconds=self.timeout) with fallback to execution_timeout

- Added comprehensive test coverage for timeout behavior in deferrable mode

- Ensures consistent timeout semantics across all sensor modes

* Simplify timeout logic and update tests

Remove incorrect fallback to execution_timeout. Timeout parameter always has a default value from config, so no fallback is needed or correct.

Update tests to validate correct behavior matching other sensors

* Remove empty SOLUTION.md file

* Fix ExternalTaskSensor timeout handling in deferrable mode

- Implement fallback to execution_timeout when timeout is not set (0 or None)
- Update tests to cover 3 distinct scenarios:
  1. timeout set, execution_timeout not set
  2. timeout not set (0), execution_timeout set
  3. timeout and execution_timeout both set (priority test)
- Fix whitespace issue flagged by ruff

* Retrigger CI
…nstead of underscores (apache#62926)

* fix(providers/google): sanitize Dataproc batch labels to use dashes instead of underscores

GCP labels only allow lowercase letters, numbers, and dashes.
`__update_batch_labels` was replacing dots/spaces with underscores,
causing InvalidArgument errors when DAG/task IDs contained underscores
(e.g. task groups with dots in their path).

Also fixes the validation regex to match GCP's actual label requirements
and corrects the dag_display_name validation check which was incorrectly
testing dag_id instead.

Closes: apache#59332

* fix: use valid dag_id in test (no spaces allowed)

* fix: apply ruff format
…p_kwargs in PythonVirtualenvOperator (apache#63270)

When render_template_as_native_obj=True, templates like {{ ti }} resolve to
live Airflow objects that can't be pickled. The resulting PicklingError from
structlog internals is confusing and doesn't point to the root cause.

Catch serialization failures in _write_args, identify which specific kwargs
failed, and raise a clear AirflowException naming the bad keys and suggesting
to use string attributes instead.

Closes: apache#61741
* Improve OpenAI provider metadata and documentation

* Remove duplicate llm tag from OpenAI provider metadata
…ws iam token retrieval (apache#61965)

* Add validation for missing host and cluster/workgroup identifier in aws iam token retrieval

* mypy fix

* Cleaned up the handling of cluster id to be more explicit
The FAB provider has a .pnpm-store directory inside www/ that autoapi
was accidentally indexing, producing bogus API docs pages.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 12, 2026 01:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions Bot added the Stale label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.