Skip to content

Remove unused startupComplete channel from the health cache - #7270

Merged
MarcosDY merged 1 commit into
spiffe:mainfrom
hajimeCha:chore/health-remove-unused-startup-channel
Sep 5, 2026
Merged

MarcosDY merged 1 commit into
spiffe:mainfrom
hajimeCha:chore/health-remove-unused-startup-channel

Conversation

@hajimeCha

Copy link
Copy Markdown
Contributor

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included? — no tests added; see the note below
  • Documentation updated? — not applicable, no user-facing behavior changes

Affected functionality

The health check subsystem (pkg/common/health). There is no behavioral change.

Description of change

cache.startupComplete is allocated in newCache, but it is never sent to or
received from anywhere in the tree. Its declaration and its initialization are
its only two occurrences:

pkg/common/health/cache.go:44:		startupComplete:   make(chan struct{}, 1),
pkg/common/health/cache.go:58:	startupComplete chan struct{}

It was added in 1328bd8 (#6164). That commit adds only those two lines — no read
or write of the channel was introduced along with it — so the field has been
unused since the moment it was added.

Removing it also removes a small source of confusion when reading this file. The
name reads as if it signalled the end of the startup phase, but that is actually
done by the local startSteadyStateHealthCheckCh in startRunner
(cache.go:146, :177, :186).

No tests are added, since this removes a field that nothing reads or writes;
there is no behavior to assert. Verification of that claim, on top of this
change:

  • go vet ./... passes over all 294 packages, including _test.go files. Since
    a struct field that is still referenced anywhere would fail to compile once the
    field is gone, this establishes that no reference remains.
  • As a sanity check on that reasoning, adding a single _ = c.startupComplete
    back into the package makes it fail with c.startupComplete undefined (type *cache has no field or method startupComplete).
  • go test ./pkg/common/health/... -count=1 -race passes (18 tests).
  • gofmt, go build ./... and make lint-code (0 issues) are clean.

Which issue this PR fixes

None.

The startupComplete channel is allocated in newCache but is never sent
to or received from anywhere in the tree. It was added in 1328bd8
(spiffe#6164), a commit that introduced only its declaration and its
initialization, so the field has been unused since it was added. The end
of the startup phase is signalled by the local
startSteadyStateHealthCheckCh in startRunner instead.

Signed-off-by: Hajime Chan <[email protected]>

@MarcosDY MarcosDY left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch :D

@MarcosDY
MarcosDY enabled auto-merge September 5, 2026 18:29
@MarcosDY
MarcosDY added this pull request to the merge queue Sep 5, 2026
Merged via the queue into spiffe:main with commit 6e4ae6f Sep 5, 2026
58 checks passed
Manuthor pushed a commit to Manuthor/spire that referenced this pull request Sep 11, 2026
)

The startupComplete channel is allocated in newCache but is never sent
to or received from anywhere in the tree. It was added in 1328bd8
(spiffe#6164), a commit that introduced only its declaration and its
initialization, so the field has been unused since it was added. The end
of the startup phase is signalled by the local
startSteadyStateHealthCheckCh in startRunner instead.

Signed-off-by: Hajime Chan <[email protected]>
Manuthor pushed a commit to Manuthor/spire that referenced this pull request Sep 11, 2026
)

The startupComplete channel is allocated in newCache but is never sent
to or received from anywhere in the tree. It was added in 1328bd8
(spiffe#6164), a commit that introduced only its declaration and its
initialization, so the field has been unused since it was added. The end
of the startup phase is signalled by the local
startSteadyStateHealthCheckCh in startRunner instead.

Signed-off-by: Hajime Chan <[email protected]>
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.

2 participants