project: honour panicFrames of a profile block #33

Closed
opened 2026-10-05 21:07:12 +00:00 by orion · 5 comments
Collaborator

Context

panicFrames of a profile block is read and ignored: whether a native binary prints the frames of a panic is decided by the profile's name (dev does, release does not), not by the block. The setting should decide. test { coverageThreshold }, the other half of the original title, is split into #191 (it needs an owner decision first).

Source

Design (pinned)

  • The frames are compiled in by the C compiler's macros, never by the emitted C (the C is the same under every profile). CompileProfile.macros() (compiler/src/cli/build.trb) passes the effective panicFrames of the project's profile block as TORB_PANIC_FRAMES (1 or 0); runtime/include/torb.h keeps frames when it is 1, drops them when 0, and when the macro is not defined at all falls back to today's rule (TORB_PROFILE_DEV decides). That fallback is what keeps an older driver and a newer runtime (and the reverse) agreeing.
  • TORB_PROFILE_DEV keeps deciding the default memory limit and the ? return trace; panicFrames touches neither.
  • GCC and Clang only, as today; MSVC builds keep no frames whatever the block says (documented, no new diagnostic).
  • The VM prints no frames, with or without the setting.

Acceptance criteria

  • A dev binary built with profile "dev" { panicFrames = false } prints a panic's site and no frames; a release binary built with profile "release" { panicFrames = true } prints the frames; unset, both behave as today. Covered by a fixture-based test (native panic, expected stderr) for both directions.
  • The same holds for torb test --native: a failure's frames follow the block.
  • A unit test pins the macro list per profile and setting (dev, release, overridden, workspace-root inherited).
  • The emitted C is byte-identical under every profile and setting (the existing emit-c frame tests stay green unchanged).
  • TORB_PANIC_FRAMES undefined behaves exactly as before (runtime/include/torb.h comment says so).
  • Docs: PROJECT.md section 5 "As built" and "What is left" (drop the panicFrames sentence), docs/tooling/project-trb.md table row, docs/standard-library/project.md, the doc comments of ProfileSettings and Profile, the torb.h comment; skills regenerated (build/release/torb.exe docs skill docs skills).

Size and routing

One PR, one or two Conventional Commits (feat(build): honour panicFrames of a profile block, docs(project): ...). Touches compiler/src/cli/build.trb (and host.trb if its macro loop needs the setting), runtime/include/torb.h, tests, docs. runtime/ and the backend flags are touched, so gates tier A and B. Implementer: Sonnet; the C macro logic is small but gets a diff review.

Dependencies

None. The release freeze for 0.1.0 holds PRs until it is lifted; the issue is ready, opening the PR waits for that.

Moved from the planning lists of the docs; the design record stays the specification.

## Context `panicFrames` of a `profile` block is read and ignored: whether a native binary prints the frames of a panic is decided by the profile's name (`dev` does, `release` does not), not by the block. The setting should decide. `test { coverageThreshold }`, the other half of the original title, is split into https://git.torb.dev/torbscript/language/issues/191 (it needs an owner decision first). ## Source - [PROJECT.md section 5, As built](https://git.torb.dev/torbscript/language/src/commit/4c6bbc403d419bc769ed3ed387d3d25e629d45ba/docs/design/PROJECT.md#L516) and [what is left](https://git.torb.dev/torbscript/language/src/commit/4c6bbc403d419bc769ed3ed387d3d25e629d45ba/docs/design/PROJECT.md#L1337) - [PANICS.md, the frames of the dev profile](https://git.torb.dev/torbscript/language/src/commit/4c6bbc403d419bc769ed3ed387d3d25e629d45ba/docs/design/PANICS.md): native only; the VM prints the site and no frames and stays so ## Design (pinned) - The frames are compiled in by the C compiler's macros, never by the emitted C (the C is the same under every profile). `CompileProfile.macros()` (`compiler/src/cli/build.trb`) passes the effective `panicFrames` of the project's `profile` block as `TORB_PANIC_FRAMES` (`1` or `0`); `runtime/include/torb.h` keeps frames when it is `1`, drops them when `0`, and when the macro is **not defined at all** falls back to today's rule (`TORB_PROFILE_DEV` decides). That fallback is what keeps an older driver and a newer runtime (and the reverse) agreeing. - `TORB_PROFILE_DEV` keeps deciding the default memory limit and the `?` return trace; `panicFrames` touches neither. - GCC and Clang only, as today; MSVC builds keep no frames whatever the block says (documented, no new diagnostic). - The VM prints no frames, with or without the setting. ## Acceptance criteria - [ ] A `dev` binary built with `profile "dev" { panicFrames = false }` prints a panic's site and no frames; a `release` binary built with `profile "release" { panicFrames = true }` prints the frames; unset, both behave as today. Covered by a fixture-based test (native panic, expected stderr) for both directions. - [ ] The same holds for `torb test --native`: a failure's `frames` follow the block. - [ ] A unit test pins the macro list per profile and setting (`dev`, `release`, overridden, workspace-root inherited). - [ ] The emitted C is byte-identical under every profile and setting (the existing `emit-c` frame tests stay green unchanged). - [ ] `TORB_PANIC_FRAMES` undefined behaves exactly as before (`runtime/include/torb.h` comment says so). - [ ] Docs: PROJECT.md section 5 "As built" and "What is left" (drop the `panicFrames` sentence), `docs/tooling/project-trb.md` table row, `docs/standard-library/project.md`, the doc comments of `ProfileSettings` and `Profile`, the `torb.h` comment; skills regenerated (`build/release/torb.exe docs skill docs skills`). ## Size and routing One PR, one or two Conventional Commits (`feat(build): honour panicFrames of a profile block`, `docs(project): ...`). Touches `compiler/src/cli/build.trb` (and `host.trb` if its macro loop needs the setting), `runtime/include/torb.h`, tests, docs. `runtime/` and the backend flags are touched, so gates tier A and B. Implementer: Sonnet; the C macro logic is small but gets a diff review. ## Dependencies None. The release freeze for 0.1.0 holds PRs until it is lifted; the issue is ready, opening the PR waits for that. _Moved from the planning lists of the docs; the design record stays the specification._
Author
Collaborator

[loop:torbscript] intake: in scope (author orion, label loop). Two ignored project settings per PROJECT.md "what is left"; panicFrames touches the runtime frames, coverageThreshold the test runner. Small to medium, may split. No collision with CONCEPT "Open Questions", no seed impact expected. Release freeze for 0.1.0 (2026-10-06) holds new PRs, next: refine (queued)

[loop:torbscript] intake: in scope (author orion, label loop). Two ignored project settings per PROJECT.md "what is left"; `panicFrames` touches the runtime frames, `coverageThreshold` the test runner. Small to medium, may split. No collision with CONCEPT "Open Questions", no seed impact expected. Release freeze for 0.1.0 (2026-10-06) holds new PRs, next: refine (queued)
Author
Collaborator

[loop:torbscript] claim refine by session:loop-torbscript-20261008 until 2026-10-08T14:45:00Z

[loop:torbscript] claim refine by session:loop-torbscript-20261008 until 2026-10-08T14:45:00Z
orion changed title from project: honour panicFrames and test { coverageThreshold } to project: honour panicFrames of a profile block 2026-10-08 12:45:21 +00:00
Author
Collaborator

[loop:torbscript] refine: ready, split: panicFrames stays here (precise acceptance criteria, design pinned in the body, seed impact none: TORB_PANIC_FRAMES is an optional macro, an undefined one keeps today's rule, so no two-commit seed dance), test { coverageThreshold } moved to #191 where the owner decision and question q1 are filed (no design record defines coverage). Size: one PR, one or two commits, tiers A and B, Sonnet implementer. next: implement

[loop:torbscript] refine: ready, split: `panicFrames` stays here (precise acceptance criteria, design pinned in the body, seed impact none: `TORB_PANIC_FRAMES` is an optional macro, an undefined one keeps today's rule, so no two-commit seed dance), `test { coverageThreshold }` moved to https://git.torb.dev/torbscript/language/issues/191 where the owner decision and question q1 are filed (no design record defines coverage). Size: one PR, one or two commits, tiers A and B, Sonnet implementer. next: implement
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T20:50:00Z

[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T20:50:00Z
Author
Collaborator

[loop:torbscript] implement: PR #193 open, CI green (bootstrap, tier A incl. the new tests/panic-frames gate, tier B, every host emits the same C), next: review

[loop:torbscript] implement: PR https://git.torb.dev/torbscript/language/pulls/193 open, CI green (bootstrap, tier A incl. the new tests/panic-frames gate, tier B, every host emits the same C), next: review
argus closed this issue 2026-10-08 13:36:40 +00:00
Sign in to join this conversation.
No labels
loop
ready
No project
No assignees
1 participant
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#33
No description provided.