feat(build): honour panicFrames of a profile block #193

Merged
argus merged 2 commits from loop/33-panic-frames into main 2026-10-08 13:36:40 +00:00
Collaborator

Closes #33

What

  • CompileProfile.macros() adds TORB_PANIC_FRAMES=1 or =0 from the project's panicFrames. The program and the script host object get the same macros, and the host's cache key includes them.
  • runtime/include/torb.h: TORB_FRAMES follows TORB_PANIC_FRAMES when it is defined (GCC and Clang only). When it is undefined, it falls back to TORB_PROFILE_DEV as before, and the comment says so. The emitted C does not change; the emit-c frame tests are untouched.
  • The workspace-root inheritance of a profile block moves into Manifest.profileInside(name, roots), so it can be unit-tested.
  • MSVC builds keep no frames whatever the block says. The VM prints the site alone. Both are documented, with no diagnostic.
  • Docs: PROJECT.md section 5 ("As built", and the panicFrames sentence dropped from "What is left"), the project-trb.md row, standard-library/project.md, torb-build.md, PANICS.md, errors/panic.md, and the doc comments of Profile, ProfileSettings and CompileProfile.macros. skills/ is regenerated.

Why

Before this change, panicFrames was read and then ignored: the profile alone decided whether a panic printed frames.

Tests

  • compiler/tests/driver.test.trb, "The macros of a profile": pins the macro list for the dev and release defaults, for a block that overrides either profile, and for a block inherited from a workspace root (where the member's own block wins).
  • tools/panic-frames.sh, a new tier A gate in lane_sessions, checks against tests/panic-frames/transcript.expected:
    • dropped (profile "dev" { panicFrames = false }) and kept (profile "release" { panicFrames = true }) are each built under both profiles and run, and also run through torb test --native under both profiles.
    • One VM run shows the site without frames.
    • Both fixtures were added to the manifest --check gate.
  • Local checks only: the driver tests in the VM (8 passed), torb format --check on the touched files, docs skill, and tools/check-commits.sh. No C compiler is available locally, so the native frame lines of the transcript are hand-written and CI confirms them.
Closes #33 ## What - `CompileProfile.macros()` adds `TORB_PANIC_FRAMES=1` or `=0` from the project's `panicFrames`. The program and the script host object get the same macros, and the host's cache key includes them. - `runtime/include/torb.h`: `TORB_FRAMES` follows `TORB_PANIC_FRAMES` when it is defined (GCC and Clang only). When it is undefined, it falls back to `TORB_PROFILE_DEV` as before, and the comment says so. The emitted C does not change; the emit-c frame tests are untouched. - The workspace-root inheritance of a profile block moves into `Manifest.profileInside(name, roots)`, so it can be unit-tested. - MSVC builds keep no frames whatever the block says. The VM prints the site alone. Both are documented, with no diagnostic. - Docs: PROJECT.md section 5 ("As built", and the `panicFrames` sentence dropped from "What is left"), the `project-trb.md` row, `standard-library/project.md`, `torb-build.md`, PANICS.md, `errors/panic.md`, and the doc comments of `Profile`, `ProfileSettings` and `CompileProfile.macros`. `skills/` is regenerated. ## Why Before this change, `panicFrames` was read and then ignored: the profile alone decided whether a panic printed frames. ## Tests - `compiler/tests/driver.test.trb`, "The macros of a profile": pins the macro list for the dev and release defaults, for a block that overrides either profile, and for a block inherited from a workspace root (where the member's own block wins). - `tools/panic-frames.sh`, a new tier A gate in `lane_sessions`, checks against `tests/panic-frames/transcript.expected`: - `dropped` (`profile "dev" { panicFrames = false }`) and `kept` (`profile "release" { panicFrames = true }`) are each built under both profiles and run, and also run through `torb test --native` under both profiles. - One VM run shows the site without frames. - Both fixtures were added to the `manifest --check` gate. - Local checks only: the driver tests in the VM (8 passed), `torb format --check` on the touched files, `docs skill`, and `tools/check-commits.sh`. No C compiler is available locally, so the native frame lines of the transcript are hand-written and CI confirms them.
The frames of a native panic follow the project's panicFrames instead of the profile: the driver hands
TORB_PANIC_FRAMES=1 or 0 to the C compiler for the program and the script host, and torb.h keeps the
TORB_PROFILE_DEV fallback where the macro is undefined. The emitted C does not change.

Closes #33
docs(project): document panicFrames as honoured
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 3s
pdisc / pdisc (pull_request) Successful in 2m14s
ci / which runners exist (pull_request) Successful in 0s
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 21s
ci / bootstrap (linux-x64) (pull_request) Successful in 4m52s
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) Successful in 3m24s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m50s
ci / every host emits the same C (pull_request) Successful in 4m41s
ci / tier B (linux-x64) (pull_request) Successful in 10m11s
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 1m56s
ci / gates (pull_request) Successful in 0s
7f4c2a9455
argus approved these changes 2026-10-08 13:35:24 +00:00
argus left a comment

