test(e2e): the standalone tool listing is asserted as a set, so the nightly gate stops going stale on a tool the platform always registered (#1644) - #1646
Merged
Conversation
…e stops going stale on a tool the platform always registered (#1644) TestAdminAPI_Standalone/list_tools_platform_level asserts the exact set of platform-level tools a standalone server registers -- platform_info, list_connections, platform_find_tools -- rather than a count of them. A toolkit tool leaking into a connectionless server is reported by name, and so is a platform tool that went missing. The count it replaces had been red every night since 2026-09-02: #1586 fixed Platform.PlatformTools() (pkg/platform/platform.go:3262) to name every tool the platform registers rather than two of them, and platform_find_tools has been registered unconditionally in Start since #504, so the listing the assertion reads has carried three tools since v1.129.0. A count says only that a number moved; it names neither what appeared nor what left, and it goes stale again the next time the platform reports a tool it always registered. The store-conditional tools (manage_prompt, show_prompts, manage_script, run_script, show_scripts) stay out of the expected set: PlatformTools() adds them only where their stores exist, and this fixture has no database. helpers.DiffToolNames and helpers.AssertToolSet (test/e2e/helpers/assertions.go) hold the comparison, covered by test/e2e/helpers/assertions_test.go over the exact set, an out-of-order set, a leaked toolkit tool, a missing platform tool, multiple sorted leaks, and an empty listing. Total is still read, now against the number of tools the response body carries. Closes #1644
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1646 +/- ##
==========================================
- Coverage 91.60% 91.59% -0.02%
==========================================
Files 777 777
Lines 77877 77877
==========================================
- Hits 71337 71328 -9
- Misses 4271 4276 +5
- Partials 2269 2273 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What is true after this
TestAdminAPI_Standalone/list_tools_platform_levelasserts the exact set of platform-level tools a standalone server registers —platform_info,list_connections,platform_find_tools— and reports by name any toolkit tool that leaked into a connectionless server, and any platform tool that went missing from the listing.The nightly real-dependency E2E workflow passes.
Why the count had to go
The assertion read
tools.Total != 2. #1586 (v1.129.0) fixedPlatform.PlatformTools()(pkg/platform/platform.go:3262) to name every tool the platform registers rather than only two of them, andplatform_find_toolshas been registered unconditionally inStart(pkg/platform/platform.go:2887) since #504. A standalone server therefore listed three platform tools, and did before #1586 — what changed is that the admin listing (internal/httpserver/mounts.go:668) stopped under-reporting.So the gate went red on 2026-09-02 and stayed red through v1.130.5: runs 33627629590, 33752789054, 33870775195, 33962678490, 34030656488, each failing on that one subtest and nothing else. The cost was not the failure. It was that the only gate running the platform against real PostgreSQL, Trino and SeaweedFS was unreadable for five days, so a genuine regression in that suite would have been indistinguishable from the noise.
The intent behind the assertion is worth keeping: a standalone server with no connections must not register a toolkit tool, and an exact assertion is what makes that detectable. A count is the wrong exact assertion. It goes stale the next time the platform reports a tool it always registered, and when it fails it names neither the tool that appeared nor the tool that left.
The shape of the assertion
helpers.DiffToolNames(got, want)returns what a listing lacks and what it carries beyond the expected set, both sorted so the message is the same on every run.helpers.AssertToolSet(t, got, want...)reports each by name:The store-conditional tools stay out of the expected set.
PlatformTools()addsmanage_prompt,show_prompts,manage_script,run_scriptandshow_scriptsonly where their stores exist, and the standalone fixture has no database — the siblingsystem_infosubtest assertsFeatures.Database == falseon the same server.Totalis still read, now against the number of tools the response body carries (pkg/admin/system.go:186setsTotal: len(tools)), so the field the old assertion was the sole reader of does not become unasserted.Acceptance
Run against the real dependency stack from
docker-compose.e2e.yml, the same suite the nightly workflow runs.The E2E suite passes.
go test -v -race -tags=integration ./test/e2e/...—ok test/e2e 11.857s,ok test/e2e/helpers 1.067s; 98 passes and 12 skips, the skips being the DataHub-dependent suites that CI also skips because DataHub is deliberately absent from the compose stack. The subtest that had been red every night:A leaked toolkit tool fails the test, naming the tool. Proved through the real subtest, by appending
trino_executeto the listing the assertion reads and reverting the edit afterward:A server listing exactly the three passes. The suite run above, plus
TestDiffToolNamesover the exact set, an out-of-order set, a leaked toolkit tool, a missing platform tool, multiple leaks reported sorted, and an empty listing.One local deviation, noted for reproducibility: host port 9000 was held by a non-Docker listener on
127.1.27.{1,3,4}that survivedmake e2e-down, so SeaweedFS was bound to 9100 and the suite run withE2E_S3_ENDPOINT=localhost:9100, whichtest/e2e/helpers/config.go:50reads. Everything else matchedmake e2e-upandmake e2e-test.Scope
Test-only:
test/e2e/admin_api_test.go,test/e2e/helpers/assertions.go, and the newtest/e2e/helpers/assertions_test.go. No production Go changed, whichmake verify's acceptance-check reports directly, and codecov ignores**/*_test.go, so patch coverage finds no executable changed lines.The other
Total !=assertions inadmin_api_test.gocount rows the test itself inserts — personas, API keys, audit events — rather than what the platform registers, so they do not rot the same way and are untouched.Closes #1644