From a77e361b8c22e96fe57772d676fb992c64ae6927 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Wed, 25 Nov 2026 16:25:17 -0500 Subject: [PATCH 1/2] test: stabilize GEKPLS theta refit assertion Seed the random Latin-hypercube starts before fitting theta and update with a fixed ten-point batch. The larger design change gives the local refit a clear signal instead of allowing a single observation to leave theta exactly at its starting value. Keep the exact theta-change assertion and update its expected sample count for the batch. Co-Authored-By: Chris Rackauckas Co-Authored-By: opencode Agent-Harness: opencode 2.0.27 Agent-Model: opencode-go/hungerg-free Agent-Job: 627-opencode Agent-Session: local session ses_deba9c426ffezaDxfBXqil3lwJ (no session URL) --- test/GEKPLS.jl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/GEKPLS.jl b/test/GEKPLS.jl index 3ed1b4f5b..292312400 100644 --- a/test/GEKPLS.jl +++ b/test/GEKPLS.jl @@ -1,6 +1,7 @@ using Surrogates using Zygote using Test +using Random include("testutils.jl") # Accuracy assertions here are one-sided bounds with the measured value in a @@ -397,13 +398,20 @@ end @test err(fitted) < err(given) @testset "update! refits when fitting is on" begin + # The constructor's Latin-hypercube starts are random. Seed them so the + # pre-update optimum is reproducible rather than depending on test order. + Random.seed!(627) g = GEKPLS( x, y, grads, 2, 1.0e-4, lb, ub, 2, [0.01, 0.01]; optimize_theta = true ) before = copy(g.theta) - new_p = (0.5, 7.0, 7.0) - update!(g, new_p, welded_beam(new_p), gradient(welded_beam, new_p)[1]) - @test length(g.x) == 61 + # One point can leave the local refit at its starting theta exactly. Add + # a fixed batch instead so the extended design has a clear refit signal. + new_pts = sample(10, lb, ub, GoldenSample()) + new_y = welded_beam.(new_pts) + new_grads = first.(gradient.(welded_beam, new_pts)) + update!(g, new_pts, new_y, new_grads) + @test length(g.x) == 70 @test g.theta != before end From 6048a8c8d5c1f4a725c64b601f35f3b52b6ef208 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Wed, 25 Nov 2026 17:19:04 -0800 Subject: [PATCH 2/2] test: cover GEKPLS scalar theta refits Add a seeded single-observation update and compare its reduced likelihood with a control fitted on the same augmented design at the original theta. Keep the batch refit check. Co-Authored-By: Chris Rackauckas Co-Authored-By: Codex Agent-Harness: Codex CLI 0.171.0 Agent-Model: gpt-6.2-sol Agent-Job: SciML__Surrogates.jl__630--20261126T010456Z-codex-gpt-6.2-sol Agent-Session: local session 01a21562-c3ad-7202-b369-dca95b29f140 (no session URL) --- test/GEKPLS.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/GEKPLS.jl b/test/GEKPLS.jl index 292312400..6b661498d 100644 --- a/test/GEKPLS.jl +++ b/test/GEKPLS.jl @@ -415,6 +415,23 @@ end @test g.theta != before end + @testset "update! refits after one new observation" begin + Random.seed!(627) + g = GEKPLS( + x, y, grads, 2, 1.0e-4, lb, ub, 2, [0.01, 0.01]; optimize_theta = true + ) + frozen = GEKPLS( + x, y, grads, 2, 1.0e-4, lb, ub, 2, copy(g.theta); optimize_theta = false + ) + point = sample(10, lb, ub, GoldenSample())[5] + response = welded_beam(point) + grad = gradient(welded_beam, point)[1] + update!(g, point, response, grad) + update!(frozen, point, response, grad) + @test length(g.x) == 61 + @test g.reduced_likelihood_function_value > frozen.reduced_likelihood_function_value + end + @testset "the keyword front-end passes it through" begin g = GEKPLS( x, y, grads, lb, ub; n_comp = 2, extra_points = 2,