event 1114 solution

This commit is contained in:
elffuss-bot
2026-10-05 17:13:13 +00:00
parent bd2fc77aac
commit 74c711cb5c
2 changed files with 60 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
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..4a40e5e3159ddef434a72de1ac7fb33fe7795334
--- /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.ok(typeof summary === 'string');
+ assert.ok(summary.includes('~?GB RAM'));
+ assert.ok(!summary.includes('undefined'));
+ assert.ok(summary.includes('8GB RAM'));
+});
diff --git a/web/js/runtime/caps.js b/web/js/runtime/caps.js
index db6a3a700047089359db731cd85c76a6f769d338..45fe01a834e1c7d19c1f136f3825c55273897be0 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) { 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); return 8 * GiB; } 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); // escritorio: ~60 % de la RAM declarada, tope de seguridad 12 GB return Math.min(Math.round(memGB * 0.6 * GiB), 12 * GiB); } return Math.min(Math.round(memGB * 0.6 * GiB), 12 * GiB);
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);
@@ -108,5 +108,5 @@ export function summarize(c) {
const g = c.gpu
? `WebGPU · buffer≤${(c.limits.maxBufferSize / GiB).toFixed(1)}GiB · binding≤${(c.limits.maxStorageBufferBindingSize / MiB) | 0}MiB`
: `sin GPU (${c.error || '—'})`;
- return `${p} · ~${c.memGB}GB RAM · presupuesto ${c.budgetGiB}GiB · ${g}`;
+ return `${p} · ~${c.memGB === undefined ? '?GB' : c.memGB}GB RAM · presupuesto ${c.budgetGiB}GiB · ${g}`;
}

1
events/0000001114.json Normal file
View File

@@ -0,0 +1 @@
{"data":{"cites":[],"envelope":{"delegation":{"identity":"0x0a8030532dcc9532f5aa2ae21762d399f52d6f5c","nonce":"1791216499","project":"0x0000000000000000000000000000000000000000000000000000000000000000","scopes":3,"sessionX":"0x90e7dee6ca6a1c9f46601ba2479b255970cea2cb2629b84d9769581bf283313d","sessionY":"0x56ff1bf2764372fe67a33d8448c9962a918f0d942bd92c51cb158bb257acf849","validFrom":"1791216499","validUntil":"1791821299"},"delegationSignature":"0xec3de5e59e43726456fa3018a8e689d14d7285856c2f352a2a0bcef777d8794241c89c2dbc8a0deb1fefc83f57b5698b4bf37d5395f3b97850f4c3d33a50825b1b","kind":"session","signature":"0x2e0c74e86d37fe1cc64cc8e8f8ad1fade8aeb01392c554c33066078bae50ff537aa04302f963131d88576d728ff7507745d5a52ce1b638bc23fffb20100673c8"},"mainHead":null,"message":{"author":"0x0a8030532dcc9532f5aa2ae21762d399f52d6f5c","baseCommit":"0x41a9aa24590db05df3c28cc60a6e7d00c6a06c3c","basePartial":"0x0000000000000000000000000000000000000000000000000000000000000000","citesHash":"0x0000000000000000000000000000000000000000000000000000000000000000","issueId":"0xe5d8236604e7fd0fab91244de1d1ce1fa7b80b8c36a72ec07212402922aaf7ae","issuedAt":"1791220392","lines":4,"nonce":"1791220392000","patchHash":"0x2fa59daa27ae280d5e7f5071d46d3d3907385228ebfe9bb44cdd0871edf7ad26","project":"0x16d6e75341c5f21003a4d9e89b416a545f7335094d7df139fd20942c9b7fb2de","repo":"0x898cee99797af3d9873c48ae110651ee9fcde15cbf07fe9c5359e4a649ac2ae3"},"pr":"elffuss/claw:item/0xd93daead36486022a71372114134104fe5acf9478afb91de68d10e42e62f8312"},"eventHash":"0x105d27f5320ca7b8d7e7ba013042d0772308532028554c1aa97049ec81ca64a9","gatewaySignature":"0x0f9d1ab385acfeda6131afa659a4fa4f818ab2464e5880856f694674b008f0456b3fe11a2d0543a6256c48b90c4ef8bf868dfe54db61b8ed071a3391d50504001c","prev":"0x0e77c4c49652170e3a88d18c053a021aec204a5e635b0852c29f11c624410141","seq":1114,"ts":1791220393,"type":"solution","v":2}