feat(build): ship Resource files beside the binary and read them (#136) #533
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/136-resources-shipping"
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 #136
RESOURCES slice 3: a
Resourceis shipped beside the binary and read while the program runs.What changes
feat(resource):ResourceError(NotShipped,Unreadable,NotUtf8with the offset of the first bad byte,Unlocated),Resource.bytes()andResource.text()reading<executable minus .exe>.resources/<stable name>, composed fromCurrentProcess.executable()and the existing file read. Every message names the stable name and no machine directory.feat(build):torb buildand--embed-vmcopy every file aResourceliteral names (once per stable name) to<program>.resources/<stable name>after linking.torb runin the VM stages the files beside a name in the toolchain cache and runs the program as that name.torb testships nothing, so thestd/resourcetests assertNotShippedin both implementations. Stale files are not cleaned up.resource-text,resource-bytes(non-UTF-8),resource-missing,resource-name, with fixtures.std/resource,std/os(executable()in the VM),torb build, RESOURCES.md section 9 and slice table, ROADMAP;skills/regenerated.Notes for review
.expectedfiles were produced with a nightly toolchain against this branch'sstd/(the VM path, shipped directory faked); the native build is only exercised in CI..allocationsfiles for the four programs are missing on purpose: the budget comes from the first CI run.torb check compilerwas clean on the nightly; builds and gates run in CI only.f0efcf555c24211457e4CI red on
2421145: tier A (linux-x64) failed after 26m,gatesfailed as a consequence. I cannot read the job logs, but the likely cause is the one the PR body names:tests/conformance/README.mdsays a program with a leak run and no.allocationsfile fails and prints its count, andresource-text,resource-bytes,resource-missingandresource-namehave none. Please take the counts from the tier A log (orsh tools/conformance.sh --filter <name> --update-budgetson linux x86_64), commit the four.allocationsfiles (with the reason in the commit message), or a.leaks/unbudgeted:reason where that applies, and push; the next CI run brings the review back. If tier A fails for another reason, the log line is what needs fixing.24211457e46168eac8bbTier A on
2421145failed on three gates of the docs lane, not on the allocation budgets (the conformance leg was not reached):doc --check --no-run std([Resource]not in scope instd/resource/src/error.trb, theResourceErrorexample used an undeclaredsheet, thereadmeexample returned a Task where a Result was expected),docs checkanddocs index --check(staledocs/standard-library/index.md). Fixed in6168eac(rebased on main, 7 commits behind): examples now type check (doc --check --no-run std/resource: no problems), index and the standard-library skill regenerated,docs index --checkandformat --check std/resourceclean.The four
.allocationsfiles are still missing on purpose, as the PR body says; if the conformance leg of this run prints counts, I commit them in the next push.Checklist (head
6168eac):std/resourcetests assertNotShippedfortext()/bytes()and the message texts; four conformance programs (resource-text,resource-bytes,resource-missing,resource-name) with fixtures. CI green on this head (tier A, gates, pdisc, bootstrap).shipResourcescopies the checker-seen bytes once per stable name to<program>.resources/<name>; the runtime read composes the same path (.exestripped on both sides);torb testships nothing in both implementations; the VM stages under a cache name keyed on the entry and rewrites it each run; failures print an error and return the build/refused code./-separated), error messages carry no machine directory, no secrets.<program>.resourcesand the toolchain cache; no deletions (stale files are documented as not cleaned up).std/resource,std/os,torb build, RESOURCES.md and ROADMAP updated,skills/regenerated; pdisc check green.Non-blocking:
.allocationsfiles for the four programs are still missing; tier A is green without them, so add them if a later CI run prints counts.literal.trbdoc comment: one line now exceeds the usual wrap width.