~/bend-docscommunity

LAWS.bend open laws/TODOs

raw source on the hub · import bend-kube-runtime@0.6.0.0/LAWS.bend as LAWS

14 imports
import Base
import ./src/json.bend as J
import ./src/core.bend as C
import ./src/watcher.bend as W
import ./src/store.bend as S
import ./src/queue.bend as Q
import ./src/finalizer.bend as F
import ./src/http.bend as H
import ./src/utf8.bend as U
import ./src/proxy.bend as P
import ./src/lease.bend as E
import ./src/control.bend as X
import ./src/cond.bend as Co
import ./src/config.bend as K

Laws

law watch_gone_relists provedin PROOF.bendsource · line 27 · raw

@rv:String -> @f:U32 -> @first:Bool -> @r:String -> @m:String -> {0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.step(0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{rv}, f, first}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.IEvent{0x341d8c21d651622b4e114e45f1f37703/src/core.WError{0x341d8c21d651622b4e114e45f1f37703/src/core.Status{410, r, m}}}) == 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WList{""}, f, True{}}, [], False{}} : 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step}

A watch that answers 410 Gone relists from scratch, at once.

law watch_request_gone_relists provedin PROOF.bendsource · line 37 · raw

@rv:String -> @f:U32 -> @first:Bool -> {0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.step(0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{rv}, f, first}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.IWatchErr{410}) == 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WList{""}, f, True{}}, [], False{}} : 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step}

So does a watch request the server refuses with 410.

law list_gone_relists provedin PROOF.bendsource · line 45 · raw

@c:String -> @f:U32 -> @first:Bool -> {0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.step(0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WList{c}, f, first}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.IListErr{410}) == 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WList{""}, f, True{}}, [], False{}} : 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step}

An expired continue token restarts the list from its first page.

law watch_error_backs_off provedin PROOF.bendsource · line 54 · raw

@rv:String -> @f:U32 -> @first:Bool -> {0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.step(0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{rv}, f, first}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.IWatchErr{500}) == 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{rv}, U32.add(f, 1), False{}}, [], True{}} : 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step}

A failed watch request (not 410) retries from the same version after a backoff, counting the failure.

law watch_end_resumes provedin PROOF.bendsource · line 63 · raw

@rv:String -> @f:U32 -> @first:Bool -> {0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.step(0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{rv}, f, first}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.IWatchEnd{}) == 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{rv}, 0, False{}}, [], False{}} : 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step}

A watch that ends (the server's timeout) resumes from the same version, with no backoff and no events.

law bookmark_advances provedin PROOF.bendsource · line 71 · raw

@rv:String -> @v:String -> @f:U32 -> @first:Bool -> {0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.step(0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{rv}, f, first}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.IEvent{0x341d8c21d651622b4e114e45f1f37703/src/core.WBookmark{v}}) == 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{v}, 0, False{}}, [], False{}} : 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step}

A bookmark moves the resume version and emits nothing.

law last_page_watches provedin PROOF.bendsource · line 81 · raw

@c:String -> @f:U32 -> @first:Bool -> @items:List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json> -> @rv:String -> {0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.step(0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WList{c}, f, first}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.IPage{0x341d8c21d651622b4e114e45f1f37703/src/core.Page{items, rv, ""}}) == 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WState{0x341d8c21d651622b4e114e45f1f37703/src/watcher.WWatch{rv}, 0, True{}}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.init_out(first, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.page_outs(items, [0x341d8c21d651622b4e114e45f1f37703/src/watcher.OInitDone{}])), False{}} : 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Step}

The last page of a list (no continue token) emits its objects, closes the relist with InitDone, and starts watching from the list's version.

law first_page_inits provedin PROOF.bendsource · line 92 · raw

@items:List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json> -> {0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.init_out(True{}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.page_outs(items, [])) == 0x341d8c21d651622b4e114e45f1f37703/src/watcher.OInit{} <> 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Watcher.page_outs(items, []) : List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Out>}

The first page of a relist opens it with Init.

law watch_backoff_capped provedin PROOF.bendsource · line 98 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/watcher.Backoff.delay(6) == 30000 : U32}

The watcher's backoff never exceeds 30s, however many failures.

law init_clears_buffer provedin PROOF.bendsource · line 105 · raw

@objs:Map<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json> -> @buf:Map<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json> -> @r:Bool -> {0x341d8c21d651622b4e114e45f1f37703/src/store.Store.apply(0x341d8c21d651622b4e114e45f1f37703/src/store.Store{objs, buf, r}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.OInit{}) == 0x341d8c21d651622b4e114e45f1f37703/src/store.Store{objs, Map.new(&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json), r} : 0x341d8c21d651622b4e114e45f1f37703/src/store.Store}

A relist starts from an empty buffer, whatever the store held.

law init_done_swaps provedin PROOF.bendsource · line 114 · raw

@objs:Map<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json> -> @buf:Map<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json> -> @r:Bool -> {0x341d8c21d651622b4e114e45f1f37703/src/store.Store.apply(0x341d8c21d651622b4e114e45f1f37703/src/store.Store{objs, buf, r}, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.OInitDone{}) == 0x341d8c21d651622b4e114e45f1f37703/src/store.Store{buf, Map.new(&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json), True{}} : 0x341d8c21d651622b4e114e45f1f37703/src/store.Store}

InitDone swaps the relisted buffer in whole: objects absent from the relist leave the store, and the store is ready.

law add_running_marks_dirty provedin PROOF.bendsource · line 126 · raw

@f:List<&2, String> -> @b:List<&2, String> -> @inq:Map<&2, U32> -> @run:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @n:U32 -> @mx:U32 -> @key:String -> @running:{0x341d8c21d651622b4e114e45f1f37703/src/queue.Mp.has(run, key) == True{} : Bool} -> {0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue.add(0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue{f, b, inq, run, d, g, fl, n, mx}, key) == 0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue{f, b, inq, run, 0x341d8c21d651622b4e114e45f1f37703/src/queue.Mp.on(d, key), 0x341d8c21d651622b4e114e45f1f37703/src/queue.Mp.bump(g, key), fl, n, mx} : 0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue}

Adding a key that is running does not queue it a second time: it is marked dirty, to run again when the current run ends.

law add_waiting_dedups provedin PROOF.bendsource · line 142 · raw

@f:List<&2, String> -> @b:List<&2, String> -> @inq:Map<&2, U32> -> @run:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @n:U32 -> @mx:U32 -> @key:String -> @idle:{0x341d8c21d651622b4e114e45f1f37703/src/queue.Mp.has(run, key) == False{} : Bool} -> @waiting:{0x341d8c21d651622b4e114e45f1f37703/src/queue.Mp.has(inq, key) == True{} : Bool} -> {0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue.add(0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue{f, b, inq, run, d, g, fl, n, mx}, key) == 0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue{f, b, inq, run, d, 0x341d8c21d651622b4e114e45f1f37703/src/queue.Mp.bump(g, key), fl, n, mx} : 0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue}

Adding a key that already waits changes nothing but its timer.

law pop_respects_limit provedin PROOF.bendsource · line 159 · raw

@f:List<&2, String> -> @b:List<&2, String> -> @inq:Map<&2, U32> -> @run:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @n:U32 -> @mx:U32 -> @full:{U32.is_lt(n, mx) == False{} : Bool} -> {0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue.pop(0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue{f, b, inq, run, d, g, fl, n, mx}) == (0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue{f, b, inq, run, d, g, fl, n, mx}, None{}) : Pair(0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue, Maybe<&2, String>)}

No key starts while every worker slot is taken.

law retry_backoff_capped provedin PROOF.bendsource · line 174 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue.backoff(18) == 1000000 : U32}

A failing key backs off for at most 1000s.

law done_idle_noop provedin PROOF.bendsource · line 178 · raw

@q:0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue -> @key:String -> @a:0x341d8c21d651622b4e114e45f1f37703/src/queue.Action -> @idle:{0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue.running(q, key) == False{} : Bool} -> {0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue.done(q, key, a) == (q, []) : Pair(0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue, List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/queue.Timer>)}

Finishing a key that is not running changes nothing and arms no timer.

law forget_running_keeps provedin PROOF.bendsource · line 186 · raw

@q:0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue -> @key:String -> @running:{0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue.running(q, key) == True{} : Bool} -> {0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue.forget(q, key) == q : 0x341d8c21d651622b4e114e45f1f37703/src/queue.Queue}

Forgetting never disturbs a key that is running.

law fin_live_applies provedin PROOF.bendsource · line 196 · raw

@fs:List<&2, String> -> @name:String -> @i:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/finalizer.Fin.state.go(fs, name, Some{i}, False{}) == 0x341d8c21d651622b4e114e45f1f37703/src/finalizer.FApply{} : 0x341d8c21d651622b4e114e45f1f37703/src/finalizer.FState}

A live object that carries our finalizer is applied.

law fin_gone_done provedin PROOF.bendsource · line 203 · raw

@fs:List<&2, String> -> @name:String -> {0x341d8c21d651622b4e114e45f1f37703/src/finalizer.Fin.state.go(fs, name, None{}, True{}) == 0x341d8c21d651622b4e114e45f1f37703/src/finalizer.FDone{} : 0x341d8c21d651622b4e114e45f1f37703/src/finalizer.FState}

