Repository navigation
Fix the integration tests failing on every main run (MCP outage hang, SAML adopt 500, cache markers, stale expectations) - #38013
Conversation
…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.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
Code Review ✅ Approved 🟡 Medium riskMCP 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. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| public static void startAppStateRefresh() { | ||
| APP_STATE_REFRESHER.scheduleWithFixedDelay( | ||
| () -> APP_ACTIVE.refresh(McpAppConstants.MCP_APP_NAME), | ||
| 0, | ||
| APP_STATE_REFRESH_SECONDS, | ||
| TimeUnit.SECONDS); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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.
Describe your changes:
Every
mainintegration-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.CredentialDatabaseOutageIT.botAndPatGet503WithRetryAfterWhileASessionTokenStillWorksMcpAvailabilityFilterread theMcpApplicationentity on every/mcprequest, before auth. Once the cached entry expired, a DB outage made MCP hang about 20s instead of answering 503 +Retry-After.2026-11-12-mcp-turns-off-at-request-timev2.SsoSamlLoginIT.concurrentFirstLoginsCreateOneAccountfromCache=false), as the OIDC path already does.ContextFileFqnRepairMigrationIT.aFileEditedInAFolderGetsItsFolderBackInItsFqnContextFileFqnRepairinvalidated 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.CacheBundle.invalidateEntity.NativeOntologyLibraryPreviewIT.everyPackPreviewsWithoutChangingTheTargetfhir=15673.SsoOidcConfidentialLoginIT.loginRoundTripHandsTheBrowserTheProvidersIdTokenMetricResourceIT.put_reingestingANewExpressionChangesOnlyTheExpressionDataProductDeleteRaceIT(3 tests)performance_schema.data_lock_waits.None of these come from #37997 or #38001: every one except
MetricResourceITalready failed ona1ae989c32, before both merged.TaskCommentsITwas fixed by #38001.Not in this PR:
RdfSoftDeleteReindexITfailure.Type of change:
Tests
Local runs on this branch (
Tests run/Failures/Errors):DataProductDeleteRaceIT3/0/0. Steps take about 1s, down from about 50s.CredentialDatabaseOutageIT2,McpAvailabilityIT2 andNativeOntologyLibraryPreviewIT8, giving 12/0/0. During the pause the server log showsPOST /mcp 503in about 2s; before the fix it was200after about 20s.cache-tests(Redis on):ContextFileFqnRepairMigrationIT4 andMetricResourceIT#put_reingesting…1, giving 5/0/0.cache-tests(Redis on):SsoSamlLoginIT9 andSsoOidcConfidentialLoginIT19, giving 28/0/0.The RED evidence for each fix is the failing
mainCI runs listed in the table. I didn't reproduce each one locally before the fix.Checklist:
2026-11-12-mcp-turns-off-at-request-time, v2).🤖 Generated with Claude Code
The PR appears safe to merge, with two non-blocking cleanup improvements recommended.
Findings
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.
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