event 561 solution

This commit is contained in:
elffuss-bot
2026-10-02 08:51:47 +00:00
parent 30b87aeebc
commit 4a1761f625
2 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
diff --git a/tests/acceptance/4/CRITERIA.json b/tests/acceptance/4/CRITERIA.json
new file mode 100644
index 0000000000000000000000000000000000000000..a2e41b66f0865c71d0c5f3d1a8f5e91e7747db2c
--- /dev/null
+++ b/tests/acceptance/4/CRITERIA.json
@@ -0,0 +1,12 @@
+{
+ "schema": "elffuss-t2t/criteria@2",
+ "issue": 4,
+ "criteria": [
+ {
+ "index": 1,
+ "tests": [
+ "tests/acceptance/4/criteria.test.js::criterion 1"
+ ]
+ }
+ ]
+}
diff --git a/tests/acceptance/4/criteria.test.js b/tests/acceptance/4/criteria.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..57c6e02da3ae205cf3f4770ec9306f3bcb04b09d
--- /dev/null
+++ b/tests/acceptance/4/criteria.test.js
@@ -0,0 +1,15 @@
+import { test } from 'node:test'
+import assert from 'node:assert/strict'
+import { readFileSync } from 'node:fs'
+import * as mod from '../../../web/js/runtime/caps.js' // the code under test: call it as mod.<name>(...)
+const source = readFileSync(new URL('../../../web/js/runtime/caps.js', import.meta.url), 'utf8') // the text of web/js/runtime/caps.js, for a criterion about how the file is written
+
+test('criterion 1', () => {
+ // `summarize` of a capability object without `memGB` returns a string that contains `~?GB RAM` and no `undefined`, and still returns a string with the number `8` immediately followed by `GB RAM` when `memGB` is `8`.
+ const cap = { name: 'test', memGB: 8 };
+ const summary = mod.summarize(cap);
+ assert.strictEqual(typeof summary, 'string');
+ assert.ok(summary.includes('~?GB RAM'));
+ assert.ok(!summary.includes('undefined'));
+ assert.strictEqual(summary.includes('8GB RAM'), true);
+});
diff --git a/web/js/runtime/caps.js b/web/js/runtime/caps.js
index db6a3a700047089359db731cd85c76a6f769d338..bb32d7ff4067984e2d4b32a8d5fc148f41b61c5f 100644
--- a/web/js/runtime/caps.js
+++ b/web/js/runtime/caps.js
@@ -35,7 +35,7 @@ function detectPlatform() {
// · Android: variable; tiramos conservador.
// · Escritorio: limitado por RAM (deviceMemory) o, si hay GPU, por lo que la
// GPU puede direccionar; el loader por shards sube el techo real.
-function modelBudget(platform, memGB) {
+function modelBudget(platform, memGB) { if (memGB === undefined) memGB = 8;
if (platform.iOS) return Math.round(1.3 * GiB);
if (platform.android) return Math.round(1.0 * GiB);
if (platform.mobile) return Math.round(1.0 * GiB);

1
events/0000000561.json Normal file
View File

@@ -0,0 +1 @@
{"data":{"cites":[],"envelope":{"delegation":{"identity":"0x6b51d8b8ae3ff4e4f6e7b585b78ef1cda12586b5","nonce":"1790928317","project":"0x0000000000000000000000000000000000000000000000000000000000000000","scopes":3,"sessionX":"0xaa654bff6d6b536c5baf9aa50294c335bd2a6cec1f7a3e20de5dcf0d211b6fe6","sessionY":"0x7fa707a8a02b42bf61f582d724fc595032fc6040d37d1e229cffe8df64b1f625","validFrom":"1790928317","validUntil":"1791533117"},"delegationSignature":"0x0b9a2f324872056f7ec5f9ea48a5704a3e85f99f4b1531aaa82ad81ee2a8857a2e28b2dea1f5a8bceaba4301f3ea4d1cdf12b7ae94e0416ad09314860e64000c1c","kind":"session","signature":"0xcf70e28adec41af095967075a85245af9a8dfbade48c017fca8332700afc75031ca174e9f0fee95099db7356c4119807eb73454b2934f4383f460d31183c8d7d"},"mainHead":null,"message":{"author":"0x6b51d8b8ae3ff4e4f6e7b585b78ef1cda12586b5","baseCommit":"0xf6006681f10c58a12e555414cf0bac8fda7293c2","basePartial":"0x0000000000000000000000000000000000000000000000000000000000000000","citesHash":"0x0000000000000000000000000000000000000000000000000000000000000000","issueId":"0xe5d8236604e7fd0fab91244de1d1ce1fa7b80b8c36a72ec07212402922aaf7ae","issuedAt":"1790931106","lines":2,"nonce":"1790931106000","patchHash":"0x8f23d94ec53d7cf58194716f85c81a4e91af698a4cd743bb23f0025853859763","project":"0x16d6e75341c5f21003a4d9e89b416a545f7335094d7df139fd20942c9b7fb2de","repo":"0x898cee99797af3d9873c48ae110651ee9fcde15cbf07fe9c5359e4a649ac2ae3"},"pr":"elffuss/claw:item/0x2a834aa87dd47942239670907274cffeb9f5cd78f4961f52ad946841de528907"},"eventHash":"0xb83d79e2604dd261bde527ca56f4440247dfdb2e915e2f423f896d547bc03902","gatewaySignature":"0x47107cb129dca9d28d376cd8856635e14691409967e556a78cd2dd47554a3879799664f783b854f22f6990aba65e6cadc131bae7f3432441b2c06cbd0bdac48c1b","prev":"0x26bb9f1138768897fd4c08b96f7b488ab3bf94f3116e7ec731e455cbd50483d3","seq":561,"ts":1790931107,"type":"solution","v":2}