A deleted object that no longer carries it needs nothing more.

law fin_cleanup_tests provedin PROOF.bendsource · line 210 · raw

@fs:List<&2, String> -> @name:String -> @i:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/finalizer.Fin.state.go(fs, name, Some{i}, True{}) == 0x341d8c21d651622b4e114e45f1f37703/src/finalizer.FCleanup{0x341d8c21d651622b4e114e45f1f37703/src/finalizer.Fin.remove_patch(i, name)} : 0x341d8c21d651622b4e114e45f1f37703/src/finalizer.FState}

A deleted object that still carries it is cleaned up, and the finalizer is removed only through a patch that tests it is still ours, at its index.

law fin_failed_cleanup_keeps provedin PROOF.bendsource · line 218 · raw

@m:String -> {0x341d8c21d651622b4e114e45f1f37703/src/finalizer.Fin.keeps(0x341d8c21d651622b4e114e45f1f37703/src/queue.Retry{m}) == True{} : Bool}

A cleanup that failed, or that holds (waiting on something outside), keeps the finalizer, so the object is not deleted before cleanup is done.

law fin_held_cleanup_keeps provedin PROOF.bendsource · line 222 · raw

@ms:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/finalizer.Fin.keeps(0x341d8c21d651622b4e114e45f1f37703/src/queue.Hold{ms}) == True{} : Bool}

law fin_done_cleanup_releases provedin PROOF.bendsource · line 227 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/finalizer.Fin.keeps(0x341d8c21d651622b4e114e45f1f37703/src/queue.AwaitChange{}) == False{} : Bool}

A finished cleanup lets the finalizer go.

law eof_before_response_is_lost provedin PROOF.bendsource · line 235 · raw

@t:U32 -> @h:Maybe<&2, 0x341d8c21d651622b4e114e45f1f37703/src/http.Head> -> @o:List<&2, U32> -> {0x341d8c21d651622b4e114e45f1f37703/src/http.Http.eof(0x341d8c21d651622b4e114e45f1f37703/src/http.Resp{0x341d8c21d651622b4e114e45f1f37703/src/http.PHead{[], t}, h, o}) == 0x341d8c21d651622b4e114e45f1f37703/src/http.Resp{0x341d8c21d651622b4e114e45f1f37703/src/http.PLost{"connection closed before a response"}, h, o} : 0x341d8c21d651622b4e114e45f1f37703/src/http.Resp}

A connection that ends before any byte of a response is lost, not broken: only then may a request on a reused connection be retried.

law eof_mid_response_is_broken provedin PROOF.bendsource · line 243 · raw

@b:U32 -> @bs:List<&2, U32> -> @t:U32 -> @h:Maybe<&2, 0x341d8c21d651622b4e114e45f1f37703/src/http.Head> -> @o:List<&2, U32> -> {0x341d8c21d651622b4e114e45f1f37703/src/http.Http.eof(0x341d8c21d651622b4e114e45f1f37703/src/http.Resp{0x341d8c21d651622b4e114e45f1f37703/src/http.PHead{b <> bs, t}, h, o}) == 0x341d8c21d651622b4e114e45f1f37703/src/http.Resp{0x341d8c21d651622b4e114e45f1f37703/src/http.PErr{"connection closed mid-response"}, h, o} : 0x341d8c21d651622b4e114e45f1f37703/src/http.Resp}

Bytes of a response make an early end a broken response, never retried.

law proxy_skips_localhost provedin PROOF.bendsource · line 257 · raw

@url:String -> @no:String -> @port:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy.route(url, no, "localhost", port) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Direct{} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Route}

localhost and loopback addresses never go through a proxy, whatever HTTPS_PROXY and NO_PROXY say.

law proxy_skips_loopback provedin PROOF.bendsource · line 263 · raw

@url:String -> @no:String -> @port:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy.route(url, no, "127.0.0.1", port) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Direct{} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Route}

law no_proxy_star_bypasses provedin PROOF.bendsource · line 270 · raw

@url:String -> @port:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy.route(url, "*", "api.example.com", port) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Direct{} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Route}

NO_PROXY=* sends every host around the proxy.

law no_proxy_url_is_direct provedin PROOF.bendsource · line 276 · raw

@port:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy.route("", "", "api.example.com", port) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Direct{} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Route}

Without HTTPS_PROXY, connections are direct.

law unsupported_proxy_fails provedin PROOF.bendsource · line 282 · raw

@port:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy.route("socks5://proxy:1080", "", "api.example.com", port) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.NoRoute{"HTTPS_PROXY: only http:// proxies are supported"} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Route}

A proxy bend-kube cannot speak fails the connection: it never falls back to connecting directly.

law no_proxy_dot_is_subdomains_only provedin PROOF.bendsource · line 288 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy.route("http://proxy:3128", ".corp", "corp", 443) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Via{0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy{"proxy", 3128, ""}} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Route}

".corp" bypasses the subdomains of corp, not corp itself.

law no_proxy_respects_labels provedin PROOF.bendsource · line 294 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy.route("http://proxy:3128", "corp", "evilcorp", 443) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Via{0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy{"proxy", 3128, ""}} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Route}

"corp" bypasses corp and its subdomains, never a name that merely ends in the same letters.

law no_proxy_port_narrows provedin PROOF.bendsource · line 299 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy.route("http://proxy:3128", "api.corp:6443", "api.corp", 443) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Via{0x341d8c21d651622b4e114e45f1f37703/src/proxy.Proxy{"proxy", 3128, ""}} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Route}

An entry with a port bypasses only that port.

law tunnel_needs_200 provedin PROOF.bendsource · line 304 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/proxy.Tunnel.feed(0x341d8c21d651622b4e114e45f1f37703/src/proxy.Tunnel.init, 0x341d8c21d651622b4e114e45f1f37703/src/utf8.Utf8.encode("HTTP/1.1 407 Proxy Authentication Required\r\n\r\n")) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.TFail{"proxy refused CONNECT: HTTP/1.1 407 Proxy Authentication Required"} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Tunnel}

Only a 200 opens the tunnel; any other answer fails it, quoted.

law tunnel_rejects_early_bytes provedin PROOF.bendsource · line 311 · raw

@b:U32 -> @bs:List<&2, U32> -> {0x341d8c21d651622b4e114e45f1f37703/src/proxy.Tunnel.feed(0x341d8c21d651622b4e114e45f1f37703/src/proxy.Tunnel.init, List.append(&2, U32, 0x341d8c21d651622b4e114e45f1f37703/src/utf8.Utf8.encode("HTTP/1.1 200 OK\r\n\r\n"), b <> bs)) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.TFail{"proxy sent bytes before the TLS handshake"} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Tunnel}

Bytes after the proxy's answer, before we spoke TLS, fail the tunnel: nothing the proxy says may become part of the TLS stream.

law tunnel_end_before_answer provedin PROOF.bendsource · line 319 · raw

@h:List<&2, U32> -> {0x341d8c21d651622b4e114e45f1f37703/src/proxy.Tunnel.feed(0x341d8c21d651622b4e114e45f1f37703/src/proxy.TMore{h}, []) == 0x341d8c21d651622b4e114e45f1f37703/src/proxy.TFail{"proxy closed the connection before answering CONNECT"} : 0x341d8c21d651622b4e114e45f1f37703/src/proxy.Tunnel}

A proxy that hangs up before its answer is whole fails the tunnel.

law filter_none_passes provedin PROOF.bendsource · line 335 · raw

@old:Maybe<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json> -> @new:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Pred.passes([], old, new) == True{} : Bool}

Without predicates, every change reconciles.

law filter_uncached_passes provedin PROOF.bendsource · line 341 · raw

@p:0x341d8c21d651622b4e114e45f1f37703/src/control.Pred -> @ps:List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/control.Pred> -> @new:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Pred.passes(p <> ps, None{}, new) == True{} : Bool}

With predicates, an object the cache has not seen always reconciles.

law filter_same_generation_skips provedin PROOF.bendsource · line 350 · raw

@r1:String -> @r2:String -> @a:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @b:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Pred.passes([0x341d8c21d651622b4e114e45f1f37703/src/control.PGeneration{}], Some{Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"3"}, r1, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, a)}, Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"3"}, r2, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, b)) == False{} : Bool}

Under the generation predicate, a change that leaves the generation alone (a status write, whatever its version) does not reconcile: a controller's own status updates do not wake it.

law filter_generation_passes provedin PROOF.bendsource · line 359 · raw

@r1:String -> @r2:String -> @a:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @b:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Pred.passes([0x341d8c21d651622b4e114e45f1f37703/src/control.PGeneration{}], Some{Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"3"}, r1, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, a)}, Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"4"}, r2, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, b)) == True{} : Bool}

A new generation (a spec change) reconciles.

law filter_deletion_passes provedin PROOF.bendsource · line 369 · raw

@r1:String -> @r2:String -> @a:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @b:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @t:String -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Pred.passes([0x341d8c21d651622b4e114e45f1f37703/src/control.PGeneration{}], Some{Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"3"}, r1, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, a)}, Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"3"}, r2, 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{t}, b)) == True{} : Bool}

The start of a deletion reconciles, whatever the predicates, so a finalizer is never missed.

law filter_no_generation_passes provedin PROOF.bendsource · line 379 · raw

@a:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @b:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Pred.passes([0x341d8c21d651622b4e114e45f1f37703/src/control.PGeneration{}], Some{Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, "1", 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, a)}, Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, "2", 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, b)) == True{} : Bool}

An object without a generation (a ConfigMap) reconciles on every change.

law fold_apply_triggers provedin PROOF.bendsource · line 386 · raw

@x:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @s:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> @ks:List<&2, String> -> @g:List<&2, String> -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Fold.prim([], [0x341d8c21d651622b4e114e45f1f37703/src/watcher.OApply{x}], 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold{s, ks, g}) == 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold{0x341d8c21d651622b4e114e45f1f37703/src/store.Store.apply(s, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.OApply{x}), 0x341d8c21d651622b4e114e45f1f37703/src/core.Obj.key(x) <> ks, g} : 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold}

Without predicates, an applied primary is cached and reconciles.

law fold_delete_forgets provedin PROOF.bendsource · line 395 · raw

@ps:List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/control.Pred> -> @x:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @s:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> @ks:List<&2, String> -> @g:List<&2, String> -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Fold.prim(ps, [0x341d8c21d651622b4e114e45f1f37703/src/watcher.ODelete{x}], 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold{s, ks, g}) == 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold{0x341d8c21d651622b4e114e45f1f37703/src/store.Store.apply(s, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.ODelete{x}), ks, 0x341d8c21d651622b4e114e45f1f37703/src/core.Obj.key(x) <> g} : 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold}

A deleted primary leaves the cache, reconciles nothing, and is forgotten.

law owner_triggers_owner provedin PROOF.bendsource · line 406 · raw

@prim:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Rel.keys(0x341d8c21d651622b4e114e45f1f37703/src/control.ROwner{}, 0x341d8c21d651622b4e114e45f1f37703/src/core.Res{"bend-kube.dev", "v1alpha1", "Website", "websites", True{}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"metadata", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"w-web"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"namespace", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"default"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"ownerReferences", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.arr([0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"apiVersion", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"bend-kube.dev/v1alpha1"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"kind", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"Website"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"w"}}])])}])}]), prim) == ["default/w"] : List<&2, String>}

An owned object reconciles the owner it names of the primary's kind and API group, in its own namespace (kube-runtime's trigger_owners).

law owner_triggers_cluster_owner provedin PROOF.bendsource · line 418 · raw

@prim:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Rel.keys(0x341d8c21d651622b4e114e45f1f37703/src/control.ROwner{}, 0x341d8c21d651622b4e114e45f1f37703/src/core.Res{"bend-kube.dev", "v1", "Tenant", "tenants", False{}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"metadata", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"quota"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"namespace", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"team-a"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"ownerReferences", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.arr([0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"apiVersion", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"bend-kube.dev/v1"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"kind", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"Tenant"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"a"}}])])}])}]), prim) == ["a"] : List<&2, String>}

A cluster-scoped primary is named by its owned objects without their namespace, so a namespaced child reconciles it.

law owner_needs_group provedin PROOF.bendsource · line 429 · raw

@prim:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Rel.keys(0x341d8c21d651622b4e114e45f1f37703/src/control.ROwner{}, 0x341d8c21d651622b4e114e45f1f37703/src/core.Res{"bend-kube.dev", "v1alpha1", "Website", "websites", True{}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"metadata", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"w-web"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"namespace", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"default"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"ownerReferences", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.arr([0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"apiVersion", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"other.io/v1"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"kind", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"Website"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"w"}}])])}])}]), prim) == [] : List<&2, String>}

An owner of the same kind in another API group is not the primary.

law filter_finalizer_passes provedin PROOF.bendsource · line 441 · raw

@r1:String -> @r2:String -> @a:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @b:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @f:String -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Pred.passes([0x341d8c21d651622b4e114e45f1f37703/src/control.PGeneration{}], Some{Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"3"}, r1, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, a)}, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.set(Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"3"}, r2, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, b), "metadata", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.set(0x341d8c21d651622b4e114e45f1f37703/src/json.Json.get(Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"3"}, r2, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, b), "metadata"), "finalizers", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.arr([0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{f}])))) == True{} : Bool}

Under any predicate, a change of finalizers (one added, as a finalizer helper does before waiting for the change) reconciles.

law lease_live_is_held provedin PROOF.bendsource · line 462 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.held(Ex.lease("a"), "b", 0x341d8c21d651622b4e114e45f1f37703/src/lease.Obs{"a", "r", 100000}, 101000, 15) == True{} : Bool}

