Skip to content

chore: gate Link commands with canUseLink - #286

Merged
nathanyoung merged 1 commit into
mainfrom
chore/gate-link-netinfo
Oct 7, 2026
Merged

nathanyoung merged 1 commit into
mainfrom
chore/gate-link-netinfo

Conversation

@nathanyoung

Copy link
Copy Markdown
Contributor

Gate Link commands with canUseLink

Summary

  • Register link only when the existing OpenFeature client evaluates canUseLink as true. The default remains false.
  • Disabled, missing, or invalid flags hide Link from root help and reject direct invocation, including link --help and QR creation.
  • Gate domain lookup, short-code creation, and QR creation together through the Link command. Preserve the enabled command's flags, authentication, and service behavior.
  • Reuse the CLI's existing evaluation context and feature-command registration pattern. hx has no net.info command or service to gate.
  • Document Link availability in the README.

Validation

  • go test -coverprofile=/tmp/hx-gate-unit-coverage.txt -covermode=atomic ./cmd/... ./internal/... ./pkg/... passed.
  • Added 24 cases across all four feature-flag combinations, missing flags, and evaluation errors. Tests use the real OpenFeature evaluator and Cobra command dispatch.
  • Confirmed the regression tests fail when Link registration becomes unconditional.
  • go vet ./..., go build -o /tmp/hx-gated ., formatting, and diff checks passed.
  • The built binary hides disabled Link from root help and rejects direct commands with exit code 1. help link reports an unknown help topic.
  • The full local suite reaches two existing acceptance failures because those tests assume no saved credentials. This machine is authenticated. All unit packages pass; CI will exercise the acceptance suite in a clean environment.
  • The existing .gitignore edit is excluded from this PR.

Related issues

Related pull requests

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request gates the link command behind the canUseLink feature flag, conditionally adding it to the root command only when the flag is enabled. It also updates the README to document this behavior and introduces a comprehensive test suite in cmd/root_test.go to verify the command gating under various flag configurations. There are no review comments, and I have no feedback to provide.

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The implementation consistently gates command discovery and execution with comprehensive focused tests.

Review effort: Balanced
Findings: None

What changed in this PR

Gates the Link CLI command behind the existing canUseLink feature flag.

Changes:

  • Conditionally registers link, defaulting to unavailable.
  • Adds coverage for enabled, disabled, missing, and invalid flags.
  • Documents Link availability requirements.
File Description
README.md Documents feature-gated availability.
cmd/​root.go Conditionally registers the Link command.
cmd/​root_test.go Tests gating across flag and invocation scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nathanyoung
nathanyoung merged commit be35b51 into main Oct 7, 2026
7 checks passed
@nathanyoung
nathanyoung deleted the chore/gate-link-netinfo branch October 7, 2026 15:41
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.

3 participants