Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/actions/setup-openmetadata-test-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,23 @@ runs:
# Saved here rather than at job end so a later failure (server startup,
# tests) still leaves the venv cached. Fork PRs under pull_request_target
# skip the save — actions/cache-poisoning; their restore above still runs.
# merge_group is excluded for the same reason setup-uv's enable-cache is
# gated above: the queue's gh-readonly-queue/* ref dies when its entry
# merges or is dequeued, but the ~1 GB venv saved under it (x2 — one per
# Python version the py-tests matrix runs) stays charged against the
# repo's 10 GB LRU budget until evicted. Measured 2026-09-10 03:44-03:49:
# four om-venv entries, 3.98 GB, on two dead queue refs — the largest
# ephemeral writer left after #33085 — and in the same window the
# main-scoped playwright-distribution and playwright-ingestion-image
# entries the warmer had saved 25 minutes earlier were LRU-evicted.
# The restore above stays unconditional so queue runs still hit main's
# copy; only the write is gated, exactly as playwright-e2e-reusable.yml
# does for every one of its own saves.
- name: Save ingestion Python venv
if: >-
${{ inputs.fast-mode != 'true' && inputs.lightweight-ingestion != 'true' &&
steps.cache-python-venv.outputs.cache-hit != 'true' &&
github.event_name != 'merge_group' &&
!(github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository) }}
continue-on-error: true
Expand Down
6 changes: 3 additions & 3 deletions .github/playwright/impact-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"projects": ["Basic"],
"specs": [
"playwright/e2e/Pages/Login.spec.ts",
"playwright/e2e/Auth/Login.spec.ts",
"playwright/e2e/Flow/Navbar.spec.ts",
"playwright/e2e/Features/Dashboards.spec.ts",
"playwright/e2e/Pages/Lineage/LineageControls.spec.ts",
Expand Down Expand Up @@ -354,7 +354,7 @@
"specs": [
"playwright/e2e/Features/SettingsNavigationPage.spec.ts",
"playwright/e2e/Flow/LineageSettings.spec.ts",
"playwright/e2e/Pages/LoginConfiguration.spec.ts",
"playwright/e2e/Auth/LoginConfiguration.spec.ts",
"playwright/e2e/Pages/OmdURLConfiguration.spec.ts",
"playwright/e2e/Pages/ProfilerConfigurationPage.spec.ts",
"playwright/e2e/Pages/SearchSettings.spec.ts",
Expand Down Expand Up @@ -467,7 +467,7 @@
],
"projects": ["chromium", "Basic"],
"specs": [
"playwright/e2e/Pages/Login.spec.ts",
"playwright/e2e/Auth/Login.spec.ts",
"playwright/e2e/Flow/Navbar.spec.ts"
]
},
Expand Down
13 changes: 10 additions & 3 deletions .github/scripts/start_playwright_fast_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export PW_SERVER_CAPTURE_PID_FILE="$runtime_root/openmetadata-server-capture.pid
export PW_SERVER_OUTPUT_PIPE="$runtime_root/openmetadata-server.pipe"
export PW_REQUEST_METRICS="$runtime_root/logs/request-metrics.json"
export PW_AIRFLOW_CONTAINER=""
export PW_AUTOPILOT_MYSQL_CONTAINER=""
export PW_AUTH_LINK="$workspace_root/openmetadata-ui/src/main/resources/ui/playwright/.auth"
export PW_ENTITY_STATE_LINK="$workspace_root/openmetadata-ui/src/main/resources/ui/playwright/output/entity-response-data.json"

Expand All @@ -46,7 +47,7 @@ cleanup_failed_start() {
local exit_code=$?
trap - EXIT
if [[ "$startup_complete" != "true" ]]; then
"$workspace_root/.github/scripts/stop_playwright_fast_environment.sh" || true
PW_STARTUP_FAILED=true "$workspace_root/.github/scripts/stop_playwright_fast_environment.sh" || true
fi
exit "$exit_code"
}
Expand Down Expand Up @@ -326,15 +327,13 @@ for _ in $(seq 1 90); do
break
fi
if ! kill -0 "$server_pid" 2>/dev/null; then
tail -n 500 "$PW_SERVER_LOG" >&2
echo "OpenMetadata exited before becoming healthy" >&2
exit 1
fi
sleep 2
done

if ! curl -fsS http://127.0.0.1:8586/healthcheck >/dev/null; then
tail -n 500 "$PW_SERVER_LOG" >&2
echo "OpenMetadata did not become healthy" >&2
exit 1
fi
Expand Down Expand Up @@ -379,6 +378,8 @@ rm -f "$seed_search_response"
if [[ -n "$ingestion_image_path" ]]; then
PW_AIRFLOW_CONTAINER=openmetadata_ingestion
export PW_AIRFLOW_CONTAINER
export PW_AUTOPILOT_MYSQL_CONTAINER=openmetadata_autopilot_mysql
bash "$workspace_root/.github/scripts/start_playwright_autopilot_mysql.sh"
airflow_seed_container="${PW_AIRFLOW_CONTAINER}_seed"
docker create --name "$airflow_seed_container" "$ingestion_image" >/dev/null
docker cp \
Expand Down Expand Up @@ -448,6 +449,12 @@ fi
echo "PW_SERVER_CAPTURE_PID_FILE=$PW_SERVER_CAPTURE_PID_FILE"
echo "PW_REQUEST_METRICS=$PW_REQUEST_METRICS"
echo "PW_AIRFLOW_CONTAINER=$PW_AIRFLOW_CONTAINER"
echo "PW_AUTOPILOT_MYSQL_CONTAINER=$PW_AUTOPILOT_MYSQL_CONTAINER"
if [[ -n "$PW_AUTOPILOT_MYSQL_CONTAINER" ]]; then
echo "PLAYWRIGHT_AUTOPILOT_MYSQL_HOST_PORT=$PW_AUTOPILOT_MYSQL_CONTAINER:3306"
echo "PLAYWRIGHT_AUTOPILOT_MYSQL_USERNAME=playwright"
echo "PLAYWRIGHT_AUTOPILOT_MYSQL_PASSWORD=playwright-fixture-only"
fi
echo "PW_AUTH_LINK=$PW_AUTH_LINK"
echo "PW_ENTITY_STATE_LINK=$PW_ENTITY_STATE_LINK"
echo "PW_POSTGRES_IMAGE=$PW_POSTGRES_IMAGE"
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/playwright-e2e-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,94 @@ jobs:
--dir "$run_dir" || true
done

- name: Verify Playwright HTTP helpers
# PR code must not inherit the runner's cache credentials or write to
# its workspace. These tests only need loopback HTTP inside the container.
run: |
docker run --rm --network none --read-only \
--cap-drop ALL --security-opt no-new-privileges \
--user "$(id -u):$(id -g)" \
--tmpfs /tmp:rw,nosuid,size=1g \
--mount "type=bind,source=$GITHUB_WORKSPACE,target=/workspace,readonly" \
--workdir /workspace/openmetadata-ui/src/main/resources/ui \
--env CI=true \
node:22.22.2-bookworm-slim \
./node_modules/.bin/playwright test \
--config=playwright/helper-tests.config.ts --output=/tmp/helper-test-results

- name: Prepare component library for browser helper tests
if: ${{ !inputs.ref }}
run: |
core_dir="openmetadata-ui-core-components/src/main/resources/ui"
core_output="$RUNNER_TEMP/playwright-core"
# Docker cannot create nested mount targets inside the read-only checkout.
mkdir -p "$core_dir/node_modules" "$core_dir/dist"
mkdir -p "$core_output/node_modules" "$core_output/dist" "$core_output/vite-temp"
# Dependency installation can execute repository-controlled package-manager
# configuration even with lifecycle scripts disabled. Keep it off the runner.
docker run --rm --read-only \
--cap-drop ALL --security-opt no-new-privileges \
--user "$(id -u):$(id -g)" \
--tmpfs /tmp:rw,nosuid,size=4g \
--mount "type=bind,source=$GITHUB_WORKSPACE,target=/workspace,readonly" \
--mount "type=bind,source=$core_output/node_modules,target=/workspace/$core_dir/node_modules" \
--workdir "/workspace/$core_dir" \
node:22.22.2-bookworm-slim \
yarn --ignore-scripts --frozen-lockfile --cache-folder /tmp/yarn-cache

# Only temporary build output is writable; dependencies and source stay read-only.
mkdir -p "$core_output/node_modules/.vite-temp"
docker run --rm --network none --read-only \
--cap-drop ALL --security-opt no-new-privileges \
--user "$(id -u):$(id -g)" \
--tmpfs /tmp:rw,nosuid,size=1g \
--mount "type=bind,source=$GITHUB_WORKSPACE,target=/workspace,readonly" \
--mount "type=bind,source=$core_output/node_modules,target=/workspace/$core_dir/node_modules,readonly" \
--mount "type=bind,source=$core_output/dist,target=/workspace/$core_dir/dist" \
--mount "type=bind,source=$core_output/vite-temp,target=/workspace/$core_dir/node_modules/.vite-temp" \
--workdir "/workspace/$core_dir" \
node:22.22.2-bookworm-slim \
./node_modules/.bin/vite build