Approved. Checklist for 7f4c2a9:

  • Tests: ok. Driver unit tests pin the macro list (dev/release defaults, overriding block, other-profile block, workspace-root inheritance with the member's own block winning). The new tier A gate tools/panic-frames.sh covers both directions for torb build and torb test --native, plus the VM. CI is green on this head (tier A, tier B, bootstrap, gates, pdisc).
  • Correctness: ok. TORB_PANIC_FRAMES=1|0 is appended after the profile macros. torb.h falls back to TORB_PROFILE_DEV when the macro is undefined, so an older driver and a newer runtime still agree. The host object gets the same macros and they are in its cache key. profileInside keeps the previous inheritance semantics.
  • Scope: ok. Matches #33's pinned design and acceptance criteria. The emitted C is untouched.
  • Security/data: ok. No secrets, no new dependencies, no data or format changes.
  • Docs: ok. PROJECT.md, project-trb.md, the std project doc, torb-build.md, PANICS.md, the panic error page and the doc comments are updated. skills/ is regenerated and the pdisc check is green.

Non-blocking: none.

Approved. Checklist for 7f4c2a9: - **Tests:** ok. Driver unit tests pin the macro list (dev/release defaults, overriding block, other-profile block, workspace-root inheritance with the member's own block winning). The new tier A gate `tools/panic-frames.sh` covers both directions for `torb build` and `torb test --native`, plus the VM. CI is green on this head (tier A, tier B, bootstrap, gates, pdisc). - **Correctness:** ok. `TORB_PANIC_FRAMES=1|0` is appended after the profile macros. `torb.h` falls back to `TORB_PROFILE_DEV` when the macro is undefined, so an older driver and a newer runtime still agree. The host object gets the same macros and they are in its cache key. `profileInside` keeps the previous inheritance semantics. - **Scope:** ok. Matches #33's pinned design and acceptance criteria. The emitted C is untouched. - **Security/data:** ok. No secrets, no new dependencies, no data or format changes. - **Docs:** ok. PROJECT.md, project-trb.md, the std project doc, torb-build.md, PANICS.md, the panic error page and the doc comments are updated. `skills/` is regenerated and the pdisc check is green. Non-blocking: none.
Collaborator

Approved (review above), but the merge failed: POST /pulls/193/merge (Do=rebase, head_commit_id=7f4c2a9, delete_branch_after_merge=true) returned HTTP 405 {"message":"Please try again later"}. The PR is still open and mergeable=true at last check. Not retried; please merge it or request review again.

Approved (review above), but the merge failed: `POST /pulls/193/merge` (Do=rebase, head_commit_id=7f4c2a9, delete_branch_after_merge=true) returned HTTP 405 `{"message":"Please try again later"}`. The PR is still open and mergeable=true at last check. Not retried; please merge it or request review again.
orion requested review from argus 2026-10-08 13:35:57 +00:00
argus merged commit a1d1209bf7 into main 2026-10-08 13:36:40 +00:00
argus deleted branch loop/33-panic-frames 2026-10-08 13:36:40 +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!193
No description provided.