Skip to content

Close the lease-client gaps the port reviews found - #194

Merged
bpapillon merged 20 commits into
mainfrom
bpapillon/sch-7530-lease-client-gaps-found-in-the-port-reviews-that-node-go-and
Sep 20, 2026
Merged

bpapillon merged 20 commits into
mainfrom
bpapillon/sch-7530-lease-client-gaps-found-in-the-port-reviews-that-node-go-and

Conversation

@bpapillon

Copy link
Copy Markdown
Contributor

Fixes the gaps the Ruby, Java and C# port reviews found that Node shares (SCH-7530), plus two decisions from those reviews.

  • Re-read the lease after winning the extend flight, so a stale row cannot send a second extend.
  • Write the reservation hash and its TTL in one MULTI, so a crash between them cannot leave an untracked hash.
  • Feed a preflight set on the evaluation context to the local engine, not only to the REST body.
  • Bound the local lease release by the remaining shutdown budget.
  • Round a fractional preflight quantity up at the WASM boundary; the engine rejects floats there.
  • Round the hold and the settle debit up to whole event units, so the local ledger moves by exactly what the track event bills. This changes SPEC.md and adds fractional-usage.json; every SDK copies both.
  • Resolve company keys through the cache first and only fall back to a comp_-prefixed value as the Schematic id, the order the server uses.

Go and Python legs follow this shape.

@bpapillon
bpapillon requested a review from a team as a code owner September 18, 2026 17:31
checkFlagWithEntitlement built getDefault for the offline, API and error
branches but the datastream branch reached past it to the registered
default, so defaultValue was ignored on exactly the path that answers
most checks. Found reviewing the ruby port of this work
(schematic-ruby #65).
The expiry index is what the sweeper reaches a surviving byCredit field
through, so removing it first and then failing on the field orphans that
field: nothing points at it any more and reservedCredits reads high for
that tenant forever. Swapping the order leaves the recoverable failure
instead, since a surviving index entry is swept.

Found reviewing the Java port (schematic-java#109), whose store already
does it in this order; schematic-go does too.
check-and-reserve sized the server's hold from the raw quantity while the
settling track event bills ceil(actual), so a fractional usage held less
than it billed -- the same drift the local lease path rounds up to avoid,
just on the server's ledger. Round the quantity and the preflight that
rides with it, in buildPreflightOptions so every consumer of that
envelope asks the same whole-unit question.
Options naming usage own the usage/eventUsage pair, but a zero was
dropped before that ownership was recorded, so `usage: 0` fell through to
whatever the evaluation context carried: a caller pricing an action at
nothing got the context's hypothetical instead. Record the pair as named
even when every knob in it is dropped, and build the request body from
the merge rather than passing the context through, so a preflight the
merge rejected cannot ride along on it.
The joiner's deadline was minted when the extend was reached, so a check
could spend its whole timeout on the entity fetches and the engine probe
and then spend it again waiting on somebody else's extend. Anchor the
deadline at the top of the check and pass it down.
schematic-bot
schematic-bot previously approved these changes Sep 20, 2026
@bpapillon
bpapillon merged commit 0c54691 into main Sep 20, 2026
7 checks passed
@bpapillon
bpapillon deleted the bpapillon/sch-7530-lease-client-gaps-found-in-the-port-reviews-that-node-go-and branch September 20, 2026 06:04
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.

2 participants