Skip to content

[v3-3-test] Resolve backfill_id in the access dependency with the type the routes declare (#70889) - #71090

Merged
vatsrahul1001 merged 2 commits into
v3-3-testfrom
backport-a6265b7-v3-3-test
Aug 4, 2026
Merged

[v3-3-test] Resolve backfill_id in the access dependency with the type the routes declare (#70889)#71090
vatsrahul1001 merged 2 commits into
v3-3-testfrom
backport-a6265b7-v3-3-test

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • Resolve backfill_id in the access dependency with the type the routes declare

The backfill routes declare backfill_id: NonNegativeInt, but
requires_access_backfill parsed the raw path value with int() and
swallowed the failure. The two parsers do not agree: pydantic's lax mode
validates "1.0" and "1.00" to 1, while int() rejects both.

Dependencies resolve before the endpoint's own parameter validation, so for
those spellings the dependency left the Dag unresolved on a request the
handler then served against backfill 1 -- the two disagreed about which Dag
the request concerned.

Parse with the same TypeAdapter the routes declare so they cannot diverge.

  • Use spec'd mocks in the backfill authorization dependency test

An unspecced Mock accepts any attribute, so the test would keep passing if the
dependency started reading something the real Request, Session or Backfill does
not have.

  • Point at the tracking issue for the unknown-backfill fallback

A backfill_id that parses but matches no row falls through to the body's dag_id,
so an unknown backfill answers 404 where an unauthorized one answers 403 and a
caller can tell which ids exist. That is a separate fix from the parser
divergence this change closes, and it has to keep the three body-authorized
routes working, so it is tracked rather than folded in here.

The comment above the adapter also loses the history that led to it; what
matters going forward is the rule it states.
(cherry picked from commit a6265b7)

Co-authored-by: Jarek Potiuk jarek@potiuk.com

…e the routes declare (#70889)

* Resolve backfill_id in the access dependency with the type the routes declare

The backfill routes declare `backfill_id: NonNegativeInt`, but
`requires_access_backfill` parsed the raw path value with `int()` and
swallowed the failure. The two parsers do not agree: pydantic's lax mode
validates "1.0" and "1.00" to 1, while `int()` rejects both.

Dependencies resolve before the endpoint's own parameter validation, so for
those spellings the dependency left the Dag unresolved on a request the
handler then served against backfill 1 -- the two disagreed about which Dag
the request concerned.

Parse with the same TypeAdapter the routes declare so they cannot diverge.

* Use spec'd mocks in the backfill authorization dependency test

An unspecced Mock accepts any attribute, so the test would keep passing if the
dependency started reading something the real Request, Session or Backfill does
not have.

* Point at the tracking issue for the unknown-backfill fallback

A backfill_id that parses but matches no row falls through to the body's dag_id,
so an unknown backfill answers 404 where an unauthorized one answers 403 and a
caller can tell which ids exist. That is a separate fix from the parser
divergence this change closes, and it has to keep the three body-authorized
routes working, so it is tracked rather than folded in here.

The comment above the adapter also loses the history that led to it; what
matters going forward is the rule it states.
(cherry picked from commit a6265b7)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
@vatsrahul1001
vatsrahul1001 merged commit ac30d80 into v3-3-test Aug 4, 2026
71 checks passed
@vatsrahul1001
vatsrahul1001 deleted the backport-a6265b7-v3-3-test branch August 4, 2026 14:10
vatsrahul1001 added a commit that referenced this pull request Aug 5, 2026
…e the routes declare (#70889) (#71090)

* Resolve backfill_id in the access dependency with the type the routes declare

The backfill routes declare `backfill_id: NonNegativeInt`, but
`requires_access_backfill` parsed the raw path value with `int()` and
swallowed the failure. The two parsers do not agree: pydantic's lax mode
validates "1.0" and "1.00" to 1, while `int()` rejects both.

Dependencies resolve before the endpoint's own parameter validation, so for
those spellings the dependency left the Dag unresolved on a request the
handler then served against backfill 1 -- the two disagreed about which Dag
the request concerned.

Parse with the same TypeAdapter the routes declare so they cannot diverge.

* Use spec'd mocks in the backfill authorization dependency test

An unspecced Mock accepts any attribute, so the test would keep passing if the
dependency started reading something the real Request, Session or Backfill does
not have.

* Point at the tracking issue for the unknown-backfill fallback

A backfill_id that parses but matches no row falls through to the body's dag_id,
so an unknown backfill answers 404 where an unauthorized one answers 403 and a
caller can tell which ids exist. That is a separate fix from the parser
divergence this change closes, and it has to keep the three body-authorized
routes working, so it is tracked rather than folded in here.

The comment above the adapter also loses the history that led to it; what
matters going forward is the rule it states.
(cherry picked from commit a6265b7)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants