Skip to content

nodestore: an absent node is ErrNodeNotExists and nothing else - #27

Merged
CMGS merged 1 commit into
masterfrom
fix/nodestore-absent
Sep 29, 2026
Merged

CMGS merged 1 commit into
masterfrom
fix/nodestore-absent

Conversation

@CMGS

@CMGS CMGS commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

This is the resource-extend side of the not-found cleanup started in projecteru2/core#756 and projecteru2/core#757.

Two problems fixed

  • Store.Get reads one exact etcd key without WithPrefix. etcd answers that read with at most one match, so default: ErrInvaildCount was unreachable. Get now has two outcomes: zero matches returns ErrNodeNotExists, and one match returns the decoded value.
  • CheckAbsent treated ErrInvaildCount as "absent". If that branch had ever fired, it would have hidden an inconsistency behind a green node add. CheckAbsent now accepts only ErrNodeNotExists.

Dependencies

  • nodestore never depended on core's GetOne errors, because it uses the raw etcd client. No core bump is needed.
  • go.etcd.io/etcd/api/v3 moves from indirect to direct at the same version, because the new test builds mvccpb.KeyValue.

Tests
This adds the package's first tests. TestGetAndCheckAbsent uses a fake KV and covers three cases for both Get and CheckAbsent: node absent, node present, and a store error that propagates.

Gates, all run with GOWORK=off:

  • make fmt-check passes.
  • make lint reports 0 issues on linux and darwin.
  • asl is clean on linux and darwin.
  • make test and make build pass.

Get on one exact etcd key matches at most one entry, so the ErrInvaildCount branch was unreachable, and CheckAbsent treating ErrInvaildCount as absent would have hidden a real inconsistency had it ever fired. Adds the package's first tests (absent, present, store error).
@CMGS
CMGS merged commit ae1c791 into master Sep 29, 2026
2 checks passed
@CMGS
CMGS deleted the fix/nodestore-absent branch September 29, 2026 07:39
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.

1 participant