feat(debugger): name the frames of test and group bodies #289

Merged
argus merged 1 commit from loop/44-debugger-test-frame-names into main 2026-10-10 00:18:24 +00:00
Collaborator

Task

#44: a test or group body's stack frame showed closure. Name it after the test or group that runs it.

What and why

  • StackFrame.startsLoop (vm/debug.trb): set on the bottom frame of each execute loop. Above the outermost loop, that frame is a call back, i.e. the body of a test or group. The frame after it is the caller, at the statement that makes the call.
  • New debugger/frames.trb:
    • frameNameOf moves here as chunkNameOf.
    • FrameNames.namesOf names every frame of a stop.
    • A closure body that starts a loop gets the name its caller's test/group call was given. That call is the kernel instruction carrying kernelNativeBase + the index of torb_test_case/torb_test_group in the caller's statement. Its first operand is the name register in the caller's frame.
    • Result: test "doubles", group "Math". A body run as many tests (a test "side {side}" in a loop) is named after the test running it at each stop.
    • Anything unreadable keeps the chunk's name, so a frame never shows ? and naming never panics.
  • Debuggee: names are resolved once per stop, over the unfiltered frame list, and kept by frame. This happens before the frames without a statement are dropped, because the frame naming a test can be one of those. stackTrace reads the names by index.
  • Docs: DEBUGGER.md section 10 describes how frames are named; the "Open" item is removed. The torb-debug stackTrace row is updated. Skills regenerated.

Test

  • tests/debug/tests.expected: the existing session's frames now read test "doubles" and group "Math", also after the step out.
  • New session tests/debug/test-names: one body run as two tests from a loop inside two nested groups. It stops once in test "side 1" and once in test "side 2", with group "Squares" and group "Shapes" below. The computed-name proof lives here because a test inside compiler/tests would nest into the suite's own test runner.
  • compiler/tests/debugger.test.trb: an ordinary closure's frame stays closure. The same frame, marked as the start of a loop, also keeps closure, both with no frame below and with a caller that calls neither test nor group.
  • Locally: torb format --check, torb lint and torb check on the touched files, docs skill --check and docs index --check (nightly). There is no C compiler here, so the suite and the sessions run in CI.

Closes #44

## Task #44: a test or group body's stack frame showed `closure`. Name it after the test or group that runs it. ## What and why - `StackFrame.startsLoop` (vm/debug.trb): set on the bottom frame of each `execute` loop. Above the outermost loop, that frame is a call back, i.e. the body of a `test` or `group`. The frame after it is the caller, at the statement that makes the call. - New `debugger/frames.trb`: - `frameNameOf` moves here as `chunkNameOf`. - `FrameNames.namesOf` names every frame of a stop. - A closure body that starts a loop gets the name its caller's `test`/`group` call was given. That call is the `kernel` instruction carrying `kernelNativeBase` + the index of `torb_test_case`/`torb_test_group` in the caller's statement. Its first operand is the name register in the caller's frame. - Result: `test "doubles"`, `group "Math"`. A body run as many tests (a `test "side {side}"` in a loop) is named after the test running it at each stop. - Anything unreadable keeps the chunk's name, so a frame never shows `?` and naming never panics. - Debuggee: names are resolved once per stop, over the unfiltered frame list, and kept by frame. This happens before the frames without a statement are dropped, because the frame naming a test can be one of those. `stackTrace` reads the names by index. - Docs: DEBUGGER.md section 10 describes how frames are named; the "Open" item is removed. The torb-debug `stackTrace` row is updated. Skills regenerated. ## Test - `tests/debug/tests.expected`: the existing session's frames now read `test "doubles"` and `group "Math"`, also after the step out. - New session `tests/debug/test-names`: one body run as two tests from a loop inside two nested groups. It stops once in `test "side 1"` and once in `test "side 2"`, with `group "Squares"` and `group "Shapes"` below. The computed-name proof lives here because a `test` inside `compiler/tests` would nest into the suite's own test runner. - `compiler/tests/debugger.test.trb`: an ordinary closure's frame stays `closure`. The same frame, marked as the start of a loop, also keeps `closure`, both with no frame below and with a caller that calls neither `test` nor `group`. - Locally: `torb format --check`, `torb lint` and `torb check` on the touched files, `docs skill --check` and `docs index --check` (nightly). There is no C compiler here, so the suite and the sessions run in CI. Closes #44
feat(debugger): name the frames of test and group bodies
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 4s
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 0s
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 3m23s
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
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 4m7s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m28s
ci / every host emits the same C (pull_request) Successful in 4m29s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m49s
ci / tier B (linux-x64) (pull_request) Failing after 9m55s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
b49669ffd1
The body of a test or a group is a closure the test runner calls back, so its frame read
`closure`. It is now named after the call that runs it, read out of the caller's registers
at every stop: `test "doubles"`, `group "Math"` - one body run as many tests in a loop
is named after the test that runs it. The names move to debugger/frames.trb; a frame knows
whether it begins its loop (StackFrame.startsLoop).

Closes #44
orion requested review from argus 2026-10-09 22:37:34 +00:00
orion force-pushed loop/44-debugger-test-frame-names from b49669ffd1
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 4s
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 0s
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 3m23s
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 14s
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 4m7s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m28s
ci / every host emits the same C (pull_request) Successful in 4m29s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m49s
ci / tier B (linux-x64) (pull_request) Failing after 9m55s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
to 08e2eac6b1
All checks were successful
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 5s
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 (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 12s
ci / bootstrap (linux-x64) (pull_request) Successful in 3m26s
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 4m41s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 1m48s
ci / tier B (linux-x64) (pull_request) Successful in 9m30s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 4m26s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m47s
ci / gates (pull_request) Successful in 0s
2026-10-09 23:25:50 +00:00
Compare
Collaborator

CI red on b49669f: ci / tier B (linux-x64) failed after 9m55s (ci / gates follows from it); every other job that ran is green. The job log is not readable with the review token (API 404), so I cannot name the cause. The likeliest candidates are the new tests/debug/test-names session (.expected byte-for-byte) and the changed tests/debug/tests.expected; please check the log and push a fix or re-run if it is a flake. My review request stays pending and runs again on the next CI result.

CI red on b49669f: `ci / tier B (linux-x64)` failed after 9m55s (`ci / gates` follows from it); every other job that ran is green. The job log is not readable with the review token (API 404), so I cannot name the cause. The likeliest candidates are the new `tests/debug/test-names` session (`.expected` byte-for-byte) and the changed `tests/debug/tests.expected`; please check the log and push a fix or re-run if it is a flake. My review request stays pending and runs again on the next CI result.
argus approved these changes 2026-10-10 00:18:23 +00:00
argus left a comment

Approved. Checklist (head 08e2eac):

  • Tests: ok. CI green on this head (tier A, tier B incl. the debug sessions, gates). tests/debug/tests.expected updated, new session tests/debug/test-names covers a computed name run as two tests inside two nested groups, and debugger.test.trb covers the fallback to closure (alone, with a loop-start mark, with a non-test caller).
  • Correctness: ok. startsLoop marks the bottom frame of each execute loop in framesOf (depth 0 = the frame itself, otherwise the last caller record); naming is resolved once per stop over the unfiltered frame list before statement-less frames are dropped, and stackTrace reads by frame index. Every unreadable path falls back to the chunk's name, no ?, no panic.
  • Scope: ok. Matches #44 (name test/group body frames); the frameNameOf move into debugger/frames.trb is needed for it.
  • Security/data/workflows: ok. No secrets, no new dependencies, no workflow changes, no storage formats touched.
  • Docs: ok. DEBUGGER.md section 10, torb-debug.md and the regenerated skill copy; the "Open" item is removed; pdisc check green.

Non-blocking: none.

Approved. Checklist (head 08e2eac): - Tests: ok. CI green on this head (tier A, tier B incl. the debug sessions, gates). `tests/debug/tests.expected` updated, new session `tests/debug/test-names` covers a computed name run as two tests inside two nested groups, and `debugger.test.trb` covers the fallback to `closure` (alone, with a loop-start mark, with a non-test caller). - Correctness: ok. `startsLoop` marks the bottom frame of each `execute` loop in `framesOf` (depth 0 = the frame itself, otherwise the last caller record); naming is resolved once per stop over the unfiltered frame list before statement-less frames are dropped, and `stackTrace` reads by frame index. Every unreadable path falls back to the chunk's name, no `?`, no panic. - Scope: ok. Matches #44 (name test/group body frames); the `frameNameOf` move into `debugger/frames.trb` is needed for it. - Security/data/workflows: ok. No secrets, no new dependencies, no workflow changes, no storage formats touched. - Docs: ok. DEBUGGER.md section 10, torb-debug.md and the regenerated skill copy; the "Open" item is removed; pdisc check green. Non-blocking: none.
argus merged commit d0e4561e7a into main 2026-10-10 00:18:24 +00:00
argus deleted branch loop/44-debugger-test-frame-names 2026-10-10 00:18:25 +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!289
No description provided.