stacklok / stacklok/toolhive

Prevent Proliferation of signal.Notify handlers

Open
#2,951 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement go tech-debt
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

Summary

Toolhive depends on signal.Notify in numerous places. In isolation, signal.Notify is not a problem, but relying on it in many places can create confusing and non-deterministic shutdown behavior.

Outside of main.go files, we should instead rely on clearer patterns for shutdown (e.g. context cancellation or ideally, callers invoking shutdown functions in deterministic order). Even with such patterns in place, we should discourage additional use of signal.Notify via a lint rule, so that all toolhive systems have easily maintainable shutdown behavior.

Definition of Done

A lint rule prevents use of signal.Notify or signal.NotifyContext outside of main.go files.

Existing callers outside of main.go are either removed or grandfathered in as ignored.

Additional Context

https://github.com/stacklok/toolhive/pull/2927#pullrequestreview-3553421250

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the repository for signal.Notify and signal.NotifyContext, then identify the lint configuration and existing uses outside main.go. Review the shutdown patterns and the referenced pull request for context. Done means the lint rule rejects new uses outside main.go, while existing callers are removed or explicitly ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.