Skip to content

feat(api): add pkg/api domain types, sentinels, IsRetryable, canonical datastore hash - #534

Open
steiler wants to merge 8 commits into
mainfrom
feat/api-types
Open

steiler wants to merge 8 commits into
mainfrom
feat/api-types

Conversation

@steiler

@steiler steiler commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

PR A of the single-binary stack (ticket 01).

Adds the types-only pkg/api package (no gRPC or internals imports):

  • Domain types: DatastoreSpec, DatastoreInfo, TxRef, Intent/Update/Delete, Origin, Format, schema admin types, DeviationEvent
  • Error sentinels and api.IsRetryable
  • ComputeCreateDSHash over a canonical form of DatastoreSpec

Additive only; nothing imports the package yet and the standalone server is unchanged.

Notes:

  • The hash differs from the controller's current protojson hash, so existing datastores are recreated once when the controller switches over.
  • Sentinels are not yet wired to datastore.ErrDatastoreLocked / targettypes.ErrNotConnected; that comes with the core constructor PR.

Tests: go test ./pkg/api covers IsRetryable, errors.Is matching and hash stability, including a check that every spec field changes the hash.

@steiler
steiler requested a review from a team as a code owner November 6, 2026 13:55
@steiler
steiler added this pull request to stack #536 November 6, 2026 14:11
@steiler
steiler removed this pull request from stack #536 November 11, 2026 10:52
@steiler
steiler added this pull request to stack #544 November 11, 2026 10:52
… ComputeCreateDSHash

Signed-off-by: Markus Vahlenkamp <markus.vahlenkamp@nokia.com>
…ash presence checks

Signed-off-by: Markus Vahlenkamp <markus.vahlenkamp@nokia.com>
Signed-off-by: Markus Vahlenkamp <markus.vahlenkamp@nokia.com>
Remove Sync.Validate, Buffer and WriteWorkers: nothing read them, and
validation runs per transaction on the tree. Drop the unused
ComputeCreateDSHash. Add api.GNMIEncoding; unknown or numeric encodings
are rejected and a gNMI sync without an encoding inherits the target's.

go.mod temporarily replaces sdc-protos with the commit that reserves the
removed Sync fields.

Signed-off-by: Markus Vahlenkamp <markus.vahlenkamp@nokia.com>
config-server hashes the resolved DatastoreSpec plus referenced object
versions to decide when to recreate a datastore. Restore it without the
removed Sync fields and with the typed gNMI encoding, and document why the
hash is defined over DatastoreSpec.

Signed-off-by: Markus Vahlenkamp <markus.vahlenkamp@nokia.com>
Replace the Entries slice with Path, Expected and Current to match the
per-deviation WatchDeviationResponse, drop DeviationEntry and document
DeviationReasonIntentExists as an intent marker rather than a reason.

Signed-off-by: Markus Vahlenkamp <markus.vahlenkamp@nokia.com>
Only config-server compares datastore hashes to decide when to recreate a
datastore, and its extra inputs are Kubernetes resource versions. The data
server never computes or compares a hash, so it does not belong in pkg/api.

Signed-off-by: Markus Vahlenkamp <markus.vahlenkamp@nokia.com>
CONFIG is sent as gNMI encoding 45. The typed encoding rejects numeric
values, so name it explicitly and resolve it in the gNMI encoding parsers.

Signed-off-by: Markus Vahlenkamp <markus.vahlenkamp@nokia.com>
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.74359% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/config/datastore.go 80.95% 2 Missing and 2 partials ⚠️

📢 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.

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