Skip to content

feat: accept a login UI that publishes no device-flow URLs - #657

Draft
nsklikas wants to merge 1 commit into
optional-device-flow-urls-specfrom
optional-device-flow-urls
Draft

nsklikas wants to merge 1 commit into
optional-device-flow-urls-specfrom
optional-device-flow-urls

Conversation

@nsklikas

@nsklikas nsklikas commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What

The charm waited for all five URLs of ui-endpoint-info before it took the login UI as ready. A login UI without the device flow publishes only the login, consent and error URLs, and Hydra then never started. Stacked on the specification, #656: read that first. This pull request shows only the code. Under the specification is #658, which brings the track up to date with main.

  • LoginUIEndpointData.is_ready requires the login, consent and error URLs only.
  • urls.device is rendered only for the device URLs that are published; without them Hydra serves its own fallback pages.

Good to know

  • A deployment whose login UI publishes all five URLs gets the same configuration as before.
  • Needed for Bring Your Own SSO: there the login and consent provider of a second Hydra is the SSO Service (feat: add the sso-service charm sso-service-operator#4), which has no device flow.
  • The login_ui_endpoints library, charmcraft.yaml and the charm's options do not change.
  • Besides its base, nothing has to merge before this, and it can merge at any time.

Tests

  • Unit tests for readiness with and without the device URLs, and for the rendered configuration with both, one or none of them.
  • Deployed with the rest of the platform on MicroK8s (Juju 3.6, Istio, Hydra and Kratos 25.4.0), with the other charms of this series as they were at that time: a browser suite of 84 sign-in cases passed twice in a row.
  • Since then the track's base moved to main's code and Hydra 26.2.0 (chore: merge main into track/istio #658). On that base the change's five files apply unchanged, 309 unit tests pass, and the configuration rendered for a login UI with all five URLs is byte for byte what the base renders. It was not deployed on that base.

@nsklikas
nsklikas force-pushed the optional-device-flow-urls-spec branch from 07b4a6e to b9c2035 Compare October 13, 2026 17:15
@nsklikas
nsklikas force-pushed the optional-device-flow-urls branch 2 times, most recently from 53a4217 to cc5e2c0 Compare October 13, 2026 18:52
@nsklikas
nsklikas force-pushed the optional-device-flow-urls-spec branch from b9c2035 to 161d126 Compare October 13, 2026 18:53
nsklikas added a commit that referenced this pull request Nov 17, 2026
## What

Brings the Istio track up to date with `main`. The track left `main` in
June and lacked its 170 commits since. The tree of this branch is `main`
as it is today with the track's one change kept: the ingress over
`istio-ingress-route` (#569), with its tests and OpenSpec files. One
merge commit; its message lists the twelve files that both sides had
changed.

What the track's charm gets from `main`:

- **The Hydra image 26.2.0** (the track pinned 25.4.0).
- **Bases**: `ubuntu@22.04:arm64`, `ubuntu@26.04:amd64` and
`ubuntu@26.04:arm64`, next to `ubuntu@22.04:amd64`.
- **The database migration** reconciled in the holistic handler: only a
fresh database is migrated by the charm, a pending schema upgrade blocks
until `run-migration`, and the credentials are escaped in the DSN.
- **OAuth clients** reconciled holistically, with the library from PyPI
(`charmlibs-interfaces-oauth`).
- **The `uv` build**, and `main`'s OpenSpec specifications and drift
job.
- **CI**: the shared workflows at v1.17.0 and `use-charmcraftcache:
false`. Without it a pull request against the track cannot build today
(charmcraftcache finds no cache for it), and a manual run of
`publish.yaml` fails to start without `main`'s workflow permissions.

## Good to know

- **How to read it.** Compare the branch with `main`: the difference is
the Istio change and the track's own OpenSpec prompts and skills, 34
files.
- **Where both sides had rewritten the same code**, the result is
`main`'s code with the track's change applied to it again:
- `src/charm.py`: `main`'s handlers, with the Istio requirers, their
`ready` events and the routes submitted in the holistic handler. Each
route handler calls the holistic handler once and then updates the
endpoints.
  - `src/integrations.py`: `main`'s, with the track's Istio route data.
- `tests/unit/test_charm.py`: `main`'s rewritten tests with the track's
four Istio edits.
- **The integration tests are adapted by reading, not by running.**
`main`'s key check in `test_remove_integration` reads the keys through
the internal ingress, as the track's `test_internal_ingress_integration`
does, and `test_upgrade.py` sends `main`'s retried request to the
track's Istio gateway.
- **`ci.yaml` keeps the track's `"**"`** for the base branches of pull
requests. `main`'s `"*"` does not match `track/istio`.
- **The release files are `main`'s.** The manifest says 3.2.0, where the
track had 3.0.2 and never cut a release. To decide: whether the track
keeps a version line of its own.
- **Two more commits, in the integration tests.** (1) They deployed the
Istio control plane and its gateways at the same time. The gateway charm
lists Istio's AuthorizationPolicy resources in its first hooks, and when
those ran before `istio-k8s` had installed the CRDs the hook failed and
the tests had no gateway address; the tests now wait for the control
plane first. (2) The upgrade test could not pass on this track: it
deployed Hydra and the login UI from `latest/edge`, which are the
Traefik charms. It now deploys both from `istio/edge`, refreshes to the
local charm, and reaches Hydra through the gateway's `external_host`, as
`test_charm.py` does. With Hydra 26.2.0 that is a real schema upgrade,
which `run-migration` completes.
- **What can still make the integration job red**, as on `main`: a
failed image pull trips the tests' error check at once (seen on this
branch and on `main` this month), and `istio-ingress-k8s` revision 61
resets `tls_enabled` on each `update-status`, which moves the route to
port 80 and back within seconds.
- **Merge it with a merge commit, not a squash**, so that `main`'s
history is in the track and the next merge of `main` is small.
- **Not changed, the track's own**: `README.md` still documents the
Traefik integrations. The track's `.gitignore` rule for archived change
specifications stays, which `main` does not have. The track's OpenSpec
change `replace-traefik-with-istio-ingress-route` is still active, not
archived, and now names code that `main` has since replaced
(`_on_oauth_integration_created`, `requirements.txt`): it needs an
update before it is archived. `tests/integration/test_upgrade.py`
deploys Hydra from `latest/edge`, a Traefik charm, and relates it over
`istio-ingress-route`, as the track's own comment says.
- **A follower unit does not reconcile on a route event**, because the
Istio library emits `ready` on the leader only; it follows at the next
event, for example `update-status`. That is the track's design, and
`main`'s Traefik charm reconciles on every unit. Compared over 228 cases
(6 states, leader and follower, 19 events), the unit status of this
branch and of `main` is the same in all of them.
- The Bring Your Own SSO pull requests are stacked on this one: #656,
then #657.

## Tests

- Lint passes. 296 unit tests pass (5 expected failures, as on `main`):
`main`'s 295 and the track's Istio tests. `openspec validate --all
--strict` passes (5 items).
- In CI the charm builds. The integration tests were not run locally.
Not deployed.
The charm waited for all five URLs of ui-endpoint-info before it took
the login UI as ready, so Hydra never started behind a login UI without
the device flow.

The login, consent and error URLs are now enough, and urls.device is
rendered only for the device URLs that are published; without them
Hydra serves its own fallback pages. A login UI that publishes all five
gets the same configuration as before.
@nsklikas
nsklikas force-pushed the optional-device-flow-urls branch from cc5e2c0 to a3da4c9 Compare November 17, 2026 13:39
@nsklikas
nsklikas force-pushed the optional-device-flow-urls-spec branch from 161d126 to 3e2817d Compare November 17, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant