feat(sandbox): load a script held as text with Sandbox.loadText #422
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/69-sandbox-load-text"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #69
Task: URI gap 13 - a script fetched through a
Storagehas no member to hand it to.What:
Sandbox.loadText<Value>(text, name, capabilities)instd/sandbox, with no dependency onstd/storage. The text is checked and lowered like a path only known at run time: in the VM by a newload.textinstruction and the nativesloadScriptText/hostLoadScriptText, and in a native binary by a third function of the script host. Nothing is written to a file.Why: the program fetches the text with
Storage.readTextand hands it over, so what the script may reach is what the caller grants, and the sandbox stays free of any storage driver.Test:
tests/conformance/vm-only/sandbox-storage.trb(receiver applied, same text twice, type error with line, ungranted and granted import, panic with line, non-UTF-8 text isStorageFailure.NotText, missing reference) and four cases intests/conformance/sandbox-crossing.trbfor both back ends. Docs: URI.md gap 13, RESOURCES.md section 5, SCRIPTS.md slice 9,sandbox.md,the-sandbox.md,skills/copies. CI gates a and b are the check; no local run.CI red on
bc1c71a:tier A (linux-x64),tier B (linux-x64)(and sogates) - cause from the logs:tests/conformance/vm-only/sandbox-storage.trbdoes not compile: line 43storage.writeText(reference, ...)and line 44storage.readText(reference)giveExpected Uri, found String(aStringis not aUri; useUri.tryFrom(text)?or a literal), plusawait() is only allowed in a function that returns a TaskandString has no member `length`in the same file. Tier Acheck tests/conformanceand Tier Bconformance suite in the VM(also lowered for the debugger) fail on it.format --checkwould changecompiler/src/vm/host.trbandtests/conformance/vm-only/sandbox-storage.trb.My review request stays pending; I come back on the next CI run.
Approved at
eadd777. CI is green on this head, including the tier A/B and gates failures I reported onbc1c71a.vm-only/sandbox-storage.trbcovers the receiver applied, the same text loaded twice, a type error with its line, an ungranted and a granted import, a panic with its line, non-UTF-8 text and a missing reference. Four cases insandbox-crossing.trbrun in both back ends.load.textopcode (46) is wired through format, emit, disassemble, interpreter and loader. The script host has its third function, and the native-binary path and the VM path sharescriptOf. The cache key includes the receiver and the text, so it cannot collide with a path-keyed entry.textScriptPathOfreplaces/,\and:, so a name cannot escape.torb-script-text/. Nothing is written to disk, and grants and limits are the same as forload.Sandboxloading a script fetched through aStorage), with no extra work.sandbox.md,the-sandbox.mdand theskills/copies are updated. The pdisc check is green.Non-blocking: none.