From 481642fbdc94db37ae42ded7244674054b6377c3 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Wed, 30 Sep 2026 16:38:06 +0100 Subject: Pin an i64's meaning on every path (015) server_meaning gives every value an i64 field, 13 values from 0 and -0 to both ends of the range and just inside them, in over JSON, rows and a query, over the link (where B takes id, a u32, as an i64) and HTTP, and out at all seven exits with every digit. 32 more refusals, each with its reason on JSON, a query and rows; an i64 view's text at both ends and an i64 argument that counts exactly and refuses the rest. --- tests/check.py | 129 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 85 insertions(+), 44 deletions(-) (limited to 'tests') diff --git a/tests/check.py b/tests/check.py index 0c16802..b982256 100644 --- a/tests/check.py +++ b/tests/check.py @@ -3306,6 +3306,7 @@ MEANING_KEPT = """record Kept { x = 0 label: text ok = false + big: i64 } state kept: list of Kept by id """ @@ -3317,6 +3318,7 @@ MEANING_ROWS = """view rows = each k in kept { x = k.x label = k.label ok = k.ok + big = k.big } """ # A: what comes in (a JSON body, its rows, or a query and a plain body) is kept, and sent on; a put is answered @@ -3327,6 +3329,7 @@ MEANING_ORIGIN = MEANING_KEPT + """record Part { u = 0 t: text ok = false + big: i64 } input put = message { id: u32 @@ -3334,6 +3337,7 @@ input put = message { u: u32 t: text ok: bool + big: i64 at: { x: number label: text @@ -3345,6 +3349,7 @@ input put_plain = message { u: u32 t: text ok: bool + big: i64 } input put_rows = message { parts: list of Part @@ -3355,28 +3360,35 @@ input touch = message { } output passed = message like put on put { - kept.add(Kept { id: put.id, n: put.n, u: put.u, t: put.t, x: put.at.x, label: put.at.label, ok: put.ok }) + kept.add(Kept { id: put.id, n: put.n, u: put.u, t: put.t, x: put.at.x, label: put.at.label, ok: put.ok, big: put.big }) send passed { ..put } reply put.t } on put_rows { for p in put_rows.parts { - kept.add(Kept { id: p.id, n: p.n, u: p.u, t: p.t, x: 0, label: "rows", ok: p.ok }) - send passed { id: p.id, n: p.n, u: p.u, t: p.t, ok: p.ok, at: { x: 0, label: "rows" } } + kept.add(Kept { id: p.id, n: p.n, u: p.u, t: p.t, x: 0, label: "rows", ok: p.ok, big: p.big }) + send passed { id: p.id, n: p.n, u: p.u, t: p.t, ok: p.ok, big: p.big, at: { x: 0, label: "rows" } } } } on put_plain { - kept.add(Kept { id: put_plain.id, n: put_plain.n, u: put_plain.u, t: put_plain.t, x: 0, label: "", ok: put_plain.ok }) - send passed { id: put_plain.id, n: put_plain.n, u: put_plain.u, t: put_plain.t, ok: put_plain.ok, at: { x: 0, label: "" } } + kept.add(Kept { id: put_plain.id, n: put_plain.n, u: put_plain.u, t: put_plain.t, x: 0, label: "", ok: put_plain.ok, + big: put_plain.big }) + send passed { id: put_plain.id, n: put_plain.n, u: put_plain.u, t: put_plain.t, ok: put_plain.ok, big: put_plain.big, + at: { x: 0, label: "" } } } on touch { kept[touch.id].t = touch.t } view any_ok = count(k in kept where k.ok) > 0 view with_ok(want: bool) = count(k in kept where k.ok == want) +view biggest = max(k.big for k in kept) +view smallest = min(k.big for k in kept) +view with_big(want: i64) = count(k in kept where k.big == want) """ + MEANING_ROWS -# B: A's sends over the link, taken by name (fields in another order, u a number), kept and sent on over HTTP. +# B: A's sends over the link, taken by name (fields in another order, u a number, id an i64), kept and sent on over +# HTTP. MEANING_MIRROR = MEANING_KEPT + """input passed = message { + big: i64 ok: bool at: { label: text @@ -3385,12 +3397,12 @@ MEANING_MIRROR = MEANING_KEPT + """input passed = message { t: text u: number n: number - id: u32 + id: i64 } output onward = message like passed on passed { - kept.add(Kept { id: passed.id, n: passed.n, u: passed.u, t: passed.t, x: passed.at.x, label: passed.at.label, - ok: passed.ok }) + kept.add(Kept { id: number(passed.id), n: passed.n, u: passed.u, t: passed.t, x: passed.at.x, label: passed.at.label, + ok: passed.ok, big: passed.big }) send onward { ..passed } } """ + MEANING_ROWS @@ -3405,10 +3417,11 @@ MEANING_END = MEANING_KEPT + """input onward = message { label: text } ok: bool + big: i64 } on onward { kept.add(Kept { id: onward.id, n: onward.n, u: onward.u, t: onward.t, x: onward.at.x, label: onward.at.label, - ok: onward.ok }) + ok: onward.ok, big: onward.big }) } """ + MEANING_ROWS # The value set: every number a JSON reader must round correctly, u32s to its ends, texts JSON escapes and UTF-8. @@ -3417,6 +3430,8 @@ MEANING_NUMBERS = ['0', '-0', '1', '-1', '0.1', '0.3333333333333333', '900719925 '1.7976931348623157e308', '1.7976931348623158e308', '2.2250738585072014e-308', '2.2250738585072011e-308', '5e-324', '2.4703282292062328e-324', '1E+2', '-2.5e-10'] MEANING_U32 = [0, 1, 2147483648, 4294967295] +MEANING_I64 = ['0', '-0', '1', '-1', '9007199254740992', '9007199254740993', '-9007199254740993', '9223372036854775807', + '-9223372036854775808', '9223372036854775806', '-9223372036854775807', '4294967296', '1234567890123456789'] MEANING_TEXTS = ['', 'a', '한글 텍스트', 'emoji 🎉 and 𝄞', 'quote " backslash \\ slash /', 'line\nfeed\ttab\rreturn', 'control \x01\x1f\x7f', 'nul \x00 inside', 'separator \u2028 and \u2029', '\ufeffbom', '\uffff not a character', 'x' * 4096] @@ -3426,13 +3441,13 @@ def server_meaning(aup, pure, work): """One value, every path (docs/research/108): values at the edges of what JSON, a query and a plain body can say come in to A; A keeps them and sends them over a link to B, which takes them by name (fields in another order, - u widened to a number) and sends them over HTTP to C. Each value must come - out the same at every exit: A's view, a query on A, B's and C's views, A - after a restart and after a checkpoint, B after its module was replaced. - A number keeps its bits (zero has no sign: -0 shows as 0 and counts as 0), - a text its bytes, a bool is true or false (never 1 or 0). What must be - refused is refused on every way in, and leaves nothing behind (no row, no - send).""" + u widened to a number, id to an i64) and sends them over HTTP to C. Each + value must come out the same at every exit: A's view, a query on A, B's + and C's views, A after a restart and after a checkpoint, B after its + module was replaced. A number keeps its bits (zero has no sign: -0 shows + as 0 and counts as 0), a text its bytes, a bool is true or false (never 1 + or 0), an i64 every digit (past 2^53, to its ends). What must be refused + is refused on every way in, and leaves nothing behind (no row, no send).""" import socket import struct import time @@ -3440,8 +3455,8 @@ def server_meaning(aup, pure, work): from urllib.parse import quote modules = {} for name, text in (('origin', MEANING_ORIGIN), ('mirror', MEANING_MIRROR), ('end', MEANING_END), - ('mirror-2', MEANING_MIRROR.replace(' id = 0\n n = 0\n u = 0\n t: text\n x = 0\n label: text\n ok = false\n', - ' ok = false\n label: text\n x = 0\n t: text\n u = 0\n n = 0\n id = 0\n'))): + ('mirror-2', MEANING_MIRROR.replace(' id = 0\n n = 0\n u = 0\n t: text\n x = 0\n label: text\n ok = false\n big: i64\n', + ' big: i64\n ok = false\n label: text\n x = 0\n t: text\n u = 0\n n = 0\n id = 0\n'))): source = work / f'meaning-{name}.aup' source.write_text(text) compile_module(aup, source, source.with_suffix('.pmod')) @@ -3498,10 +3513,11 @@ def server_meaning(aup, pure, work): return float(shown) == want == 0 or struct.pack('