Skip to content

Fix the integration tests failing on every main run (MCP outage hang, SAML adopt 500, cache markers, stale expectations) - #38013

Merged
sonika-shah merged 7 commits into
mainfrom
fix/main-it-failures-2026-11-18
Nov 18, 2026
Merged

sonika-shah merged 7 commits into
mainfrom
fix/main-it-failures-2026-11-18

Conversation

@yan-3005

@yan-3005 yan-3005 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Every main integration-test run is red: the last 6 pushes on all three engines. I tallied the failing tests across the last 3 runs on each engine (a1ae989c32, 65a6afbda3 / #37997, 8a7d55493a / #38001). Each failure has one root cause below. Two are product bugs.

Test Fails on main Root cause Introduced by Fix
CredentialDatabaseOutageIT.botAndPatGet503WithRetryAfterWhileASessionTokenStillWorks 9/9, all engines Product. McpAvailabilityFilter read the McpApplication entity on every /mcp request, before auth. Once the cached entry expired, a DB outage made MCP hang about 20s instead of answering 503 + Retry-After. #37704 The app state is kept in memory and re-read in the background every 2s; a failed re-read keeps the last state. ADR 2026-11-12-mcp-turns-off-at-request-time v2.
SsoSamlLoginIT.concurrentFirstLoginsCreateOneAccount 3/3, PG+ES+Redis Product. When two first SAML logins race, the loser adopts the winner's account. Its reload went through the entity cache, where the loser's own miss had left a not-found marker, so the adopt failed with a 500. #37741 The adopt reload reads from the DB (fromCache=false), as the OIDC path already does.
ContextFileFqnRepairMigrationIT.aFileEditedInAFolderGetsItsFolderBackInItsFqn 3/3, PG+ES+Redis ContextFileFqnRepair invalidated the entity caches but not the not-found cache, so a lookup of the derived FQN made before the repair kept answering 404 for 30s. #37796 The repair also calls CacheBundle.invalidateEntity.
NativeOntologyLibraryPreviewIT.everyPackPreviewsWithoutChangingTheTarget 9/9, all engines Stale expectation. #37883 stopped planning a rule a pack states twice; fhir repeats 731 rules. Reproduced offline: reverting only that change gives 16404 again. #37883 Expect fhir=15673.
SsoOidcConfidentialLoginIT.loginRoundTripHandsTheBrowserTheProvidersIdToken 3/9 OC-17 released a held token request without waiting for it. The late answer minted an ID token that overwrote the mock's last issued token while OC-01 asserted on it. #37741 The mock gate signals completion, and OC-17 waits for it.
MetricResourceIT.put_reingestingANewExpressionChangesOnlyTheExpression 2/3, PG+ES+Redis The reviewer PATCH starts an approval run that writes In Review asynchronously. The baseline was read before that write landed. #37575 Await the approval task before reading the baseline.
DataProductDeleteRaceIT (3 tests) 3/3, MySQL The lock-wait probe never matched on CI, so each race step waited out MySQL's 50s lock timeout. #33762 Read lock waits from performance_schema.data_lock_waits.

None of these come from #37997 or #38001: every one except MetricResourceIT already failed on a1ae989c32, before both merged. TaskCommentsIT was fixed by #38001.

Not in this PR:

  • The one-off RdfSoftDeleteReindexIT failure.
  • One parallel-lane 65-minute timeout.

Type of change:

  • Bug fix

Tests

Local runs on this branch (Tests run / Failures / Errors):

  • MySQL + ES: DataProductDeleteRaceIT 3/0/0. Steps take about 1s, down from about 50s.
  • MySQL + ES: CredentialDatabaseOutageIT 2, McpAvailabilityIT 2 and NativeOntologyLibraryPreviewIT 8, giving 12/0/0. During the pause the server log shows POST /mcp 503 in about 2s; before the fix it was 200 after about 20s.
  • cache-tests (Redis on): ContextFileFqnRepairMigrationIT 4 and MetricResourceIT#put_reingesting… 1, giving 5/0/0.
  • cache-tests (Redis on): SsoSamlLoginIT 9 and SsoOidcConfidentialLoginIT 19, giving 28/0/0.

The RED evidence for each fix is the failing main CI runs listed in the table. I didn't reproduce each one locally before the fix.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For a durable decision change I updated its ADR (2026-11-12-mcp-turns-off-at-request-time, v2).

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with two non-blocking cleanup improvements recommended.

Findings

  1. P2 Refresh task outlives the server ▶
  2. P2 Completion timeouts go unnoticed ▶

Summary

This PR fixes stale-cache failures in SAML sign-in and file-name repair, moves MCP availability reads into the background, and stabilizes integration-test waits and expectations.

  • MCP requests check app availability without waiting on the database.
  • Concurrent SAML first logins can finish with one shared account.
  • Repaired context files stop leaving stale missing-name lookups.
  • OIDC mock responses finish before the next test reads tokens.
  • MySQL race tests detect blocked deletes by the locked table.
  • Metric tests wait for review status before comparing re-ingest results.
  • FHIR preview tests expect the updated pack operation count.

Two non-blocking cleanup issues remain: the MCP refresh task has no stop hook, and the OIDC completion wait ignores timeouts.

Reviews (1) · Last reviewed commit: "test(it): let the metric approval run la..." · Reviewed by Greptile

…tDeleteRaceIT

On CI the innodb_trx statement text never matched the blocked statements,
so each race step only ended when a request hit MySQL's 50s lock-wait
timeout, and one step outlived the 60s wait. data_lock_waits joined to
data_locks names the table each blocked transaction waits on, independent
of the statement text. Locally the three races now take 1.7-3.8s on MySQL
instead of about 50s.

(cherry picked from commit 536e181)
…swers 503, not a hang

McpAvailabilityFilter read the McpApplication entity on every /mcp request,
before the bearer token is checked. Once the cached entry expired, a database
outage made every MCP request block on that read for ~20s instead of reaching
the auth path that answers 503 with Retry-After (CredentialDatabaseOutageIT).

The state is now kept in memory and re-read through the entity cache every 2s
in the background; a failed re-read keeps the last state. ADR v2 records it.
When two first SAML logins race, the loser adopts the winner's account. Its
reload read through the entity cache, where the loser's own earlier miss had
left a not-found marker, so with Redis enabled the adopt failed and the login
answered 500 (SsoSamlLoginIT.concurrentFirstLoginsCreateOneAccount).
… FQN

ContextFileFqnRepair invalidated the entity caches but not the negative cache,
so a lookup of the derived FQN made before the repair kept answering 404 for
30s with Redis enabled (ContextFileFqnRepairMigrationIT).
OC-17 released a held token request without waiting for it; the late answer
minted an ID token that overwrote the provider's last issued token while OC-01
was asserting on it.
#37883 stopped planning a rule that a pack states twice; fhir repeats 731, so
its preview plans 15673 operations, not 16404.
The reviewer PATCH starts an approval run that writes In Review
asynchronously; reading the baseline before it landed made the status
comparison flaky.
@yan-3005
yan-3005 requested a review from a team as a code owner November 18, 2026 03:18
@yan-3005
yan-3005 requested review from pmbrull and a balanced review from Copilot November 18, 2026 03:18
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

MCP now serves background-refreshed app state, so stale cache data could leave the endpoint available briefly after an administrator disables it.

Fixes the failing main integration tests across seven commits: MCP app state now served from memory so a DB outage returns 503 instead of hanging, SAML concurrent first-login adopt reads from the DB, the context file FQN repair invalidates the not-found cache, plus stale expectation, OIDC token-exchange sequencing, metric approval wait, and MySQL lock-wait probe fixes. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Comment on lines +77 to +82
public static void startAppStateRefresh() {
APP_STATE_REFRESHER.scheduleWithFixedDelay(
() -> APP_ACTIVE.refresh(McpAppConstants.MCP_APP_NAME),
0,
APP_STATE_REFRESH_SECONDS,
TimeUnit.SECONDS);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Refresh task outlives the server. startAppStateRefresh() starts a repeating task but keeps no handle to cancel it. The server's stop hook only stops OAuthTokenCleanupScheduler. Stopping an embedded server therefore leaves this task reading shared repositories, and starting another server in the same JVM adds another task. Tie the task to the server's start and stop hooks, and prevent duplicate scheduling.

unanswered.release();
// The released exchange still mints an ID token; let it land before the next test reads the
// provider's last issued token.
unanswered.awaitCompletion(Duration.ofSeconds(10));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Completion timeouts go unnoticed. awaitCompletion() returns false on timeout or interruption, but this call ignores the result. The test can pass while the released exchange is still running, leaving the late ID token free to affect the next test—the race this change aims to remove. Assert that the wait succeeds so a failed cleanup is reported here.

@sonika-shah
sonika-shah merged commit 0288ab0 into main Nov 18, 2026
85 of 89 checks passed
@sonika-shah
sonika-shah deleted the fix/main-it-failures-2026-11-18 branch November 18, 2026 05:22
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.

3 participants