- name: Verify browser helper behavior
id: verify-browser-helpers
if: ${{ !inputs.ref }}
# Shared helper behavior is independent of shard data. Gate planning
# once, before fan-out, with the real compiled components and browser.
run: |
core_dir="openmetadata-ui-core-components/src/main/resources/ui"
# The workspace is mounted read-only and /tmp is a tmpfs in a --rm
# container, so anything written to either dies with the container.
# Give the run one writable mount and point Playwright's output at it,
# otherwise a failure here is a single line of `list` output.
mkdir -p "$RUNNER_TEMP/browser-helper-results"
docker run --rm --network none --read-only --shm-size=1g \
--cap-drop ALL --security-opt no-new-privileges \
--user "$(id -u):$(id -g)" \
--tmpfs /tmp:rw,nosuid,size=1g \
--mount "type=bind,source=$GITHUB_WORKSPACE,target=/workspace,readonly" \
--mount "type=bind,source=$RUNNER_TEMP/playwright-core/node_modules,target=/workspace/$core_dir/node_modules,readonly" \
--mount "type=bind,source=$RUNNER_TEMP/playwright-core/dist,target=/workspace/$core_dir/dist,readonly" \
--mount "type=bind,source=$RUNNER_TEMP/browser-helper-results,target=/artifacts" \
--workdir /workspace/openmetadata-ui/src/main/resources/ui \
--env CI=true \
--env PW_BROWSER_HELPER_OUTPUT=/artifacts \
mcr.microsoft.com/playwright:v1.57.0-jammy \
./node_modules/.bin/playwright test \
--config=playwright/browser-helper-tests.config.ts

- name: Upload browser helper failure diagnostics
uses: actions/upload-artifact@v6
# Failure-only, so a green run uploads nothing. Without this the traces
# and results.json the container just wrote are discarded with it.
if: ${{ !inputs.ref && (failure() || cancelled()) }}
continue-on-error: true
with:
name: playwright-browser-helper-results
path: ${{ runner.temp }}/browser-helper-results
retention-days: 5
if-no-files-found: ignore

- name: Discover tests
working-directory: openmetadata-ui/src/main/resources/ui
env:
Expand Down
34 changes: 34 additions & 0 deletions docker/development/playwright-autopilot-mysql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
CREATE DATABASE autopilot_source;
CREATE DATABASE autopilot_secondary;
CREATE USER 'playwright'@'%' IDENTIFIED BY 'playwright-fixture-only';
GRANT SELECT, SHOW VIEW ON autopilot_source.* TO 'playwright'@'%';
GRANT SELECT, SHOW VIEW ON autopilot_secondary.* TO 'playwright'@'%';
-- AutoPilot's usage and lineage agents read query history as well as metadata.
GRANT SELECT ON mysql.general_log TO 'playwright'@'%';

CREATE TABLE autopilot_source.bot_entity (
id INT PRIMARY KEY,
name VARCHAR(128) NOT NULL,
email VARCHAR(255)
);
INSERT INTO autopilot_source.bot_entity VALUES
(1, 'metadata-bot', 'metadata@example.com'),
(2, 'profiler-bot', 'profiler@example.com');

CREATE TABLE autopilot_source.alert_entity (
id INT PRIMARY KEY,
name VARCHAR(128) NOT NULL,
enabled BOOLEAN NOT NULL
);
INSERT INTO autopilot_source.alert_entity VALUES
(1, 'Daily quality report', TRUE),
(2, 'Schema change', FALSE);

CREATE TABLE autopilot_secondary.chart_entity (
id INT PRIMARY KEY,
name VARCHAR(128) NOT NULL,
updated_at TIMESTAMP NOT NULL
);
INSERT INTO autopilot_secondary.chart_entity VALUES
(1, 'Revenue', '2026-01-01 00:00:00'),
(2, 'Orders', '2026-01-02 00:00:00');
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import { guardStorageStateBoot } from '../../utils/storageStateRecovery';
* execution budget, and that spread is the contention behind the timeout
* failures — the server does more work than the tests have time for.
*
* Everything here is per-worker and read-through: the first request still hits
* the real server, so a cached response can never drift from it the way a
* hand-written stub body would.
* Everything here is per-worker and read-through. Correctness also depends on
* excluding server-driven values and invalidating overlapping reads and writes.
*/

/** Analytics collection is a write, and no test asserts on the stored events. */
Expand Down Expand Up @@ -116,6 +115,7 @@ type CacheEntry = {
// is now belt-and-braces rather than load-bearing.
const MAX_CACHED_RESPONSES = 64;
const bootCache = new Map<string, CacheEntry>();
let writeGeneration = 0;

const remember = (key: string, value: CacheEntry) => {
if (bootCache.size >= MAX_CACHED_RESPONSES) {
Expand Down Expand Up @@ -148,6 +148,7 @@ const familyPrefix = (pathname: string) => {
* which is why CACHEABLE_BOOT_PATHS excludes anything with an API writer.
*/
const invalidateFamily = (pathname: string) => {
writeGeneration++;
const prefix = familyPrefix(pathname);

if (!prefix) {
Expand Down Expand Up @@ -196,10 +197,11 @@ const escapeRegExp = (value: string) =>
* One predicate handler sets `all`, and the whole context then intercepts
* every request. Measured on merge_group runs of #32594, that cost the suite
* ~7% wall-clock and +15.6 GB of asset traffic: ~29k requests a shard
* round-tripped through the Node driver instead of ~8.5k, and intercepted
* requests miss the browser's HTTP cache (`static:304` 4,151 -> 2,239 while
* `static:200` rose 22.3k). A RegExp is forwarded as `regexSource`, so the
* browser pauses only these paths.
* round-tripped through the Node driver instead of ~8.5k. A RegExp is forwarded
* as `regexSource`, so the browser pauses only these paths. Routing still
* disables the context's native HTTP cache, including for unmatched assets:
* https://playwright.dev/docs/api/class-browsercontext#browser-context-route
* Measure API savings and static traffic separately when changing this cache.
*
* Matched against the full URL, since that is what `urlMatches` tests a RegExp
* against. `[^?#]*` cannot cross a `?`, so a path that appears inside a query
Expand Down Expand Up @@ -289,6 +291,7 @@ const serveBootConfig = async (route: Route) => {
return;
}

const generation = writeGeneration;
const response = await fetchRouteResponse(route);

if (!response) {
Expand All @@ -308,7 +311,7 @@ const serveBootConfig = async (route: Route) => {
// handler fails the test just as readily and consistency is one line.
const pathname = pathnameOf(request.url());

if (response.ok() && pathname) {
if (response.ok() && pathname && generation === writeGeneration) {
remember(key, { pathname, response: payload });
}

Expand Down Expand Up @@ -383,17 +386,23 @@ const serveStaticAsset = async (route: Route) => {
* propagates — a cache that is broken for a real reason must not be
* silent.
*/
const ignoreClosedTarget = async (serve: () => Promise<void>) => {
const ignoreClosedTarget = async (route: Route, serve: () => Promise<void>) => {
try {
await serve();
} catch (error) {
if (/has been closed|Route is already handled/.test(String(error))) {
return;
}
// Closing a context disposes route.fetch's response store before its body
// reader resumes. A disposed response on a live page is still an error.
if (
!/has been closed|Response has been disposed|Route is already handled/.test(
String(error)
)
/Response has been disposed/.test(String(error)) &&
route.request().frame().page().isClosed()
) {
throw error;
return;
}

throw error;
}
};

Expand Down Expand Up @@ -422,23 +431,23 @@ export const installServerLoadReducers = async (context: BrowserContext) => {
// unload, so a `fulfill` here is more likely than either of them to land on a
// page that is already going away.
await context.route(ANALYTICS_COLLECT, (route) =>
ignoreClosedTarget(() => route.fulfill({ status: 200, body: '' }))
ignoreClosedTarget(route, () => route.fulfill({ status: 200, body: '' }))
);

await context.route(CACHEABLE_BOOT_PATTERN, (route) =>
ignoreClosedTarget(() => serveBootConfig(route))
ignoreClosedTarget(route, () => serveBootConfig(route))
);

if (cacheStaticAssets) {
await context.route(STATIC_ASSET, (route) =>
ignoreClosedTarget(() => serveStaticAsset(route))
ignoreClosedTarget(route, () => serveStaticAsset(route))
);
}

// Passive listener rather than another route, so observing writes costs
// nothing on the request path.
context.on('request', (request) => {
if (request.method() === 'GET') {
const invalidateWrite = (request: Request) => {
if (['GET', 'HEAD', 'OPTIONS'].includes(request.method())) {
return;
}

Expand All @@ -447,7 +456,13 @@ export const installServerLoadReducers = async (context: BrowserContext) => {
if (pathname?.startsWith('/api/v1/')) {
invalidateFamily(pathname);
}
});
};
context.on('request', invalidateWrite);
// A GET during an outstanding write can still read the pre-commit value.
// Clear it when the write completes; generation checks also prevent an older
// in-flight GET from repopulating the cache after either invalidation.
context.on('response', (response) => invalidateWrite(response.request()));
context.on('requestfailed', invalidateWrite);
};

/**
Expand Down
Loading
Loading