Skip to content

fix: Endpoint, Token, Cert Path, and Cert Key Storage for CLI Tool#16

Open
CuboYe wants to merge 3 commits intoPermify:mainfrom
CuboYe:bounty/fix-issue-2
Open

fix: Endpoint, Token, Cert Path, and Cert Key Storage for CLI Tool#16
CuboYe wants to merge 3 commits intoPermify:mainfrom
CuboYe:bounty/fix-issue-2

Conversation

@CuboYe
Copy link
Copy Markdown

@CuboYe CuboYe commented Mar 24, 2026

Summary

Fixes #2 by addressing: Endpoint, Token, Cert Path, and Cert Key Storage for CLI Tool.

Root cause

The issue behavior was reproducible and required a targeted code-path fix in this repository.

Changes made

  • Added/updated targeted code to resolve the bug condition.
  • Kept scope minimal to avoid unrelated regressions.

Verification

  • Full test suite: PASS
  • Gate result: suite passed (no issue-specific repro test found)

/claim 2

@CuboYe
Copy link
Copy Markdown
Author

CuboYe commented Mar 28, 2026

Hi maintainers — I can add a focused regression test around config persistence for endpoint/token/cert-path/cert-key handling if that helps move this forward.\n\nWould you prefer that as one integration-style CLI test or split into small unit tests per config field?

…ermify#2)

Add comprehensive test coverage for the new Token, CertPath, and CertKey
config fields:

core/config/config_test.go:
- TestCoreConfig_YAMLSerialization: verify all fields survive YAML marshal/unmarshal
- TestConfigPersistence_RoundTrip: test Write() then Read() round-trip
- TestIsConfigured: ensure validation works with new optional fields
- TestLoad: verify new fields load correctly into CliConfig

core/client/grpc_test.go:
- TestNew_EndpointValidation: verify endpoint fallback to config.PermifyURL
- TestNew_TokenCredentials: test token and cert credential handling
- TestNew_CertPathWhitespace: ensure whitespace trimming works correctly
- TestNew_EmptyStringVsWhitespace: verify empty vs whitespace-only handling

All tests use table-driven Go test style and pass without network calls.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@CuboYe
Copy link
Copy Markdown
Author

CuboYe commented Apr 4, 2026

Added the regression tests as promised — pushed to this branch.

New test files:

  • core/config/config_test.go — YAML round-trip persistence for Token, CertPath, CertKey fields; Write()/Read() cycle; IsConfigured() behavior with optional fields
  • core/client/grpc_test.go — endpoint validation, token credential handling, whitespace trimming, empty-vs-whitespace edge cases

All tests pass with go test ./core/config/... ./core/client/.... Happy to adjust coverage or style to match your preferences.

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.

Endpoint, Token, Cert Path, and Cert Key Storage for CLI Tool

2 participants