Skip to content

fix(sciencemesh): use a gateway selector in the shares handler - #887

Open
Supportlik wants to merge 1 commit into
owncloud:mainfrom
Supportlik:bugfix/sciencemesh-gateway-owncloud-reva
Open

Supportlik wants to merge 1 commit into
owncloud:mainfrom
Supportlik:bugfix/sciencemesh-gateway-owncloud-reva

Conversation

@Supportlik

@Supportlik Supportlik commented Dec 3, 2026 •

Copy link
Copy Markdown

Fixes #886

The create-share handler of the sciencemesh service resolved its gateway client once at startup and kept it, so after the gateway moved to another address it kept calling the old one. It now keeps the gateway selector and asks it for a client on every request, like the other sciencemesh handlers.

Test checks without the change with the change
TestCreateShareFollowsGatewayToNewAddress the gateway moves to another address in an in-memory registry after the shares handler was built; create-share has to call the gateway at the new address (404 for the unknown source path) and not the old one (500) fails 5 of 5, also with GOMAXPROCS=1: "expected 404 from the gateway at the new address, got 500" passes, go test -race -count=10

The test uses a private in-memory registry; the plugin moves from an indirect to a direct dependency in go.mod (go mod tidy). gofmt also moved one import in share.go.

Side effect, the same as in the other sciencemesh handlers: init no longer fails when the gateway is missing from the registry at startup; the error shows up per request as a 500 instead. This PR only aligns this one handler; other places that keep a gateway client are not part of it.

Backports: #888 (stable-9.0), #889 (stable-8.0).

AI assistance: Claude Code (claude-opus-5-5) helped to find this place, to write the change, the test and this description. I reviewed all of it.

@Supportlik
Supportlik requested a review from a team as a code owner December 3, 2026 20:19
@kw-security

kw-security commented Dec 3, 2026 •

Copy link
Copy Markdown

⚠️ Snyk checks are incomplete.

Status Scan Engine Critical High Medium Low Total (0)
⚠️ Open Source Security 0 0 0 0 See details
⚠️ Licenses 0 0 0 0 See details
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

The create-share handler resolved its gateway client once at startup and
kept it, so after the gateway moved to another address it kept calling
the old one. Keep the gateway selector and ask it for a client per
request, like the other sciencemesh handlers.

New test TestCreateShareFollowsGatewayToNewAddress (setup, run, check):
it moves the gateway to another address in a private in-memory registry
after the handler was built and expects create-share to reach the
gateway at the new address. The test uses the in-memory registry plugin,
which go mod tidy moves from an indirect to a direct dependency.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Michael Bortlik <michael@bortlik.io>
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.

sciencemesh: create-share keeps the gateway client resolved at startup

2 participants