feat(package): record the variables a manifest read in the lock (#29) #337

Merged
argus merged 3 commits from loop/29-manifest-variables into main 2026-10-12 15:14:13 +00:00
Collaborator

Closes #29.

What: the variables the evaluation of a project.trb read are recorded in the lock and named by torb publish, as decided in the refine comment of #29.

  • Manifest.variables: List<ReadVariable> (project/manifest.trb): ReadVariable.answered(name, value) hashes sha256: over name + "\n" + value, or keeps the name alone for an unset variable. manifestOf reads a from { variable ... } block back.
  • EvaluatedManifest.variableNames() / .variables() (vm/manifest.trb): the variable\t<name> lines the sandbox recorded, each once, sorted, answered from the environment the evaluation ran in.
  • evaluatedManifest (cli/packages.trb) carries them, so torb lock and torb publish write them. A statically read manifest has none.
  • settingsLines (package/lock.trb) closes a settings block with from { variable "X", hash: "sha256:..." / variable "Y", unset: true }, sorted, omitted when empty, so every literal manifest (the repository's own included) renders byte-identically to today. An older lock without from is read unchanged.
  • torb publish prints reads: NAME (set|unset) per variable after the hash: line, aligned with the summary. The value is never printed or written.

Tests

  • compiler/tests/packages.test.trb: exact rendering with a set and an unset variable, round trip renderLock(readLock(text)) == text, value absent; no variables means no from and an unchanged round trip.
  • compiler/tests/project.test.trb: recorded names deduplicated and sorted, variables() against the real environment (PATH and an unset name), the SHA-256 of name\nvalue against a known digest.
  • tools/packages.sh + tests/packages/sources/env-1.0.0: end to end, publish --dry-run of a manifest whose version reads PACKAGES_RELEASE (set) and PACKAGES_CHANNEL (unset) prints the two reads: lines and never the value, torb lock writes the from block, and lock --check is current. The rest of the publish summary depends on archive bytes, so only the package line and reads: lines go into the transcript. This is the end-to-end program for the feature; a tests/conformance program doesn't fit because conformance runs programs, not torb publish.

Docs: project-lock-trb.md (synopsis, parts table, ordering, pitfall: lock --check depends on the variables), torb-publish.md (summary, example, pitfall), PROJECT.md section 11 "What is left" (file lines remain, #331), ROADMAP, and skills/ updated to match.

Seed impact: none. No syntax change, no new native, no driver flag, no std name looked up by string.

Closes #29. **What:** the variables the evaluation of a `project.trb` read are recorded in the lock and named by `torb publish`, as decided in the refine comment of #29. - `Manifest.variables: List<ReadVariable>` (`project/manifest.trb`): `ReadVariable.answered(name, value)` hashes `sha256:` over `name + "\n" + value`, or keeps the name alone for an unset variable. `manifestOf` reads a `from { variable ... }` block back. - `EvaluatedManifest.variableNames()` / `.variables()` (`vm/manifest.trb`): the `variable\t<name>` lines the sandbox recorded, each once, sorted, answered from the environment the evaluation ran in. - `evaluatedManifest` (`cli/packages.trb`) carries them, so `torb lock` and `torb publish` write them. A statically read manifest has none. - `settingsLines` (`package/lock.trb`) closes a `settings` block with `from { variable "X", hash: "sha256:..." / variable "Y", unset: true }`, sorted, omitted when empty, so every literal manifest (the repository's own included) renders byte-identically to today. An older lock without `from` is read unchanged. - `torb publish` prints ` reads: NAME (set|unset)` per variable after the `hash:` line, aligned with the summary. The value is never printed or written. **Tests** - `compiler/tests/packages.test.trb`: exact rendering with a set and an unset variable, round trip `renderLock(readLock(text)) == text`, value absent; no variables means no `from` and an unchanged round trip. - `compiler/tests/project.test.trb`: recorded names deduplicated and sorted, `variables()` against the real environment (`PATH` and an unset name), the SHA-256 of `name\nvalue` against a known digest. - `tools/packages.sh` + `tests/packages/sources/env-1.0.0`: end to end, `publish --dry-run` of a manifest whose version reads `PACKAGES_RELEASE` (set) and `PACKAGES_CHANNEL` (unset) prints the two `reads:` lines and never the value, `torb lock` writes the `from` block, and `lock --check` is current. The rest of the publish summary depends on archive bytes, so only the package line and `reads:` lines go into the transcript. This is the end-to-end program for the feature; a `tests/conformance` program doesn't fit because conformance runs programs, not `torb publish`. **Docs:** `project-lock-trb.md` (synopsis, parts table, ordering, pitfall: `lock --check` depends on the variables), `torb-publish.md` (summary, example, pitfall), PROJECT.md section 11 "What is left" (`file` lines remain, #331), ROADMAP, and `skills/` updated to match. **Seed impact:** none. No syntax change, no new native, no driver flag, no std name looked up by string.
The evaluation's recorded variables reach the settings of the lock as a trailing `from { }` block, by the SHA-256 of name and value or as `unset: true`; `torb publish` names each one, never the value. Refs #29
docs(tooling): the variables a manifest read, in the lock and in torb publish
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
pdisc / pdisc (pull_request) Successful in 8s
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 / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
ci / bootstrap (linux-x64) (pull_request) Successful in 1m55s
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 A (linux-x64) (pull_request) Failing after 4m20s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m30s
ci / gates (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 / every host emits the same C (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
16c33e4cef
Refs #29
fix(package): the env fixture imports std/os/environment, and the closure keeps the call canon
All checks were successful
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
pdisc / pdisc (pull_request) Successful in 8s
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 1m55s
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 12s
ci / tier A (linux-x64) (pull_request) Successful in 5m0s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m3s
ci / every host emits the same C (pull_request) Successful in 4m27s
ci / tier B (linux-x64) (pull_request) Successful in 11m34s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m55s
ci / gates (pull_request) Successful in 0s
3c9def1a18
orion requested review from argus 2026-10-12 14:46:55 +00:00
argus requested changes 2026-10-12 14:47:18 +00:00
Dismissed
argus left a comment

Review of 3c9def1 (CI green for this head).

Findings

  1. [blocker] Not mergeable: main moved to e1d13b07 (feat(package): resolve and lock two majors of one package, plus two runtime commits) after this branch forked from a1f9f97. A trial merge of this head onto e1d13b07 conflicts in compiler/src/package/lock.trb (the settingsLines / header-doc region); cli/packages.trb, tests/packages.test.trb and PROJECT.md auto-merge. Rebase onto current main, resolve lock.trb keeping both changes, and push; CI has to run again on the rebased head, because the two-majors change touches the same lock/packages code and tests (tools/packages.sh transcript included).

Checklist (everything else ok on this head)

  • Tests: lock rendering (set + unset, exact text, round trip, value absent), no-variables case, name dedup/sort, SHA-256 against a known digest, and an end-to-end publish --dry-run / lock / lock --check transcript with a value-leak guard. ok
  • Correctness: from last in settings, sorted, omitted when empty (literal manifests render as before), older locks read unchanged; value never printed or written. ok
  • Scope: exactly the acceptance criteria of #29 as refined (file lines left to #331). ok
  • Security: only a name+value SHA-256 is stored; no secrets in the diff. ok
  • Docs: project-lock-trb.md, torb-publish.md, PROJECT.md section 11, ROADMAP, skills copies updated; pdisc green. ok
  • Seed impact: none claimed, nothing in the diff contradicts it. ok

No other blockers; once the rebase is green this should be an approve.

Review of 3c9def1 (CI green for this head). **Findings** 1. [blocker] Not mergeable: `main` moved to e1d13b07 (`feat(package): resolve and lock two majors of one package`, plus two runtime commits) after this branch forked from a1f9f97. A trial merge of this head onto e1d13b07 conflicts in `compiler/src/package/lock.trb` (the `settingsLines` / header-doc region); `cli/packages.trb`, `tests/packages.test.trb` and `PROJECT.md` auto-merge. Rebase onto current `main`, resolve `lock.trb` keeping both changes, and push; CI has to run again on the rebased head, because the two-majors change touches the same lock/packages code and tests (`tools/packages.sh` transcript included). **Checklist (everything else ok on this head)** - Tests: lock rendering (set + unset, exact text, round trip, value absent), no-variables case, name dedup/sort, SHA-256 against a known digest, and an end-to-end `publish --dry-run` / `lock` / `lock --check` transcript with a value-leak guard. ok - Correctness: `from` last in `settings`, sorted, omitted when empty (literal manifests render as before), older locks read unchanged; value never printed or written. ok - Scope: exactly the acceptance criteria of #29 as refined (`file` lines left to #331). ok - Security: only a name+value SHA-256 is stored; no secrets in the diff. ok - Docs: project-lock-trb.md, torb-publish.md, PROJECT.md section 11, ROADMAP, skills copies updated; pdisc green. ok - Seed impact: none claimed, nothing in the diff contradicts it. ok No other blockers; once the rebase is green this should be an approve.
orion force-pushed loop/29-manifest-variables from 3c9def1a18
All checks were successful
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
pdisc / pdisc (pull_request) Successful in 8s
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 1m55s
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 12s
ci / tier A (linux-x64) (pull_request) Successful in 5m0s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m3s
ci / every host emits the same C (pull_request) Successful in 4m27s
ci / tier B (linux-x64) (pull_request) Successful in 11m34s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m55s
ci / gates (pull_request) Successful in 0s
to 8e03e22057
All checks were successful
ci / which runners exist (push) Successful in 1s
ci / every host emits the same C (pull_request) Successful in 4m23s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m45s
ci / tier B (linux-x64) (pull_request) Successful in 12m15s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
images / cr.torb.dev/torbscript/registry (push) Has been skipped
images / cr.torb.dev/torbscript/release-sync (push) Has been skipped
images / cr.torb.dev/torbscript/site (push) Has been skipped
ci / commit messages (push) Successful in 9s
ci / what the change touches (push) Successful in 10s
ci / bootstrap and conformance (windows-x64) (push) Has been skipped
ci / bootstrap and conformance (linux-arm64) (push) Has been skipped
ci / bootstrap and conformance (macos-arm64) (push) Has been skipped
pdisc / pdisc (push) Successful in 8s
ci / the VS Code extension (editors/vscode) (push) Successful in 11s
ci / bootstrap (linux-x64) (push) Successful in 2m14s
ci / cross-compiled on linux-x64 (windows-x64) (push) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (push) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (push) Has been skipped
ci / tier A (linux-x64) (push) Successful in 4m19s
images / cr.torb.dev/torbscript/site:edge (main) (push) Successful in 7m6s
ci / tools/release-sync and tools/registry (linux-x64) (push) Successful in 1m31s
ci / every host emits the same C (push) Successful in 4m25s
ci / the playground (torb as WebAssembly) (push) Successful in 1m46s
ci / tier B (linux-x64) (push) Successful in 13m31s
ci / pack the seed (push) Has been skipped
ci / archives (push) Has been skipped
ci / gates (push) Successful in 0s
2026-10-12 14:47:22 +00:00
Compare
Collaborator

New head: this review was requested for 3c9def1a, but the PR is now at 8e03e220. Not reviewing the old head; the review runs again for the new head once its CI has finished.

New head: this review was requested for 3c9def1a, but the PR is now at 8e03e220. Not reviewing the old head; the review runs again for the new head once its CI has finished.
orion requested review from argus 2026-10-12 14:47:49 +00:00
argus approved these changes 2026-10-12 15:14:12 +00:00
argus left a comment

Review of 8e03e22 (CI green for this head, combined status success).

Earlier blocker (1, not mergeable): fixed. The branch is rebased onto current main (e1d13b07, merge base = main head), the PR is mergeable, lock.trb carries both the two-majors change and the from block, and CI ran again on the rebased head including the tools/packages.sh transcript.

Changed since the last review: the rebase and 8e03e22 (the env fixture imports std/os/environment, closure keeps the call canon). Nothing else.

Checklist

  • Tests: lock rendering (set + unset, exact text, round trip, value absent), no-variables case, name dedup/sort, SHA-256 against a known digest, end-to-end publish --dry-run / lock / lock --check transcript with a value-leak guard. ok
  • Correctness: from last in settings, sorted, omitted when empty (literal manifests render as before), older locks read unchanged; value never printed or written. ok
  • Scope: exactly the acceptance criteria of #29 as refined (file lines left to #331). ok
  • Security: only a name+value SHA-256 is stored; no secrets in the diff. ok
  • Docs: project-lock-trb.md, torb-publish.md, PROJECT.md section 11, ROADMAP, skills copies in sync; pdisc green. ok
  • Seed impact: none claimed, nothing in the diff contradicts it. ok

No blockers.

Review of 8e03e22 (CI green for this head, combined status success). **Earlier blocker (1, not mergeable):** fixed. The branch is rebased onto current `main` (e1d13b07, merge base = main head), the PR is mergeable, `lock.trb` carries both the two-majors change and the `from` block, and CI ran again on the rebased head including the `tools/packages.sh` transcript. **Changed since the last review:** the rebase and 8e03e22 (the env fixture imports `std/os/environment`, closure keeps the call canon). Nothing else. **Checklist** - Tests: lock rendering (set + unset, exact text, round trip, value absent), no-variables case, name dedup/sort, SHA-256 against a known digest, end-to-end `publish --dry-run` / `lock` / `lock --check` transcript with a value-leak guard. ok - Correctness: `from` last in `settings`, sorted, omitted when empty (literal manifests render as before), older locks read unchanged; value never printed or written. ok - Scope: exactly the acceptance criteria of #29 as refined (`file` lines left to #331). ok - Security: only a name+value SHA-256 is stored; no secrets in the diff. ok - Docs: project-lock-trb.md, torb-publish.md, PROJECT.md section 11, ROADMAP, skills copies in sync; pdisc green. ok - Seed impact: none claimed, nothing in the diff contradicts it. ok No blockers.
argus merged commit 8e03e22057 into main 2026-10-12 15:14:13 +00:00
argus deleted branch loop/29-manifest-variables 2026-10-12 15:14:13 +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!337
No description provided.