Another holder's lease, last seen changing 1s ago (15s duration), is live: we wait.

law lease_clock_step_is_held provedin PROOF.bendsource · line 466 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.held(Ex.lease("a"), "b", 0x341d8c21d651622b4e114e45f1f37703/src/lease.Obs{"a", "r", 100000}, 99000, 15) == True{} : Bool}

Our clock stepping back 1s does not make it expire.

law lease_expired_is_taken provedin PROOF.bendsource · line 470 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.held(Ex.lease("a"), "b", 0x341d8c21d651622b4e114e45f1f37703/src/lease.Obs{"a", "r", 100000}, 115001, 15) == False{} : Bool}

Seen unchanged for longer than its duration, it has expired: we may take it.

law lease_ours_renews provedin PROOF.bendsource · line 474 · raw

@at:U32 -> @now:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.held(Ex.lease("b"), "b", 0x341d8c21d651622b4e114e45f1f37703/src/lease.Obs{"b", "r", at}, now, 15) == False{} : Bool}

Our own lease is never held against us: we renew it.

law lease_released_is_free provedin PROOF.bendsource · line 480 · raw

@at:U32 -> @now:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.held(Ex.lease(""), "b", 0x341d8c21d651622b4e114e45f1f37703/src/lease.Obs{"", "r", at}, now, 15) == False{} : Bool}

A released lease (no holder) is free at once.

law lease_holder_duration_rules provedin PROOF.bendsource · line 488 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.held(0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"spec", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"holderIdentity", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"a"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"renewTime", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"r"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"leaseDurationSeconds", 0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"30"}}])}]), "b", 0x341d8c21d651622b4e114e45f1f37703/src/lease.Obs{"a", "r", 100000}, 120000, 15) == True{} : Bool}

A held Lease lasts its holder's own duration (spec.leaseDurationSeconds), however short the contender's: 20s after its last change, a 30s lease is still live for a contender configured with 15s.

law filter_new_uid_passes provedin PROOF.bendsource · line 495 · raw

@r1:String -> @r2:String -> @a:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @b:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Pred.passes([0x341d8c21d651622b4e114e45f1f37703/src/control.PGeneration{}], Some{0x341d8c21d651622b4e114e45f1f37703/src/json.Json.set(Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"1"}, r1, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, a), "metadata", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.set(0x341d8c21d651622b4e114e45f1f37703/src/json.Json.get(Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"1"}, r1, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, a), "metadata"), "uid", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"u1"}))}, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.set(Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"1"}, r2, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, b), "metadata", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.set(0x341d8c21d651622b4e114e45f1f37703/src/json.Json.get(Ex.obj(0x341d8c21d651622b4e114e45f1f37703/src/json.JNum{"1"}, r2, 0x341d8c21d651622b4e114e45f1f37703/src/json.JNull{}, b), "metadata"), "uid", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"u2"}))) == True{} : Bool}

An object deleted and recreated under the same name (a new uid) passes the generation predicate even at the same generation.

law lease_default_timing_ok provedin PROOF.bendsource · line 509 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.timing(15, 10000, 2000) == None{} : Maybe<&2, String>}

The default election timing (15s lease, 10s renew deadline, 2s retry) is accepted; a lease no longer than its renew deadline is refused.

law lease_short_lease_refused provedin PROOF.bendsource · line 512 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.timing(5, 10000, 2000) == Some{"leader election: the lease duration must exceed the renew deadline by at least a second"} : Maybe<&2, String>}

law lease_thin_margin_refused provedin PROOF.bendsource · line 518 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.timing(15, 14500, 2000) == Some{"leader election: the lease duration must exceed the renew deadline by at least a second"} : Maybe<&2, String>}

A lease that outlasts its deadline by less than a second leaves too little slack between a leader stopping and a standby starting: refused.

law leader_late_at_deadline provedin PROOF.bendsource · line 525 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.late(10000, 0, 10000) == True{} : Bool}

A leader is late from the moment its renew deadline is reached, and it never sleeps past it: after 9.9s of a 10s deadline it naps at most 0.1s, however long its retry period.

law leader_nap_bounded provedin PROOF.bendsource · line 528 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.nap(9900, 0, 10000, 2000, True{}) == 100 : U32}

law acquisition_overdue_stops provedin PROOF.bendsource · line 534 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.overdue(2600, 0, 100, 2400, False{}) == True{} : Bool}

A candidate whose winning write lands past the renew deadline, counted from the start of that attempt, must not start: 2.5s after an attempt begun at 0.1s, with a 2.4s deadline, it is overdue.

law renewal_overdue_from_last provedin PROOF.bendsource · line 538 · raw

{0x341d8c21d651622b4e114e45f1f37703/src/lease.Lease.overdue(10000, 0, 9000, 10000, True{}) == True{} : Bool}

A leader counts from its last renewal, however recent the attempt.

law cond_same_status_keeps_time provedin PROOF.bendsource · line 545 · raw

@r1:String -> @m1:String -> @t0:String -> @r2:String -> @m2:String -> @g:String -> @now:String -> {0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.get(0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.set([0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.make("Ready", "True", r1, m1, "1", t0)], 0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.make("Ready", "True", r2, m2, "2", now)), "Ready") == Some{0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.make("Ready", "True", r2, m2, "2", t0)} : Maybe<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json>}

Setting a condition whose status is unchanged keeps its transition time.

law cond_new_status_moves_time provedin PROOF.bendsource · line 558 · raw

@r1:String -> @m1:String -> @t0:String -> @r2:String -> @m2:String -> @now:String -> {0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.get(0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.set([0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.make("Ready", "False", r1, m1, "1", t0)], 0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.make("Ready", "True", r2, m2, "2", now)), "Ready") == Some{0x341d8c21d651622b4e114e45f1f37703/src/cond.Cond.make("Ready", "True", r2, m2, "2", now)} : Maybe<&2, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json>}

A changed status takes the new transition time.

law rel_unfiltered_is_rel provedin PROOF.bendsource · line 574 · raw

@r:0x341d8c21d651622b4e114e45f1f37703/src/control.Rel -> @res:0x341d8c21d651622b4e114e45f1f37703/src/core.Res -> @outs:List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/watcher.Out> -> @prim:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> @f:0x341d8c21d651622b4e114e45f1f37703/src/control.Fold -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Fold.rel_where(r, [], res, outs, prim, f) == 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold.rel(r, res, outs, prim, f) : 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold}

A related watch without predicates triggers on every change, as before watches had filters.

law rel_filter_keeps_deletions provedin PROOF.bendsource · line 584 · raw

@r:0x341d8c21d651622b4e114e45f1f37703/src/control.Rel -> @ps:List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/control.Pred> -> @res:0x341d8c21d651622b4e114e45f1f37703/src/core.Res -> @x:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @prim:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> @s:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> @ks:List<&2, String> -> @g:List<&2, String> -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Fold.rel_where(r, ps, res, [0x341d8c21d651622b4e114e45f1f37703/src/watcher.ODelete{x}], prim, 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold{s, ks, g}) == 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold.rel(r, res, [0x341d8c21d651622b4e114e45f1f37703/src/watcher.ODelete{x}], prim, 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold{s, ks, g}) : 0x341d8c21d651622b4e114e45f1f37703/src/control.Fold}

A deleted related object triggers its primaries, whatever the watch's predicates: a filter never hides a deletion.

law cluster_keeps_fence provedin PROOF.bendsource · line 598 · raw

@h:String -> @p:U32 -> @b:String -> @ca:0x341d8c21d651622b4e114e45f1f37703/src/config.Src -> @cert:0x341d8c21d651622b4e114e45f1f37703/src/config.Src -> @key:0x341d8c21d651622b4e114e45f1f37703/src/config.Src -> @tok:0x341d8c21d651622b4e114e45f1f37703/src/config.Src -> @ns:String -> @pl:Maybe<&2, Chan(Socket)> -> @lm:Maybe<&2, Chan(Unit)> -> @sn:String -> @fc:Maybe<&2, Chan(0x341d8c21d651622b4e114e45f1f37703/src/config.FenceMsg)> -> @main:0x341d8c21d651622b4e114e45f1f37703/src/config.Config -> {0x341d8c21d651622b4e114e45f1f37703/src/config.Config.fence(0x341d8c21d651622b4e114e45f1f37703/src/control.Cluster.of(main, Some{0x341d8c21d651622b4e114e45f1f37703/src/config.Config{h, p, b, ca, cert, key, tok, ns, pl, lm, sn, fc}})) == 0x341d8c21d651622b4e114e45f1f37703/src/config.Config.fence(main) : Maybe<&2, Chan(0x341d8c21d651622b4e114e45f1f37703/src/config.FenceMsg)>}

A watch on another cluster runs under the controllers' leadership fence: no request to any cluster outlives the lease.

law cluster_drops_pool provedin PROOF.bendsource · line 617 · raw

