refactor!: rename Open()->NewSession() #124

Merged
nemith merged 1 commit from brb/push-mkkpupxvlynw into main 2026-01-07 17:58:49 +00:00
nemith commented 2026-01-07 17:25:34 +00:00 (Migrated from github.com)

I plan on adding the idea of a SessionManager or a Pool which will allow a way to add retries, reconnections and potentially even multiple connections. This means Open() isn't a great function name and NewSession() describes what it does a lot better.

So while we are breaking changes lets make that change now to lock in a stable API sooner than later. This inches us closer to 1.0.0 release.

I plan on adding the idea of a SessionManager or a Pool which will allow a way to add retries, reconnections and potentially even multiple connections. This means `Open()` isn't a great function name and `NewSession()` describes what it does a lot better. So while we are breaking changes lets make that change now to lock in a stable API sooner than later. This inches us closer to 1.0.0 release.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-01-07 17:31:27 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

This PR performs a breaking API change by renaming the Open() function to NewSession() to better describe its purpose and prepare for future SessionManager/Pool features. This change brings the library closer to a stable 1.0.0 release.

Key changes:

  • Renamed the public API function from Open() to NewSession() in session.go
  • Updated all test files to use the new function name
  • Updated example files to demonstrate the new API

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
session.go Renamed function from Open() to NewSession() with updated documentation
session_test.go Updated all test calls from Open() to NewSession()
rpc/rpc_test.go Updated mock session creation to use NewSession()
example_tls_test.go Updated TLS example to use NewSession()
example_ssh_test.go Updated SSH example to use NewSession()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview This PR performs a breaking API change by renaming the `Open()` function to `NewSession()` to better describe its purpose and prepare for future SessionManager/Pool features. This change brings the library closer to a stable 1.0.0 release. **Key changes:** - Renamed the public API function from `Open()` to `NewSession()` in `session.go` - Updated all test files to use the new function name - Updated example files to demonstrate the new API ### Reviewed changes Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments. <details> <summary>Show a summary per file</summary> | File | Description | | ---- | ----------- | | session.go | Renamed function from `Open()` to `NewSession()` with updated documentation | | session_test.go | Updated all test calls from `Open()` to `NewSession()` | | rpc/rpc_test.go | Updated mock session creation to use `NewSession()` | | example_tls_test.go | Updated TLS example to use `NewSession()` | | example_ssh_test.go | Updated SSH example to use `NewSession()` | </details> --- 💡 <a href="/nemith/netconf/new/main/.github/instructions?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -146,9 +146,9 @@ func newSession(transport transport.Transport, opts ...SessionOption) *Session {
return s
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-01-07 17:31:26 +00:00

There is a typo in the function documentation. "th=e" should be "the" (remove the equals sign).

// NewSession will create a new Session with the given transport and open it with the
There is a typo in the function documentation. "th=e" should be "the" (remove the equals sign). ```suggestion // NewSession will create a new Session with the given transport and open it with the ```
@ -186,3 +186,3 @@
}
func TestOpenSuccess(t *testing.T) {
func TestNewSessionSuccess(t *testing.T) {
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-01-07 17:31:26 +00:00

The test function name should be updated to reflect the renamed function. Consider renaming this to TestNewSessionSuccess to maintain consistency with the API change from Open() to NewSession().

func TestNewSessionSuccess(t *testing.T) {
The test function name should be updated to reflect the renamed function. Consider renaming this to `TestNewSessionSuccess` to maintain consistency with the API change from `Open()` to `NewSession()`. ```suggestion func TestNewSessionSuccess(t *testing.T) { ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-01-07 17:31:26 +00:00

The test function name should be updated to reflect the renamed function. Consider renaming this to TestNewSessionHandshakeFailure to maintain consistency with the API change from Open() to NewSession().

The test function name should be updated to reflect the renamed function. Consider renaming this to `TestNewSessionHandshakeFailure` to maintain consistency with the API change from `Open()` to `NewSession()`.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2026-01-07 21:42:32 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Pull request overview Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment. --- 💡 <a href="/nemith/netconf/new/main/.github/instructions?filename=*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.
@ -148,3 +148,3 @@
// Open will create a new Session with th=e given transport and open it with the
// NewSession will create a new Session with the given transport and open it with the
// necessary hello messages.
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2026-01-07 21:42:32 +00:00

There is a typo in the documentation comment. The text "th=e" should be "the".

There is a typo in the documentation comment. The text "th=e" should be "the".
Sign in to join this conversation.
No description provided.