Skip to content

Fix partition key display and input handling#69702

Merged
bbovenzi merged 6 commits into
apache:mainfrom
astronomer:ui-partition-key-polish
Jul 16, 2026
Merged

Fix partition key display and input handling#69702
bbovenzi merged 6 commits into
apache:mainfrom
astronomer:ui-partition-key-polish

Conversation

@Lee-W

@Lee-W Lee-W commented Jul 10, 2026

Copy link
Copy Markdown
Member

Why

The partition key handling in the UI had a few rough edges:

  • A run or asset event with no partition key still rendered a dangling Partition key: label with nothing after it.
  • Typing a partition key and then clearing it sent an empty string to the trigger / materialize APIs, which rejected it with a 400.
  • The trigger form always exposed the partition key field, even for Dags that are not partitioned, where it does nothing.
  • The manual asset-event flow used a JsonEditor to enter the partition key, which is a plain string, not JSON.
  • A created run labelled its partition key Mapped Partition Key. At the run level the value is the concrete key the run runs for, not a mapper-transformed key, so the Mapped qualifier was misleading.

What

  • Add a shared toNullablePartitionKey util that normalizes undefined and empty string to null, and use it at every call site that sends partition_key (trigger, manual asset event, materialize). This is what fixes the empty-key 400.

  • Header and AssetEvent no longer render a partition-key line when the value is null/undefined.

  • Label created runs as Partition Key (was Mapped Partition Key). Mapped Partition Key is intentionally kept where a partition mapper derives a downstream key from upstream asset key(s); it is not touched here.

  • The trigger form only shows the partition key field for partitioned Dags, with an Optional - only applies to partitioned Dags helper text.

  • The manual asset-event partition key uses a plain text Input instead of the JsonEditor.


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, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@Lee-W Lee-W changed the title UI: Fix partition key display and input handling Fix partition key display and input handling Jul 10, 2026
@boring-cyborg boring-cyborg Bot added area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default labels Jul 10, 2026
@Lee-W
Lee-W force-pushed the ui-partition-key-polish branch from f745c87 to 2776b94 Compare July 13, 2026 00:59
@Lee-W Lee-W self-assigned this Jul 13, 2026
@Lee-W Lee-W added the backport-to-v3-3-test Backport to v3-3-test label Jul 14, 2026
@Lee-W
Lee-W force-pushed the ui-partition-key-polish branch from 2776b94 to 4ef58f0 Compare July 14, 2026 01:52
Comment thread airflow-core/src/airflow/ui/src/queries/useTrigger.ts Outdated
Comment thread airflow-core/src/airflow/ui/src/pages/Run/Header.tsx
Comment thread airflow-core/src/airflow/ui/src/components/Assets/AssetEvent.tsx Outdated
@bbovenzi bbovenzi added this to the Airflow 3.3.1 milestone Jul 14, 2026
@Lee-W
Lee-W force-pushed the ui-partition-key-polish branch from 4ef58f0 to 09a6e23 Compare July 15, 2026 03:04
Comment thread airflow-core/src/airflow/ui/src/pages/DagRuns/DagRuns.tsx
Lee-W added 6 commits July 16, 2026 15:47
Non-partitioned Dag runs showed a dangling "Partition key:" label, an
empty partition key typed then cleared was sent to the trigger/materialize
APIs and rejected with 400, the trigger form exposed the field even for
non-partitioned Dags, the manual asset-event partition key used a
JsonEditor for a plain string, and the runs table hid the partition_key
column even when its filter was shown for a partitioned Dag. Also unify
the partition key label so cron/runtime-partitioned runs no longer say
"Mapped Partition key".
The trigger form and manual/materialize asset-event flows each
duplicated the same undefined/empty-string-to-null check before
sending partition_key to the API, making the normalization easy to
get subtly wrong in one call site while fixing it in another.
Collapse the redundant undefined/null comparison into a single
loose-equality null check, matching the reviewer's simplification
of the earlier partition key display fix.
The runs table hid the partition_key column by default and revealed it
only for partitioned Dags by fetching Dag details and forcing a table
remount once the answer arrived. That remount-on-load approach was
fragile, and the show/hide behaviour is better solved by a reusable
mechanism (one that could also drive e.g. hiding map_index for
non-mapped tasks), so it is dropped here to be reworked separately.
@Lee-W
Lee-W force-pushed the ui-partition-key-polish branch from 09a6e23 to af4cfa6 Compare July 16, 2026 07:48

@bbovenzi bbovenzi 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.

Thanks!

@bbovenzi
bbovenzi merged commit b767477 into apache:main Jul 16, 2026
88 checks passed
@bbovenzi
bbovenzi deleted the ui-partition-key-polish branch July 16, 2026 15:05
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

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 PR Link

@Lee-W

Lee-W commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Thanks, Brent!

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

Labels

area:translations area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-3-test Backport to v3-3-test translation:default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants