Skip to content

test: cover newrelic keychain metadata#132

Merged
rianjs merged 1 commit into
mainfrom
fix/131-keychain-metadata
Jun 20, 2026
Merged

test: cover newrelic keychain metadata#132
rianjs merged 1 commit into
mainfrom
fix/131-keychain-metadata

Conversation

@rianjs

@rianjs rianjs commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • bump cli-common to the immutable pseudo-version containing test: cover macOS keychain metadata cli-common#64
  • add a Darwin+cgo gated empirical test that writes through nrq's keychain adapter with an injected newrelic-cli/ config and inspects ByteNess Keychain metadata for newrelic-cli//api_key
  • keep config/state hermetic while restoring HOME only for real macOS Keychain default-keychain discovery

Verification

  • go list -m github.com/open-cli-collective/cli-common
  • go mod tidy -diff
  • go test ./internal/keychain
  • NRQ_KEYCHAIN_METADATA_TEST=1 go test ./internal/keychain -run TestKeychainMetadataGated -count=1 -v
  • go test ./...
  • make test
  • make verify

Closes #131

@rianjs rianjs force-pushed the fix/131-keychain-metadata branch from 1a429f2 to a561588 Compare June 20, 2026 12:11
@rianjs rianjs force-pushed the fix/131-keychain-metadata branch from a561588 to b46879b Compare June 20, 2026 12:15
@rianjs

rianjs commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator Author

Major

  • internal/keychain/keychain_metadata_darwin_test.go#L31 only exercises a first-write case. It creates a fresh synthetic profile, calls SetAPIKeyOverwrite, and checks the resulting metadata, but it never seeds an existing Keychain item with stale or blank metadata before the overwrite. That means the test would still pass if SetAPIKeyOverwrite regressed to a plain set, or if the fixed macOS metadata behavior only worked when replacing an existing item. To prove the intended overwrite behavior, seed newrelic-cli/<profile>/api_key first, confirm the pre-overwrite metadata is wrong/blank, then assert overwrite updates label and description.

@monit-reviewer

Copy link
Copy Markdown

PR review failed and the daemon has stopped retrying for this commit. I am removing my pending review request to stop the automated review cycle. Re-request @monit-reviewer to retry, or push a new commit and re-request.

@monit-reviewer monit-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated PR Review

Reviewed commit: b46879b

Manually approved via CLI.

@rianjs rianjs merged commit 3890753 into main Jun 20, 2026
10 checks passed
@rianjs rianjs deleted the fix/131-keychain-metadata branch June 20, 2026 12:19
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.

Fix macOS Keychain metadata for credstore items

2 participants