Skip to content

fix: filter component fetch to nodes only and safe channel close - #131

Merged
synackd merged 2 commits into
mainfrom
pr/c-component-fetch-filter
Sep 8, 2026
Merged

synackd merged 2 commits into
mainfrom
pr/c-component-fetch-filter

Conversation

@synackd

@synackd synackd commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

The original implementation of ComponentInformation fetched the full component list without filtering, causing cache‑misses for non‑Node components and unnecessary processing. Update the SMD client to request only Node components by appending ?type=Node to the endpoint (/hsm/v2/State/Components). The change ensures that ComponentInformation and related cache logic operate correctly for node resources. Additionally, StopCacheRefresh now safely closes its stop channel using a select‑based guard (safeClose) to avoid panics if the channel is closed multiple times. Corresponding tests have been updated to reflect the new behavior. These improvements enhance performance and stability of the SMD client.

Fixes #128 (comment)
Fixes #128 (comment)

Checklist

  • My code follows the style guidelines of this project
  • I have added/updated comments where needed
  • I have added tests that prove my fix is effective or my feature works
  • I have run make test (or equivalent) locally and all tests pass
  • I have updated the relevant documentation (CLI examples, man pages, README, other docs, etc.)
  • DCO Sign-off: All commits are signed off (git commit -s) with my real name and email
  • REUSE Compliance:
    • Each new/modified source file has SPDX copyright and license headers
    • Any non-commentable files include a <filename>.license sidecar
    • All referenced licenses are present in the LICENSES/ directory

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Dependency update
  • Build system/CI

@synackd
synackd force-pushed the pr/c-component-fetch-filter branch 3 times, most recently from 86dda3d to 8db0a0f Compare August 31, 2026 16:32
@synackd synackd mentioned this pull request Aug 31, 2026
11 of 15 tasks
@synackd
synackd marked this pull request as ready for review August 31, 2026 16:43

@alexlovelltroy alexlovelltroy 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.

Looks like TestPopulateNodes is failing on this PR. We need to fix that before merging.

Comment thread internal/smdclient/SMDclient.go Outdated
@synackd
synackd force-pushed the pr/c-component-fetch-filter branch 2 times, most recently from 4a479b3 to 08a16a1 Compare September 2, 2026 20:19
The original implementation of ComponentInformation fetched the full
component list without filtering, causing cache‑misses for non‑Node
components and unnecessary processing. Update the SMD client to request
only Node components by appending ?type=Node to the endpoint
(/hsm/v2/State/Components). The change ensures that ComponentInformation
and related cache logic operate correctly for node resources.
Additionally, StopCacheRefresh now safely closes its stop channel using
a select‑based guard (safeClose) to avoid panics if the channel is
closed multiple times. Corresponding tests have been updated to reflect
the new behavior. These improvements enhance performance and stability
of the SMD client.

Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
@synackd
synackd force-pushed the pr/c-component-fetch-filter branch from 08a16a1 to 1e36996 Compare September 2, 2026 22:23
@synackd
synackd enabled auto-merge (squash) September 8, 2026 15:24
@synackd
synackd merged commit ccd6701 into main Sep 8, 2026
14 checks passed
@synackd
synackd deleted the pr/c-component-fetch-filter branch September 8, 2026 15:57
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