Skip to content

stamp rotation-created escrows with the gateway protocol version#1454

Merged
DimaOrekhovPS merged 2 commits into
upgrade-v0.2.14from
do/fix-rotation-escrow-protocol-version
Jul 15, 2026
Merged

stamp rotation-created escrows with the gateway protocol version#1454
DimaOrekhovPS merged 2 commits into
upgrade-v0.2.14from
do/fix-rotation-escrow-protocol-version

Conversation

@DimaOrekhovPS

Copy link
Copy Markdown
Collaborator

Escrows minted by the auto-rotator (and depletion replacement) were persisted without a protocol version, which defaults to v1 — so any gateway with rotation enabled drifted back to v1 escrows regardless of the protocol its escrows were registered with.

Derive the protocol for rotation-created escrows from the gateway-wide route prefix (DEVSHARD_ROUTE_PREFIX / build version): a gateway serving /devshard/v3 now mints protocol-v3 escrows. The protocol is frozen into the write-ahead commitment record (with a sqlite column migration) so escrows recovered via reconcile keep it. Unparseable route versions fall back to the previous v1-default behavior.

…rsion

Escrows minted by the auto-rotator (and depletion replacement) were
persisted without a protocol version, which defaults to v1 — so any
gateway with rotation enabled drifted back to v1 escrows regardless of
the protocol its escrows were registered with.

Derive the protocol for rotation-created escrows from the gateway-wide
route prefix (DEVSHARD_ROUTE_PREFIX / build version): a gateway serving
/devshard/v3 now mints protocol-v3 escrows. The protocol is frozen into
the write-ahead commitment record (with a sqlite column migration) so
escrows recovered via reconcile keep it. Unparseable route versions fall
back to the previous v1-default behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>

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.

Pull request overview

Fixes protocol-version drift for rotation/depletion-created escrows by deriving a protocol version from the gateway route prefix and persisting it in the escrow rotation commitment record so reconcile can recover the correct protocol.

Changes:

  • Adds protocol_version to the escrow_rotation_commitments SQLite table and round-trips it through save/load.
  • Stamps rotation-created escrows with a derived ProtocolVersion during persist and during commitment reconciliation.
  • Adds tests covering protocol propagation from DEVSHARD_ROUTE_PREFIX and commitment recovery.

Reviewed changes

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

File Description
devshard/cmd/devshardctl/gateway_store.go Migrates commitments table and persists/loads protocol_version with each write-ahead commitment.
devshard/cmd/devshardctl/escrow_rotator.go Derives a protocol version from the gateway route prefix and carries it through creation, persistence, and reconcile.
devshard/cmd/devshardctl/escrow_recovery_test.go Adds coverage asserting protocol version propagation via direct persist and via commitment recovery.

Comment on lines +390 to +398
_, version, err := devshardpkg.ResolveRoutePrefix(routePrefix)
if err != nil {
return ""
}
pv, err := types.ParseProtocolVersion(version)
if err != nil {
return ""
}
return string(pv)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least logging at warn level should be added if version couldn't be parsed

@tcharchian tcharchian added this to the v0.2.14 milestone Jul 14, 2026
Warn-log each fallback path in rotationEscrowProtocolVersion instead of
silently defaulting, and map semver-like route versions by their major
component (v2.1.0 -> v2) so semver-named runtimes still get a protocol
stamp.

Co-authored-by: Cursor <cursoragent@cursor.com>

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.

Pull request overview

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

Comment thread devshard/cmd/devshardctl/escrow_rotator.go
Comment thread devshard/cmd/devshardctl/escrow_recovery_test.go
Comment thread devshard/cmd/devshardctl/escrow_rotator.go
@DimaOrekhovPS
DimaOrekhovPS enabled auto-merge (squash) July 15, 2026 15:48
@DimaOrekhovPS
DimaOrekhovPS merged commit ebb4011 into upgrade-v0.2.14 Jul 15, 2026
7 checks passed
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.

4 participants