Repository navigation
Add proxied full-stack e2e (docker images + nginx) and fix DISTINCT sort crash - #327
Closed
felixevers wants to merge 1 commit into
Closed
felixevers wants to merge 1 commit into
felixevers wants to merge 1 commit into
Conversation
felixevers
force-pushed
the
claude/filter-sort-e2e-tests-it1uyg
branch
from
July 8, 2026 13:20
4ecd0c3 to
ff71758
Compare
…ort crash Full-stack e2e against the real backend behind the nginx proxy: - docker-compose.e2e.yml: production-like stack (proxy -> web/backend/ keycloak/postgres/redis/influxdb) with parameterized image references so CI runs the images built for the current commit; ephemeral volumes - tests/e2e/proxy-fullstack.spec.ts (gated by E2E_PROXY_TARGET=1): verifies proxy routing (/, /graphql, /keycloak), authenticates via the proxied keycloak (password grant + browser login flow), seeds patients and tasks over the proxied GraphQL API, and asserts server-side filtering/sorting from the real query engine, including sorting tasks by patient (issue #213) and the NOT_CONTAINS operator - e2e-proxy CI job in tests.yml: builds backend/web/proxy images for the commit with a shared buildx layer cache (docker-build.yml now writes the same gha cache scopes), starts the compose stack and runs the proxied tests against http://localhost; required in the CI gate Backend fix uncovered by the proxied tests: - sorting over DISTINCT base queries crashed on PostgreSQL ("for SELECT DISTINCT, ORDER BY expressions must appear in select list") whenever a sort ordered by a joined/correlated expression - tasks by patient or assignee (issue #213), patients by update date, ward/room/bed, clinic or position. The unified query engine now rewraps DISTINCT statements into a plain select over deduplicated ids before applying sorts, and clears stale join memos so sort adapters re-join the rewrapped query. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WCSmjBuS6NbcB6oRmKvQgT
felixevers
force-pushed
the
claude/filter-sort-e2e-tests-it1uyg
branch
from
July 8, 2026 13:29
ff71758 to
1b3df33
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Full-stack e2e behind the nginx proxy + a real backend sort crash it caught
Follow-up to #319: the mock-based e2e can't see routing or database-level problems, so this adds a second e2e tier that runs against the real stack — the docker images built for the current commit, wired together exactly like production (nginx proxy in front of web, backend and Keycloak).
Proxied full-stack e2e
docker-compose.e2e.yml— production-like stack (proxy → web / backend / Keycloak / Postgres / Redis / InfluxDB) with parameterized image references (BACKEND_IMAGE/WEB_IMAGE/PROXY_IMAGE) so CI runs this commit's images; ephemeral volumes,restart: on-failureon the backend so migrations retry until Postgres accepts connections.tests/e2e/proxy-fullstack.spec.ts(gated behindE2E_PROXY_TARGET=1, skipped in the mock-based runs):/→ web,/keycloak/...→ Keycloak (issuer under the subpath),/graphql→ backend (JSON, never the frontend catch-all)/auth/callback→ app)NOT_CONTAINS, update-date sort, and sorting tasks by patient asc/desc (issue Sorting of my tasks list based on patients not possible #213)e2e-proxyCI job (tests.yml) — builds the backend/web/proxy images for the commit with Buildx (cache-from/to: type=gha, same scopes now written by the Docker Build workflow, so layers are shared with the images built earlier), starts the compose stack, waits for readiness through the proxy, runs the spec, and uploads the report + stack logs on failure. Added to the requiredCIgate.E2E_TESTING.mddocuments how to run this locally.Real bug the proxied tests caught (issue #213)
Sorting my tasks by patient crashed on PostgreSQL:
The tasks/patients base queries use
SELECT DISTINCT(location-scope joins), and every sort that orders by a joined or correlated expression — tasks by patient or assignee, patients by update date, ward/room/bed, clinic or position — produced anORDER BYoutside the select list and 500ed. This is invisible to the mock-based suite and to SQLite-backed tests; it reproduced immediately against the real Postgres backend through the proxy.Fix:
apply_unified_querynow rewraps DISTINCT statements into a plain select over deduplicated ids before applying sorts (and clears stale join memos so sort adapters re-join the rewrapped statement). This also covers the pre-existing case where a property filter (needs_distinct) was combined with a position/clinic sort.Verification
mainwith the DISTINCT crash when sorting tasks by patient).ruffclean; unit tests show no new failures.E2E_PROXY_TARGET=1, so the existing mock-based e2e job is unaffected.🤖 Generated with Claude Code
https://claude.ai/code/session_01WCSmjBuS6NbcB6oRmKvQgT
Generated by Claude Code