@a:0x341d8c21d651622b4e114e45f1f37703/src/core.Api -> @h:String -> @p:U32 -> @b:String -> @ca:0x341d8c21d651622b4e114e45f1f37703/src/config.Src -> @cert:0x341d8c21d651622b4e114e45f1f37703/src/config.Src -> @key:0x341d8c21d651622b4e114e45f1f37703/src/config.Src -> @tok:0x341d8c21d651622b4e114e45f1f37703/src/config.Src -> @ns:String -> @pl:Maybe<&2, Chan(Socket)> -> @lm:Maybe<&2, Chan(Unit)> -> @sn:String -> @fc:Maybe<&2, Chan(0x341d8c21d651622b4e114e45f1f37703/src/config.FenceMsg)> -> @main:0x341d8c21d651622b4e114e45f1f37703/src/config.Config -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.clusters(0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.on(0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.of(a), 0x341d8c21d651622b4e114e45f1f37703/src/config.Config{h, p, b, ca, cert, key, tok, ns, pl, lm, sn, fc}), main) == [0x341d8c21d651622b4e114e45f1f37703/src/config.Config{h, p, b, ca, cert, key, tok, ns, None{}, lm, sn, 0x341d8c21d651622b4e114e45f1f37703/src/config.Config.fence(main)}] : List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/config.Config>}

A primary on another cluster never borrows a connection pool: a pool holds connections to one server.

law cluster_default_is_main provedin PROOF.bendsource · line 636 · raw

@a:0x341d8c21d651622b4e114e45f1f37703/src/core.Api -> @main:0x341d8c21d651622b4e114e45f1f37703/src/config.Config -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.clusters(0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.of(a), main) == [main] : List<&2, 0x341d8c21d651622b4e114e45f1f37703/src/config.Config>}

Without a cluster of its own, every watch runs on the controllers' config.

law timeout_unset_takes_default provedin PROOF.bendsource · line 643 · raw

@a:0x341d8c21d651622b4e114e45f1f37703/src/core.Api -> @ms:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.timeout_or(0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.of(a), ms) == 0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.timeout(0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.of(a), ms) : 0x341d8c21d651622b4e114e45f1f37703/src/control.Spec}

A spec without its own reconcile timeout takes the manager's (Opts.with_timeout); with none set anywhere there is none.

law timeout_own_wins provedin PROOF.bendsource · line 649 · raw

@a:0x341d8c21d651622b4e114e45f1f37703/src/core.Api -> @d:U32 -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.timeout_or(0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.timeout(0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.of(a), 500), d) == 0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.timeout(0x341d8c21d651622b4e114e45f1f37703/src/control.Spec.of(a), 500) : 0x341d8c21d651622b4e114e45f1f37703/src/control.Spec}

A spec's own timeout wins over the manager's.

law annotated_triggers_named provedin PROOF.bendsource · line 657 · raw

@prim:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Rel.keys(0x341d8c21d651622b4e114e45f1f37703/src/control.RAnnotated{"src/ns", "src/name"}, 0x341d8c21d651622b4e114e45f1f37703/src/core.Res{"", "v1", "Service", "services", True{}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"metadata", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"web-x-default-x-vc"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"namespace", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"vc-host"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"annotations", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"src/ns", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"default"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"src/name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"web"}}])}])}]), prim) == ["default/web"] : List<&2, String>}

A copy in another namespace (or cluster) reconciles the primary its annotations name, in the namespace they name: a syncer's host object maps back to its virtual one (vcluster's object-namespace, object-name).

law annotated_needs_name provedin PROOF.bendsource · line 667 · raw

@prim:0x341d8c21d651622b4e114e45f1f37703/src/store.Store -> {0x341d8c21d651622b4e114e45f1f37703/src/control.Rel.keys(0x341d8c21d651622b4e114e45f1f37703/src/control.RAnnotated{"src/ns", "src/name"}, 0x341d8c21d651622b4e114e45f1f37703/src/core.Res{"", "v1", "Service", "services", True{}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"metadata", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"name", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"other"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"namespace", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"vc-host"}}, 0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"annotations", 0x341d8c21d651622b4e114e45f1f37703/src/json.Json.obj([0x341d8c21d651622b4e114e45f1f37703/src/json.KV{"src/ns", 0x341d8c21d651622b4e114e45f1f37703/src/json.JStr{"default"}}])}])}]), prim) == [] : List<&2, String>}

Without the name annotation, an object names no primary.

Definitions

def Ex.obj source · line 329 · raw

@gen:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @rv:String -> @del:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> @st:0x341d8c21d651622b4e114e45f1f37703/src/json.Json -> 0x341d8c21d651622b4e114e45f1f37703/src/json.Json

An object with a generation, a version, a deletion stamp and a status, for the laws below.

def Ex.lease source · line 456 · raw

@+holder:String -> 0x341d8c21d651622b4e114e45f1f37703/src/json.Json

A Lease held by "a", as another replica reads it.