Repository navigation
refactor: replace abandoned github.com/imkira/go-observer dependency with internal observer package - #7064
Merged
amartinezfayo merged 3 commits intoJul 2, 2026
Conversation
…with internal observer package Fixes spiffe#6893 Signed-off-by: Matt Van Horn <[email protected]>
Signed-off-by: Matt Van Horn <[email protected]>
mvanhorn
requested review from
MarcosDY,
amartinezfayo,
evan2645,
rturner3 and
sorindumitru
as code owners
June 11, 2026 08:18
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR removes the external github.com/imkira/go-observer dependency by introducing an internal pkg/common/observer package and updating agent/server SVID rotator code to use it.
Changes:
- Added new internal
pkg/common/observerimplementation and unit tests. - Updated agent/server rotator and related code to import the internal observer package.
- Removed
github.com/imkira/go-observerfromgo.mod/go.sum.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/common/observer/observer.go | Introduces internal observer Property/Stream implementation to replace external dependency. |
| pkg/common/observer/observer_test.go | Adds tests validating observer semantics (updates, blocking, cloning). |
| pkg/server/svid/rotator.go | Switches server rotator to internal observer import. |
| pkg/server/svid/rotator_config.go | Switches server rotator config to internal observer import. |
| pkg/server/svid/rotator_test.go | Switches server rotator tests to internal observer import. |
| pkg/agent/svid/rotator.go | Switches agent rotator to internal observer import. |
| pkg/agent/svid/rotator_config.go | Switches agent rotator config to internal observer import. |
| pkg/agent/svid/rotator_test.go | Switches agent rotator tests to internal observer import. |
| pkg/agent/manager/manager.go | Switches manager to internal observer import. |
| pkg/agent/manager/cache/bundle_cache.go | Switches bundle cache to internal observer import. |
| go.mod | Removes external go-observer dependency. |
| go.sum | Removes checksum entries for external go-observer. |
amartinezfayo
previously approved these changes
Jun 30, 2026
amartinezfayo
left a comment
Member
There was a problem hiding this comment.
Thank you @mvanhorn for this contribution, it looks great!
Could you resolve the merge conflicts in go.mod/go.sum so we can merge this?
Signed-off-by: Agustín Martínez Fayó <[email protected]> # Conflicts: # go.mod # go.sum
amartinezfayo
approved these changes
Jul 2, 2026
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.
Summary
Removes the abandoned
github.com/imkira/go-observerdependency and replaces it with a minimal internalpkg/common/observerpackage implementing the API surface SPIRE actually uses:NewProperty,Property.Value/Update, andStream.Value/Changes/Next/WaitNext/Clone. No behavior change for the agent manager, agent bundle cache, or the agent/server SVID rotators that consume it.Why this matters
#6893 flagged
imkira/go-observeras likely abandoned: last release in 2016, last commits on main ~3 years ago, and the untagged v2 module is itself 3 years stale. That leaves SPIRE's supply chain carrying a dependency with no realistic path for security patches or Go-compatibility fixes. Rather than migrating to the equally unmaintained v2, this removes the dependency entirely; the used API surface is ~120 lines of mutex+channel code that fits SPIRE'spkg/common/convention.The implementation uses a linked list of immutable states: each stream holds a pointer into the list and the property only retains the head node, so memory stays bounded by what live streams can still reach (matching the original library's design),
Updateis O(1), and there is no stream registry to leak when subscribers disconnect.Testing
Unit tests in
pkg/common/observer/observer_test.gocover value propagation, multiple streams, clone semantics, skipped-update coalescing viaWaitNext, and concurrent update/observe.go build ./...and the existing agent/server rotator + bundle cache test suites pass unchanged.go mod tidydrops the module from go.mod/go.sum.Pull Request check list
Affected functionality
Internal observable-property plumbing:
pkg/agent/manager,pkg/agent/manager/cache, and the agent/server SVID rotators.Description of change
See Summary above. All commits carry DCO sign-off.
Which issue this PR fixes
fixes #6893