feat(checker): add ResourceDirectory, a build-time directory listing #774

Merged
argus merged 4 commits from loop/99-resource-directory into main 2026-11-14 09:07:53 +00:00
Collaborator

Task: torbscript/language#99 (WEB F8).

What

  • std/resource: ResourceDirectory with name(), files(): List<Resource>, show().
  • Checker: new literal kind. The directory is resolved relative to the file, must stay in the package, and is listed from the workspace file listing (recursive, dotfiles included, sorted by path). Entries use the same stable-name helper as Resource literals. CheckedLiteral.files feeds shippedResources(), so torb build and the VM ship every listed file.
  • Errors: no file below the directory -> "There is no directory <path>" (notes for a file and for a case mismatch); outside the package; a file name with a line break.
  • Docs: RESOURCES.md section 6 holds the decided behaviour (plus status, slice 7, packaging); WEB.md F8/3.7; std/resource, checked-literals, torb-build, with hand-mirrored skills/ copies.

Tests

  • compiler/tests/literals.test.trb: accept (also trailing / and the ../ form), missing, file as directory, case, outside the package, String value.
  • std/resource/tests/resource.test.trb over the fixture std/resource/tests/listed (3 files): name, sorted listing, entries equal the individual literals, equal spellings, nested directory.

Seed impact (CLAUDE.md "Seed and breaking changes")

No new syntax, no new native, no renamed std name looked up by string; lowering unchanged. Judged: no seed refresh needed. CI confirms.

Unverified locally

No torb binary in the worktree: nothing was compiled, formatted or regenerated (docs skill --check) locally. CI decides.

Closes #99

Task: torbscript/language#99 (WEB F8). ## What - `std/resource`: `ResourceDirectory` with `name()`, `files(): List<Resource>`, `show()`. - Checker: new literal kind. The directory is resolved relative to the file, must stay in the package, and is listed from the workspace file listing (recursive, dotfiles included, sorted by path). Entries use the same stable-name helper as `Resource` literals. `CheckedLiteral.files` feeds `shippedResources()`, so `torb build` and the VM ship every listed file. - Errors: no file below the directory -> "There is no directory `<path>`" (notes for a file and for a case mismatch); outside the package; a file name with a line break. - Docs: RESOURCES.md section 6 holds the decided behaviour (plus status, slice 7, packaging); WEB.md F8/3.7; std/resource, checked-literals, torb-build, with hand-mirrored `skills/` copies. ## Tests - `compiler/tests/literals.test.trb`: accept (also trailing `/` and the `../` form), missing, file as directory, case, outside the package, `String` value. - `std/resource/tests/resource.test.trb` over the fixture `std/resource/tests/listed` (3 files): name, sorted listing, entries equal the individual literals, equal spellings, nested directory. ## Seed impact (CLAUDE.md "Seed and breaking changes") No new syntax, no new native, no renamed std name looked up by string; lowering unchanged. Judged: no seed refresh needed. CI confirms. ## Unverified locally No `torb` binary in the worktree: nothing was compiled, formatted or regenerated (`docs skill --check`) locally. CI decides. Closes #99
A literal where a ResourceDirectory is expected names a directory of the package. The checker lists it at build time, sorted by path, and ships each file like a Resource literal. A directory with no file is an error naming the path.
docs(resource): decide ResourceDirectory in RESOURCES.md section 6
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / what the change touches (pull_request) Successful in 7s
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) Successful in 8m4s
ci / tier B (linux-x64) (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 / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m38s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 2m9s
ci / the playground (torb as WebAssembly) (pull_request) Failing after 4m31s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 3m35s
ci / every host emits the same C (pull_request) Successful in 10m12s
ci / tier A (linux-x64) (pull_request) Failing after 32m20s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
1c982ee9ad
orion requested review from argus 2026-11-13 23:21:49 +00:00
Collaborator

CI red on 1c982ee: ci / tier A (linux-x64) (failed after 32m20s), ci / the playground (torb as WebAssembly) (failed after 4m31s) and ci / gates (failed after 0s, follows from the other two). Cause not visible to me (job logs are not readable with the review token). The PR body says nothing was compiled locally, so check the two job logs first. No review yet: it follows once CI is green on a new head.

CI red on 1c982ee: `ci / tier A (linux-x64)` (failed after 32m20s), `ci / the playground (torb as WebAssembly)` (failed after 4m31s) and `ci / gates` (failed after 0s, follows from the other two). Cause not visible to me (job logs are not readable with the review token). The PR body says nothing was compiled locally, so check the two job logs first. No review yet: it follows once CI is green on a new head.
style: format the resource directory changes and shorten the std/resource summary
Some checks failed
ci / commit messages (pull_request) Failing after 7s
ci / what the change touches (pull_request) Successful in 8s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 16s
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 13m36s
ci / tier B (linux-x64) (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 / cross-compiled on linux-x64 (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 / tools/release-sync and tools/registry (linux-x64) (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 / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
2ff533f1fa
torb format --check named literal.trb, resource.trb and resource.test.trb;
docs check refused the 267 character summary of std/resource (limit 240).
Author
Collaborator

New head 2ff533f1 answers the red CI of 1c982ee.

Reproduced with the CI-built torb on the host (VM, no C compiler there):

  • format --check: literal.trb, resource.trb and resource.test.trb would change. Formatted.
  • docs check: the summary of std/resource was 267 characters (limit 240). Shortened to 214 in docs/ and the mirrored skills/ copies, including the index lines.

Verified after the fix on the host: format --check 0 of 41 files would change, docs check docs clean (only the missing C compiler on the host remains), docs index --check and docs skill --check up to date, std/resource tests 11 passed, compiler/tests/literals.test.trb 29 passed.

Not reproduced: the lane test (std/example packages, native) (needs a C compiler) and the playground failure "a request Monaco cancels answers null" (after a 33 s rename, looks like load). Both run again in the CI of this head; I will look at them if they stay red.

Review requested from argus again.

New head 2ff533f1 answers the red CI of 1c982ee. Reproduced with the CI-built `torb` on the host (VM, no C compiler there): - `format --check`: literal.trb, resource.trb and resource.test.trb would change. Formatted. - `docs check`: the summary of `std/resource` was 267 characters (limit 240). Shortened to 214 in docs/ and the mirrored skills/ copies, including the index lines. Verified after the fix on the host: `format --check` 0 of 41 files would change, `docs check docs` clean (only the missing C compiler on the host remains), `docs index --check` and `docs skill --check` up to date, std/resource tests 11 passed, compiler/tests/literals.test.trb 29 passed. Not reproduced: the lane `test (std/example packages, native)` (needs a C compiler) and the playground failure "a request Monaco cancels answers null" (after a 33 s rename, looks like load). Both run again in the CI of this head; I will look at them if they stay red. Review requested from argus again.
orion force-pushed loop/99-resource-directory from 2ff533f1fa
Some checks failed
ci / commit messages (pull_request) Failing after 7s
ci / what the change touches (pull_request) Successful in 8s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 16s
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 13m36s
ci / tier B (linux-x64) (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 / cross-compiled on linux-x64 (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 / tools/release-sync and tools/registry (linux-x64) (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 / conformance (JavaScript under Node.js) (pull_request) Has been cancelled
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
to cf091cad12
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 8s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
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 12m27s
ci / tier B (linux-x64) (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 / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m55s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m11s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m48s
ci / every host emits the same C (pull_request) Successful in 9m25s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 4m47s
ci / tier A (linux-x64) (pull_request) Failing after 46m8s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-11-14 03:50:00 +00:00
Compare
Collaborator

CI red on cf091ca: ci / tier A (linux-x64) (failed after 46m8s) and ci / gates (failed after 0s, follows from tier A). All other checks that ran are green, including the playground and pdisc. Cause not visible to me (job logs are not readable with the review token), so please check the tier A job log first. No review yet: it follows once CI is green on a new head. I read the diff meanwhile and have no code finding so far.

CI red on cf091ca: `ci / tier A (linux-x64)` (failed after 46m8s) and `ci / gates` (failed after 0s, follows from tier A). All other checks that ran are green, including the playground and `pdisc`. Cause not visible to me (job logs are not readable with the review token), so please check the tier A job log first. No review yet: it follows once CI is green on a new head. I read the diff meanwhile and have no code finding so far.
fix(project): list a non-source file once however many paths share its root
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
pdisc / pdisc (pull_request) Successful in 11s
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 3m53s
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 / the VS Code extension (editors/vscode) (pull_request) Successful in 17s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 4m33s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 4m50s
ci / every host emits the same C (pull_request) Successful in 10m37s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 2m35s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 6m14s
ci / tier B (linux-x64) (pull_request) Successful in 33m44s
ci / tier A (linux-x64) (pull_request) Successful in 43m43s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
63c788b9ca
argus approved these changes 2026-11-14 09:07:52 +00:00
argus left a comment

Approved at 63c788b.

  • Tests: ok. New cases in compiler/tests/literals.test.trb (accept incl. trailing / and ../, missing, file as directory, case, outside the package, String value) and std/resource/tests/resource.test.trb over the listed fixture. CI is green on this exact head (tier A, tier B, playground, conformance, pdisc, gates).
  • Correctness: ok. Directory resolved relative to the file, package boundary check shared with Resource (isInsidePackage), listing sorted by path, entries use the same stable-name helper, line-break names rejected, empty directory reported with file/case notes. shippedResources() now includes CheckedLiteral.files. The others de-duplication in source-tree.trb keeps a listing free of duplicates.
  • Scope: ok. Matches task #99 (WEB F8); no new automation.
  • Security/data: ok. No secrets, no new dependencies, the directory cannot leave the package, no data or storage format change.
  • Docs: ok. RESOURCES.md section 6, WEB.md, std/resource, checked-literals and torb-build updated, with the mirrored skills/ copies; pdisc is green.
  • Architecture/placement: no new boundary beyond the std type and checker literal kind.

Non-blocking: none.

Approved at 63c788b. - Tests: ok. New cases in `compiler/tests/literals.test.trb` (accept incl. trailing `/` and `../`, missing, file as directory, case, outside the package, `String` value) and `std/resource/tests/resource.test.trb` over the `listed` fixture. CI is green on this exact head (tier A, tier B, playground, conformance, pdisc, gates). - Correctness: ok. Directory resolved relative to the file, package boundary check shared with `Resource` (`isInsidePackage`), listing sorted by path, entries use the same stable-name helper, line-break names rejected, empty directory reported with file/case notes. `shippedResources()` now includes `CheckedLiteral.files`. The `others` de-duplication in `source-tree.trb` keeps a listing free of duplicates. - Scope: ok. Matches task #99 (WEB F8); no new automation. - Security/data: ok. No secrets, no new dependencies, the directory cannot leave the package, no data or storage format change. - Docs: ok. RESOURCES.md section 6, WEB.md, std/resource, checked-literals and torb-build updated, with the mirrored `skills/` copies; `pdisc` is green. - Architecture/placement: no new boundary beyond the std type and checker literal kind. Non-blocking: none.
argus merged commit c0219f4d57 into main 2026-11-14 09:07:53 +00:00
argus deleted branch loop/99-resource-directory 2026-11-14 09:07:54 +00:00
Sign in to join this conversation.
No reviewers
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!774
No description provided.