Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

One size figure: engine sizes are decimal MB, rounded half up, in the Terminal (strata update) and the app; both tested on the same numbers

Niko1221a2641683906c
diff --git a/apps/host/tests/size-label.test.mjs b/apps/host/tests/size-label.test.mjs
index adbcfa834..6a1fff1f7 100644
--- a/apps/host/tests/size-label.test.mjs
+++ b/apps/host/tests/size-label.test.mjs
@@ -12,4 +12,6 @@ test('engine sizes are decimal megabytes: 606,513,890 bytes is 607 MB, not 578',
assert.equal(megabytes(581299508), 581);
assert.equal(megabytes(1), 1);
assert.equal(megabytes(0), 1);
+ // the same samples as tests/terminal/test_size_label.py: the Terminal and the app agree
+ for (const [bytes, expected] of [[606513890, 607], [581299508, 581], [1, 1], [0, 1], [999_999, 1], [1_500_000, 2], [2_499_999, 2]]) assert.equal(megabytes(bytes), expected, String(bytes));
});
diff --git a/strata_cli/update_cmd.py b/strata_cli/update_cmd.py
index 07610c98c..cfe05e4f3 100644
--- a/strata_cli/update_cmd.py
+++ b/strata_cli/update_cmd.py
@@ -75,7 +75,7 @@ def _emit_factory(a, lines: list):
if event.get("event") == "progress":
pct = event.get("percent", 0)
if sys.stdout.isatty():
- print(f"\r downloading {event.get('label', '')}: {pct}% ({event['done'] / (1 << 20):.0f} of {event['total'] / (1 << 20):.0f} MiB) ",
+ print(f"\r downloading {event.get('label', '')}: {pct}% ({event['done'] // 1_000_000} of {event['total'] // 1_000_000} MB) ",
end="" if pct < 100 else "\n", flush=True)
elif pct >= state["pct"] + 10 or pct == 100:
state["pct"] = pct
@@ -105,7 +105,8 @@ def _may_be_remembered(source) -> bool:
def _mib(n: int | None) -> str:
- return f"{(n or 0) / (1 << 20):.0f} MiB"
+ from strata_control.updater import megabytes
+ return f"{megabytes(n)} MB"
def _line(name: str, result: dict) -> str:
diff --git a/strata_control/updater.py b/strata_control/updater.py
index 80c8cab63..2ac00de71 100644
--- a/strata_control/updater.py
+++ b/strata_control/updater.py
@@ -51,6 +51,12 @@ STAGE_DIR = ".s" # staging is short on purpose: <components>\.s\
SKEW_FREE_BYTES = 1.15
+def megabytes(n) -> int:
+ """Decimal megabytes (1 MB = 1,000,000 bytes), rounded half up, at least 1: the one figure for an engine's size in the Terminal, the app
+ (apps/host/src/lib/format.ts megabytes) and the release page. Both sides are tested on the same numbers."""
+ return max(1, int((n or 0) / 1_000_000 + 0.5))
+
+
class UpdateError(RuntimeError):
"""An update step stopped. `exit_code` is the CLI's; the old engine is untouched unless the message says otherwise."""
@@ -482,7 +488,7 @@ def _download(ctx: Context, state_name: str, url_ref: str, size: int, sha256: st
ctx.emit({"event": "progress", "phase": "download", "component": state_name, "label": label,
"done": done, "total": total, "percent": pct, "bytes_per_second": int(rate)})
- ctx.say("download", f"Downloading {label} ({size / (1 << 20):.0f} MiB)", component=state_name)
+ ctx.say("download", f"Downloading {label} ({megabytes(size)} MB)", component=state_name)
try:
return transfer.download(feed.url(url_ref), partial, size=size, sha256=sha256, progress=progress, cancel=ctx.cancel)
except transfer.Cancelled:
diff --git a/tests/terminal/test_size_label.py b/tests/terminal/test_size_label.py
new file mode 100644
index 000000000..39eb5cf32
--- /dev/null
+++ b/tests/terminal/test_size_label.py
@@ -0,0 +1,23 @@
+"""One engine, one size: the Terminal and the app both say decimal megabytes, rounded half up (apps/host/tests/size-label.test.mjs has the
+same numbers). 606,513,890 bytes is 607 MB in both places, never 606 in one and 607 in another."""
+import unittest
+
+from strata_cli import update_cmd
+from strata_control import updater
+
+# the same samples as the app's test: (bytes, megabytes)
+SAMPLES = [(606513890, 607), (581299508, 581), (1, 1), (0, 1), (999_999, 1), (1_500_000, 2), (2_499_999, 2)]
+
+
+class SizeLabel(unittest.TestCase):
+ def test_megabytes_match_the_apps_figures(self):
+ for size, expected in SAMPLES:
+ self.assertEqual(updater.megabytes(size), expected, size)
+
+ def test_the_terminal_offer_line_uses_the_same_helper(self):
+ self.assertEqual(update_cmd._mib(606513890), "607 MB")
+ self.assertEqual(update_cmd._mib(581299508), "581 MB")
+
+
+if __name__ == "__main__":
+ unittest.main()