Skip to content

signal not-connected southbound as codes.Unavailable - #466

Merged
henderiw merged 2 commits into
mainfrom
feature/not-connected-error
Aug 18, 2026
Merged

henderiw merged 2 commits into
mainfrom
feature/not-connected-error

Conversation

@alexandernorth

@alexandernorth alexandernorth commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Problem

When a datastore's southbound interface (device) is not connected, the
transaction path returned a plain error, which reaches gRPC clients as
code = Unknown. Clients can't distinguish this transient condition from a
permanent failure.

Change

Introduce ErrNotConnected and map it to gRPC codes.Unavailable, and
use it where not connected errors were produced previously.

TargetConnectionStatusenum is dropped andTargetStatusnow usessdcpb.TargetStatus` directly:

  • TargetStatus.Err() is the single place a connection state becomes
    ErrNotConnected, keeping the details the target collected
  • datastoreToRsp now populates Target.StatusDetails
  • gnmi compares ConnectivityState() instead of ConnState() strings
  • applyIntent prefixes the datastore name

Notes

Enables config-server to retry instead of treating it as permanent.

Behaviour change: the gnmi Set guard checked only t == nil, it now
rejects any non-ready connection, so a Set during CONNECTING or
TRANSIENT_FAILURE fails fast as Unavailable instead of being attempted.

TargetStatus_UNKNOWN is 0, so an unpopulated status now reads as not
connected.

Pairs-with: sdcio/config-server#468

Comment thread pkg/datastore/target/netconf/nc.go
@steiler steiler closed this Aug 4, 2026
@steiler steiler reopened this Aug 4, 2026
@alexandernorth
alexandernorth force-pushed the feature/not-connected-error branch from 351253f to f15c4f1 Compare August 13, 2026 11:48
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.94595% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/datastore/target/gnmi/gnmi.go 0.00% 10 Missing ⚠️
pkg/datastore/target/netconf/nc.go 33.33% 3 Missing and 1 partial ⚠️
pkg/server/datastore.go 0.00% 3 Missing ⚠️
pkg/datastore/intent_rpc.go 0.00% 2 Missing ⚠️
pkg/datastore/datastore_rpc.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henderiw

Copy link
Copy Markdown
Contributor

lgtm

@henderiw henderiw assigned henderiw and unassigned henderiw Aug 18, 2026

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

LGTM

@henderiw
henderiw merged commit de8a8dd into main Aug 18, 2026
8 checks passed
@alexandernorth
alexandernorth deleted the feature/not-connected-error branch August 18, 2026 14:14
@steiler

steiler commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Follow-up: #481 closes the residual mid-flight transport-drop gap this PR left open in pkg/datastore/target/netconf/nc.go (the three call sites that still detected drops via a fragile strings.Contains(err.Error(), "EOF") and returned the raw, unwrapped error instead of ErrNotConnected).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants