Skip to content

feat: Reject requests and skip expiration stops for instances without sablier.enable=true#901

Merged
acouvreur merged 9 commits into
sablierapp:mainfrom
louisdtt:ignore-unlabeled-1
May 14, 2026
Merged

feat: Reject requests and skip expiration stops for instances without sablier.enable=true#901
acouvreur merged 9 commits into
sablierapp:mainfrom
louisdtt:ignore-unlabeled-1

Conversation

@louisdtt

Copy link
Copy Markdown
Contributor

Adds provider.ignore-unlabeled at Sablier level without changing provider code.
Following #893

@louisdtt louisdtt requested a review from acouvreur as a code owner May 13, 2026 20:10
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 13, 2026

@acouvreur acouvreur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall, very nice changes.

But I have the feeling that it should be 2 different flags.

One to require the sablier.enable on the instances
One to ignore expiration on instances that are disabled.

As I mentioned, it is a valid scenario for users to start an instance with the sablier.enable, update the instance to remove sablier.enable and let it run for ever.

Obviously some provider do not support that without restarting the instance, but some do. So I think that it's important.

What do you think ?

I suggest two new flags:

  • require-enable / require-sablier-enabled / other suggestion ? This is for incoming requests.
  • verify-enable-on-expiration / stop-on-expiration-if-enabled / other suggestion ? This is for the expiration function

Comment thread docs/configuration.md Outdated
Comment thread pkg/sablier/instance_request.go Outdated
@louisdtt

Copy link
Copy Markdown
Contributor Author

Yes, it's better to split the flag, i would say require-sablier-enabled for the first one, for the second one require-sablier-enabled-on-expiration maybe ? It's hard to write a clear flag that's not too long

@acouvreur

acouvreur commented May 14, 2026

Copy link
Copy Markdown
Member

Yes, it's better to split the flag, i would say require-sablier-enabled for the first one, for the second one require-sablier-enabled-on-expiration maybe ? It's hard to write a clear flag that's not too long

I think those express a better intent:

provider.reject-unlabeled-requests

Purpose: reject incoming requests when the target instance is not sablier.enable=true.

EDIT: It's worth noting that provider.reject-unlabeled-requests is only intended for the API using the names query param, and not the group. Because by definition, all groups only retrieve enabled instances.

provider.verify-enabled-on-expiration

Purpose: on expiration, re-check the instance label and only stop if sablier.enable=true.

I've made Claude Sonnet analyze the PR and give some suggestion, and I think I agree with those suggestions, the intent is very clear and represent properly the new features

@acouvreur

Copy link
Copy Markdown
Member

@louisdtt I'm sorry I've introduced new command flags recently, you have to rebase again. I will wait for your rebase before merging any further PRs

@acouvreur

Copy link
Copy Markdown
Member

@louisdtt I'm sorry I've introduced new command flags recently, you have to rebase again. I will wait for your rebase before merging any further PRs

Ok I lied, I've just merged #907

Let me know if you need help to resolve the merge conflict

@louisdtt

Copy link
Copy Markdown
Contributor Author

Don't worry, l'll do it in a few hours

@louisdtt louisdtt force-pushed the ignore-unlabeled-1 branch from cde8ebd to 3fde7ae Compare May 14, 2026 18:21
@acouvreur

Copy link
Copy Markdown
Member

All tests ok, the build error is just sonar

acouvreur
acouvreur previously approved these changes May 14, 2026

@acouvreur acouvreur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

A few code style could be improved, but we can do it in another pull request

Comment thread pkg/sablier/session_request_test.go
Comment thread pkg/sablier/instance_expired.go Outdated
@acouvreur

Copy link
Copy Markdown
Member

Maybe one last thing, @louisdtt could you create 2 working examples under examples/ so that it is easy to demonstrate and test in an end to end scenario ? After that, we can merge if testing is successful

@acouvreur

Copy link
Copy Markdown
Member

Ok, let me try the examples and we're good to go

@acouvreur

Copy link
Copy Markdown
Member

Ok, I've tried both example. Both works, but I had a few issues with the verify example:

make test
docker compose up -d
[+] Running 3/3
 ✔ Network verify-enabled-on-expiration_default      Created                                                                                                                                                                     0.0s
 ✔ Container sablier-verify-expiration-unlabeled     Started                                                                                                                                                                     0.5s
 ✔ Container verify-enabled-on-expiration-sablier-1  Started                                                                                                                                                                     0.4s
curl: (56) Recv failure: Connection reset by peer
==> Stopping unlabeled container before requesting a session
docker compose stop unlabeled
[+] Stopping 1/1
 ✔ Container sablier-verify-expiration-unlabeled  Stopped                                                                                                                                                                        0.1s
==> Requesting unlabeled container by names
curl -fsS 'http://localhost:10000/api/strategies/blocking?names=sablier-verify-expiration-unlabeled&session_duration=3s&timeout=10s' > "/tmp/sablier-verify-enabled-on-expiration-response.json"
curl: (22) The requested URL returned error: 500
make: *** [test] Error 22

I will merge it now as this is just an example.

@acouvreur acouvreur merged commit f1a4e61 into sablierapp:main May 14, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants