feat(backend): embed resource files as static data #479

Merged
argus merged 8 commits from loop/135-resource-embedding into main 2026-10-25 09:52:46 +00:00
Collaborator

Refs #135

Commit 1 of the two-commit rule (RESOURCES.md slice 2): the compiler side of embedding.

  • SourceTree.resourceBytes / Workspace.readResource read the bytes of a listed resource file.
  • The checker reads them at the EmbeddedBytes / EmbeddedText literal (CheckedLiteral.content); an unreadable file or a non-UTF-8 EmbeddedText is an error at the literal, with the offset of the first bad byte.
  • New native target Embedded with the manifest rows embeddedBytes and embeddedText (NATIVES.md rows and counts updated); ir/lower/embedded.trb generates their bodies, one branch per stable name, so a file is stored once however many literals name it.

Deviation, recorded in RESOURCES.md section 6: the statics hold no blob yet, so the bytes of an EmbeddedBytes are stored as Base64 text and std/resource will decode them. A real blob static is a follow-up.

Commit 2 (the std/resource declarations: EmbeddedBytes.bytes(), EmbeddedText.text() and conformance programs) comes after the seed refresh, which the two-commit rule needs; the loop does not do that step.

CI is the compiler here: nothing of this was built locally.

Refs #135 Commit 1 of the two-commit rule (RESOURCES.md slice 2): the compiler side of embedding. - `SourceTree.resourceBytes` / `Workspace.readResource` read the bytes of a listed resource file. - The checker reads them at the `EmbeddedBytes` / `EmbeddedText` literal (`CheckedLiteral.content`); an unreadable file or a non-UTF-8 `EmbeddedText` is an error at the literal, with the offset of the first bad byte. - New native target `Embedded` with the manifest rows `embeddedBytes` and `embeddedText` (NATIVES.md rows and counts updated); `ir/lower/embedded.trb` generates their bodies, one branch per stable name, so a file is stored once however many literals name it. **Deviation, recorded in RESOURCES.md section 6:** the statics hold no blob yet, so the bytes of an `EmbeddedBytes` are stored as Base64 text and `std/resource` will decode them. A real blob static is a follow-up. **Commit 2** (the `std/resource` declarations: `EmbeddedBytes.bytes()`, `EmbeddedText.text()` and conformance programs) comes after the seed refresh, which the two-commit rule needs; the loop does not do that step. CI is the compiler here: nothing of this was built locally.
test(checker): read the file of an embedded resource literal
Some checks failed
pdisc / pdisc (pull_request) Successful in 12s
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ec60a5e8d9
orion requested review from argus 2026-10-25 01:47:02 +00:00
fixup! feat(project): read the bytes of a listed resource file
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
071c6b27fd
orion force-pushed loop/135-resource-embedding from 071c6b27fd
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
to e380a73f05
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 19s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been skipped
ci / pack the seed (pull_request) Failing after 5s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-10-25 01:53:00 +00:00
Compare
fix(checker): parenthesize two juxtaposed calls the seed cannot parse
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Failing after 18s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
5e7874f74a
fix(project): keep the resource reader out of the Encode of a workspace
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
64177f5b5e
orion force-pushed loop/135-resource-embedding from 64177f5b5e
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / gates (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
to 447f349762
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
ci / what the change touches (pull_request) Successful in 7s
pdisc / pdisc (pull_request) Successful in 13s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m18s
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 16m56s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m22s
ci / tier A (linux-x64) (pull_request) Failing after 24m8s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 4m36s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m11s
2026-10-25 04:53:32 +00:00
Compare
chore(checker): run torb format on the resource embedding sources
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m13s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Successful in 17m29s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m39s
ci / tier A (linux-x64) (pull_request) Successful in 24m27s
ci / pack the seed (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m35s
ci / every host emits the same C (pull_request) Successful in 4m52s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
995529bdaa
argus approved these changes 2026-10-25 09:52:44 +00:00
argus left a comment

Checklist (head 995529b):

  • Tests: ok. CI green for this head (tier A/B, bootstrap, gates, pdisc, same-C check, playground); literals.test.trb covers both literals and path normalization to one name; the natives audit is adapted to the new Embedded target.
  • Correctness: ok. Paths reach resourceBytes only after the existing in-package and listing checks; one entry per stable name; unreadable file and non-UTF-8 EmbeddedText are errors at the literal; the new target is rejected as operator and witness member.
  • Scope: ok. Slice 2 of RESOURCES.md (refs #135), compiler side only; the deviation (Base64 text instead of a blob static) is recorded in RESOURCES.md section 6.
  • Security/data/docs: ok. No secrets or new dependencies; NATIVES.md rows and counts updated.
  • Release/deploy: nothing after merge; commit 2 (std/resource declarations + conformance programs) follows the seed refresh, and #135 stays open until then.

Non-blocking:

  1. The two new error paths (non-UTF-8 EmbeddedText with byte offset, unreadable file) and the generated bodies in ir/lower/embedded.trb have no test here (the literal test harness only holds String files, and nothing reaches the natives before commit 2). Please cover them in the commit-2 conformance programs (embedded binary that is not UTF-8, embedded text, one file named by several literals).
Checklist (head 995529b): - Tests: ok. CI green for this head (tier A/B, bootstrap, gates, pdisc, same-C check, playground); `literals.test.trb` covers both literals and path normalization to one name; the natives audit is adapted to the new `Embedded` target. - Correctness: ok. Paths reach `resourceBytes` only after the existing in-package and listing checks; one entry per stable name; unreadable file and non-UTF-8 `EmbeddedText` are errors at the literal; the new target is rejected as operator and witness member. - Scope: ok. Slice 2 of RESOURCES.md (refs #135), compiler side only; the deviation (Base64 text instead of a blob static) is recorded in RESOURCES.md section 6. - Security/data/docs: ok. No secrets or new dependencies; NATIVES.md rows and counts updated. - Release/deploy: nothing after merge; commit 2 (`std/resource` declarations + conformance programs) follows the seed refresh, and #135 stays open until then. Non-blocking: 1. The two new error paths (non-UTF-8 `EmbeddedText` with byte offset, unreadable file) and the generated bodies in `ir/lower/embedded.trb` have no test here (the literal test harness only holds String files, and nothing reaches the natives before commit 2). Please cover them in the commit-2 conformance programs (embedded binary that is not UTF-8, embedded text, one file named by several literals).
argus merged commit f630c25e33 into main 2026-10-25 09:52:46 +00:00
argus deleted branch loop/135-resource-embedding 2026-10-25 09:52:46 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!479
No description provided.