regression tests#2696
Open
SantanM wants to merge 31 commits into
Open
Conversation
…HDSI/Data2Evidence into SantanM/internal-2657_regression-tests
hengxian-jiang
approved these changes
Jun 17, 2026
suwarnoong
reviewed
Jun 17, 2026
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write |
Collaborator
There was a problem hiding this comment.
Do you need write permission?
Collaborator
Author
There was a problem hiding this comment.
Yes, write permissions allow pulling of docker images from the ghcr.io. This is the same setting we've in other GH action running HTTP tests.
p-hoffmann
reviewed
Jun 18, 2026
p-hoffmann
reviewed
Jun 18, 2026
p-hoffmann
reviewed
Jun 18, 2026
p-hoffmann
reviewed
Jun 18, 2026
p-hoffmann
requested changes
Jun 18, 2026
Timing samples from error responses (401/404/500) complete fast with no real DB work, so they passed the threshold gate as false greens. Now status codes are collected per run and asserted to be all 2xx before comparing to baseline. A missing BEARER_TOKEN exits the run immediately with a clear error message.
A missing baseline previously passed silently — now the test fails with a message directing the user to run the baseline writer first. The baseline writer now skips writing an entry when any timed response was non-2xx, preventing polluted baselines from bad-auth runs.
p-hoffmann
approved these changes
Jun 18, 2026
Comment on lines
+1
to
+6
| { | ||
| "home_page_to_cohort_def_list_0": { | ||
| "minMs": 29.9 | ||
| }, | ||
| "home_page_to_cohort_def_list_1": { | ||
| "minMs": 7.3 |
Comment on lines
+18
to
+37
| export function compareToBaseline(result: TimingResult, baseline: Baseline): CompareResult { | ||
| const entry = baseline[result.scenarioName]; | ||
|
|
||
| if (!entry) { | ||
| return { | ||
| scenarioName: result.scenarioName, | ||
| status: "no-baseline", | ||
| currentP95Ms: result.p95Ms, | ||
| baselineP95Ms: null, | ||
| deltaFraction: null, | ||
| minMs: result.minMs, | ||
| maxMs: result.maxMs, | ||
| }; | ||
| } | ||
|
|
||
| const delta = (result.p95Ms - entry.p95Ms) / entry.p95Ms; | ||
| let status: CompareStatus = "pass"; | ||
| if (delta > config.failThreshold) status = "fail"; | ||
| else if (delta > config.warnThreshold) status = "warn"; | ||
|
|
Comment on lines
+38
to
+46
| return { | ||
| scenarioName: result.scenarioName, | ||
| status, | ||
| currentP95Ms: result.p95Ms, | ||
| baselineP95Ms: entry.p95Ms, | ||
| deltaFraction: delta, | ||
| minMs: result.minMs, | ||
| maxMs: result.maxMs, | ||
| }; |
Comment on lines
+12
to
+17
| // Replaces the host+port of every scenario URL. | ||
| // Set D2E_BASE_URL=localhost:41100 to point at a local instance. | ||
| D2E_BASE_URL: process.env.D2E_BASE_URL ?? "localhost:41100", | ||
|
|
||
| // Substituted into any query param or JSON body field named "datasetId". | ||
| DATASET_ID: process.env.DATASET_ID ?? "", |
Comment on lines
+253
to
+267
| response=$(curl -ik 'https://localhost:41100/d2e/oauth/token' \ | ||
| --header 'accept: application/json, text/javascript, */*; q=0.01' \ | ||
| --header 'content-type: application/x-www-form-urlencoded' \ | ||
| --header "Cookie: _interaction=$interaction_cookie; _interaction.sig=$interaction_sig_cookie; _interaction_resume=$interaction_resume_cookie; _interaction_resume.sig=$interaction_resume_sig_cookie; _session=$session_cookie; _session.sig=$session_sig_cookie; _logto={\"appId\":\"$LOGTO__D2E_APP__CLIENT_ID\"}" \ | ||
| --header 'origin: https://localhost:41100' \ | ||
| --header 'referer: https://localhost:41100/d2e/portal/login-callback?code=2sxkx6uCahwOfKo1cwzLaAq5MfdBJrMcqCLNHvOTXFv&state=odSrnZhVyE&iss=https%3A%2F%2Flocalhost%3A41100%2Foidc' \ | ||
| --data-urlencode 'grant_type=authorization_code' \ | ||
| --data-urlencode "client_id=$LOGTO__D2E_APP__CLIENT_ID" \ | ||
| --data-urlencode 'redirect_uri=https://localhost:41100/d2e/portal/login-callback' \ | ||
| --data-urlencode "code=$authorization_code" \ | ||
| --data-urlencode 'code_verifier=kqVLhCyXRJ3Y9mXie6F9d1FW8AUbTUzIuJiqUf1SM9I') | ||
| printf "%s\n" "$response" | ||
|
|
||
| export BEARER_TOKEN=$(echo "$response" | grep -o '"access_token":"[^"]*"' | sed 's/"access_token":"\([^"]*\)"/\1/') | ||
| echo "BEARER_TOKEN=$BEARER_TOKEN" >> $GITHUB_ENV |
| run: | | ||
| echo "LOGTO__D2E_APP__CLIENT_ID: ${LOGTO__D2E_APP__CLIENT_ID}" | ||
| response=$(curl -ik "https://localhost:41100/oidc/auth?redirect_uri=https%3A%2F%2Flocalhost%3A41100%2Fd2e%2Fportal%2Flogin-callback&client_id=$LOGTO__D2E_APP__CLIENT_ID&response_type=code&state=lbFDB1hcko&scope=openid%20offline_access%20profile%20email&nonce=Osptnuwqc47w&code_challenge=n6eqz8p8jj1L9Qu7pY2_GrWO7XyaQbWrcs54x9OAnPg&code_challenge_method=S256") | ||
| printf "%s\n" "$response" |
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.
Adds performance regression testing framework for D2E HTTP API endpoints.
This PR introduces a new performance regression test suite that measures response times against a locked baseline. It includes:
New regression test workflow (.github/workflows/_test-regression.yml) — sets up Docker services and runs performance tests
Performance test runner — TypeScript-based framework that parses HAR/curl files and compares response times against baseline
Initial baseline — pre-recorded p95 times for cohort definition and patient count endpoints
Two test scenarios — home page to cohort definition list flow (18 requests) and patient count/population bar chart endpoints
CI integration — integrated into the main docker-build-push workflow with a gate job (test_regression_gate)
Tests fail if any scenario exceeds 20% above baseline (configurable). Results are reported as tables with per-scenario deltas, and detailed reports are saved on failure.
Merge Checklist
Please cross check this list if additions / modifications needs to be done on top of your core changes and tick them off. Reviewer can as well glance through and help the developer if something is missed out.
developbranch)