Skip to content

Commit 4520477

Browse files
committed
fix(ses,lockdown): make filenames in stacktraces clickable
1 parent f98efc0 commit 4520477

12 files changed

+134
-61
lines changed

Diff for: packages/lockdown/commit-debug.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ lockdown({
2121
// NOTE TO REVIEWERS: If you see the following line commented out,
2222
// this may be a development accident that should be fixed before merging.
2323
//
24-
errorTaming: 'unsafe-debug',
24+
errorTaming: 'unsafe',
2525

2626
// The default `{stackFiltering: 'concise'}` setting usually makes for a
2727
// better debugging experience, by severely reducing the noisy distractions
2828
// of the normal verbose stack traces. Which is why we comment
29-
// out the `'verbose'` setting is commented out below. However, some
30-
// tools look for the full filename that it expects in order
29+
// out the other settings below. However, some
30+
// tools look for the full filename path that it expects in order
3131
// to fetch the source text for diagnostics,
3232
//
3333
// Another reason for not commenting it out: The cause
@@ -36,10 +36,14 @@ lockdown({
3636
// uncomment out the following line. But please do not commit it in that
3737
// state.
3838
//
39-
// NOTE TO REVIEWERS: If you see the following line *not* commented out,
40-
// this may be a development accident that MUST be fixed before merging.
39+
// NOTE TO REVIEWERS: If you see the `stackFiltering` settings *not*
40+
// commented out below, this may be a development accident that MUST be
41+
// fixed before merging.
4142
//
42-
// stackFiltering: 'verbose',
43+
// stackFiltering: 'concise', // Omit frames and shorten paths
44+
// stackFiltering: 'omit-frames', // Only omit frames. Do not shorten paths
45+
// stackFiltering: 'shorten-paths', // Only shorten paths. Do not omit frames
46+
// stackFiltering: 'verbose', // Do not omit frames or shorten paths
4347

4448
// The default `{overrideTaming: 'moderate'}` setting does not hurt the
4549
// debugging experience much. But it will introduce noise into, for example,

Diff for: packages/lockdown/pre.js

+12-11
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,12 @@ export const lockdown = defaultOptions => {
102102
// this may be a development accident that MUST be fixed before merging.
103103
//
104104
// errorTaming: 'unsafe',
105-
//
106-
//
105+
107106
// The default `{stackFiltering: 'concise'}` setting usually makes for a
108107
// better debugging experience, by severely reducing the noisy distractions
109108
// of the normal verbose stack traces. Which is why we comment
110-
// out the `'verbose'` setting is commented out below. However, some
111-
// tools look for the full filename that it expects in order
109+
// out the other settings below. However, some
110+
// tools look for the full filename path that it expects in order
112111
// to fetch the source text for diagnostics,
113112
//
114113
// Another reason for not commenting it out: The cause
@@ -117,12 +116,15 @@ export const lockdown = defaultOptions => {
117116
// uncomment out the following line. But please do not commit it in that
118117
// state.
119118
//
120-
// NOTE TO REVIEWERS: If you see the following line *not* commented out,
121-
// this may be a development accident that MUST be fixed before merging.
122-
//
123-
// stackFiltering: 'verbose',
124-
//
119+
// NOTE TO REVIEWERS: If you see the `stackFiltering` settings *not*
120+
// commented out below, this may be a development accident that MUST be
121+
// fixed before merging.
125122
//
123+
// stackFiltering: 'concise', // Omit frames and shorten paths
124+
// stackFiltering: 'omit-frames', // Only omit frames. Do not shorten paths
125+
// stackFiltering: 'shorten-paths', // Only shorten paths. Do not omit frames
126+
// stackFiltering: 'verbose', // Do not omit frames or shorten paths
127+
126128
// The default `{overrideTaming: 'moderate'}` setting does not hurt the
127129
// debugging experience much. But it will introduce noise into, for example,
128130
// the vscode debugger's object inspector. During debug and test, if you can
@@ -134,8 +136,7 @@ export const lockdown = defaultOptions => {
134136
// this may be a development accident that MUST be fixed before merging.
135137
//
136138
// overrideTaming: 'min',
137-
//
138-
//
139+
139140
// The default `{consoleTaming: 'safe'}` setting usually makes for a
140141
// better debugging experience, by wrapping the original `console` with
141142
// the SES replacement `console` that provides more information about

Diff for: packages/ses-ava/test/raw-ava-reject.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ lockdown({
1515
// the current relevant environment variable setting. To get results
1616
// independent of that, always uncomment one setting for each switch.
1717
//
18-
stackFiltering: 'concise', // Default. Hide infrastructure, shorten paths
19-
// stackFiltering: 'verbose', // Include `assert` infrastructure
18+
stackFiltering: 'concise', // Default. Omit likely uninteresting frames. Shorten paths
19+
// stackFiltering: 'omit-frames', // Only omit infrastructure frames
20+
// stackFiltering: 'shorten-paths', // Only shorten paths
21+
// stackFiltering: 'verbose', // Original frames with original paths
2022
consoleTaming: 'safe', // Default. Console with access to redacted info
2123
// consoleTaming: 'unsafe', // Host console lacks access to redacted info
2224
// errorTaming: 'safe', // Default. Hide redacted info on error

Diff for: packages/ses-ava/test/raw-ava-throw.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ lockdown({
1515
// the current relevant environment variable setting. To get results
1616
// independent of that, always uncomment one setting for each switch.
1717
//
18-
stackFiltering: 'concise', // Default. Hide infrastructure, shorten paths
19-
// stackFiltering: 'verbose', // Include `assert` infrastructure
18+
stackFiltering: 'concise', // Default. Omit likely uninteresting frames. Shorten paths
19+
// stackFiltering: 'omit-frames', // Only omit infrastructure frames
20+
// stackFiltering: 'shorten-paths', // Only shorten paths
21+
// stackFiltering: 'verbose', // Original frames with original paths
2022
consoleTaming: 'safe', // Default. Console with access to redacted info
2123
// consoleTaming: 'unsafe', // Host console lacks access to redacted info
2224
// errorTaming: 'safe', // Default. Hide redacted info on error

Diff for: packages/ses-ava/test/ses-ava-reject.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ lockdown({
1616
// the current relevant environment variable setting. To get results
1717
// independent of that, always uncomment one setting for each switch.
1818
//
19-
stackFiltering: 'concise', // Default. Hide infrastructure, shorten paths
20-
// stackFiltering: 'verbose', // Include `assert` infrastructure
19+
stackFiltering: 'concise', // Default. Omit likely uninteresting frames. Shorten paths
20+
// stackFiltering: 'omit-frames', // Only omit infrastructure frames
21+
// stackFiltering: 'shorten-paths', // Only shorten paths
22+
// stackFiltering: 'verbose', // Original frames with original paths
2123
consoleTaming: 'safe', // Default. Console with access to redacted info
2224
// consoleTaming: 'unsafe', // Host console lacks access to redacted info
2325
// errorTaming: 'safe', // Default. Hide redacted info on error

Diff for: packages/ses-ava/test/ses-ava-throw.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ lockdown({
1616
// the current relevant environment variable setting. To get results
1717
// independent of that, always uncomment one setting for each switch.
1818
//
19-
stackFiltering: 'concise', // Default. Hide infrastructure, shorten paths
20-
// stackFiltering: 'verbose', // Include `assert` infrastructure
19+
stackFiltering: 'concise', // Default. Omit likely uninteresting frames. Shorten paths
20+
// stackFiltering: 'omit-frames', // Only omit infrastructure frames
21+
// stackFiltering: 'shorten-paths', // Only shorten paths
22+
// stackFiltering: 'verbose', // Original frames with original paths
2123
consoleTaming: 'safe', // Default. Console with access to redacted info
2224
// consoleTaming: 'unsafe', // Host console lacks access to redacted info
2325
// errorTaming: 'safe', // Default. Hide redacted info on error

Diff for: packages/ses/NEWS.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
User-visible changes in `ses`:
22

3-
# v1.12.0 (2025-03-11)
3+
# Next release
4+
5+
- Two new `stackFiltering:` options are added
6+
- `'omit-frames'` -- Only omit likely uninteresting frames. Keep original paths.
7+
- `'shorten-paths'` -- Only shorten paths to text likely clickable in an IDE
48

5-
- The `evalTaming:` option values are renamed:
9+
This fills out the matrix of what should have been orthogonal options.
10+
The existing `'concise'` setting both omits likely uninteresting frames and
11+
shortens their paths. The existing `'verbose'` setting does neither.
12+
13+
# v1.12.0 (2025-03-11)
614

15+
- The `evalTaming:` option values are renamed
716
- from `'safeEval'`, `'unsafeEval'`, and `'noEval'`
817
- to `'safe-eval'`, `'unsafe-eval'`, and `'no-eval'`
918

Diff for: packages/ses/docs/lockdown.md

+24-18
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Each option is explained in its own section below.
3030
| `reporting` | `'platform'` | `'console'` `'none'` | where to report warnings ([details](#reporting-options))
3131
| `unhandledRejectionTrapping` | `'report'` | `'none'` | handling of finalized unhandled rejections ([details](#unhandledrejectiontrapping-options)) |
3232
| `evalTaming` | `'safe-eval'` | `'unsafe-eval'` `'no-eval'` | `eval` and `Function` of the start compartment ([details](#evaltaming-options)) |
33-
| `stackFiltering` | `'concise'` | `'verbose'` | deep stacks signal/noise ([details](#stackfiltering-options)) |
33+
| `stackFiltering` | `'concise'` | `'omit-frames'` `'shorten-paths'` `'verbose'` | deep stacks signal/noise ([details](#stackfiltering-options)) |
3434
| `overrideTaming` | `'moderate'` | `'min'` or `'severe'` | override mistake antidote ([details](#overridetaming-options)) |
3535
| `overrideDebug` | `[]` | array of property names | detect override mistake ([details](#overridedebug-options)) |
3636
| `domainTaming` | `'safe'` | `'unsafe'` | Node.js `domain` module ([details](#domaintaming-options)) |
@@ -238,7 +238,7 @@ with the Node `console`, we advise you to also set `overrideTaming: 'min'` so
238238
that no builtin `constructor` properties are turned into accessors.
239239

240240
Examples from
241-
[test-deep-send.js](https://github.com/Agoric/agoric-sdk/blob/master/packages/eventual-send/test/test-deep-send.js)
241+
[deep-send.test.js](https://github.com/Agoric/agoric-sdk/blob/master/packages/eventual-send/test/deep-send.test.js)
242242
of the eventual-send shim:
243243

244244
<details>
@@ -247,27 +247,27 @@ of the eventual-send shim:
247247
expected failure (Error#1)
248248
Nested error
249249
Error#1: Wut?
250-
at Object.bar (packages/eventual-send/test/test-deep-send.js:13:21)
250+
at Object.bar (packages/eventual-send/test/deep-send.test.js:13:21)
251251

252252
Error#1 ERROR_NOTE: Thrown from: (Error#2) : 2 . 0
253253
Error#1 ERROR_NOTE: Rejection from: (Error#3) : 1 . 1
254254
Nested 2 errors under Error#1
255255
Error#2: Event: 1.1
256-
at Object.foo (packages/eventual-send/test/test-deep-send.js:17:28)
256+
at Object.foo (packages/eventual-send/test/deep-send.test.js:17:28)
257257

258258
Error#2 ERROR_NOTE: Caused by: (Error#3)
259259
Nested error under Error#2
260260
Error#3: Event: 0.1
261-
at Object.test (packages/eventual-send/test/test-deep-send.js:21:22)
262-
at packages/eventual-send/test/test-deep-send.js:25:19
261+
at Object.test (packages/eventual-send/test/deep-send.test.js:21:22)
262+
at packages/eventual-send/test/deep-send.test.js:25:19
263263
at async Promise.all (index 0)
264264
</details>
265265

266266
<details>
267267
<summary>Expand for { consoleTaming: 'unsafe', overrideTaming: 'min' } log output</summary>
268268

269269
expected failure [Error: Wut?
270-
at Object.bar (packages/eventual-send/test/test-deep-send.js:13:21)]
270+
at Object.bar (packages/eventual-send/test/deep-send.test.js:13:21)]
271271
</details>
272272

273273
## `errorTaming` Options
@@ -633,7 +633,11 @@ bugs.
633633
```js
634634
lockdown(); // stackFiltering defaults to 'concise'
635635
// or
636-
lockdown({ stackFiltering: 'concise' }); // Preserve important deep stack info
636+
lockdown({ stackFiltering: 'concise' }); // Preserve important deep stack info. Omit likely uninteresting frames. Shorten paths to likely clickable strings in an IDE
637+
// vs
638+
lockdown({ stackFiltering: 'omit-frames' }); // Only omit likely uninteresting frames. Preserve original paths
639+
// vs
640+
lockdown({ stackFiltering: 'shorten-paths' }); // Preserve original frames. shorten their paths to likely clickable strings in an IDE.
637641
// vs
638642
lockdown({ stackFiltering: 'verbose' }); // Console shows full deep stacks
639643
```
@@ -643,6 +647,8 @@ If `lockdown` does not receive a `stackFiltering` option, it will respect
643647

644648
```console
645649
LOCKDOWN_STACK_FILTERING=concise
650+
LOCKDOWN_STACK_FILTERING=omit-frames
651+
LOCKDOWN_STACK_FILTERING=shorten-paths
646652
LOCKDOWN_STACK_FILTERING=verbose
647653
```
648654

@@ -659,32 +665,32 @@ that information is no longer an extraneous distraction. Sometimes the noise
659665
you filter out actually contains the signal you're looking for. The
660666
`'verbose'` setting shows, on the console, the full raw stack information
661667
for each level of the deep stacks.
662-
Either setting of `stackFiltering` setting is safe. Stack information will
668+
Any setting of `stackFiltering` is safe. Stack information will
663669
or will not be available from error objects according to the `errorTaming`
664670
option and the platform error behavior.
665671

666672
Examples from
667-
[test-deep-send.js](https://github.com/Agoric/agoric-sdk/blob/master/packages/eventual-send/test/test-deep-send.js)
673+
[deep-send.test.js](https://github.com/Agoric/agoric-sdk/blob/master/packages/eventual-send/test/deep-send.test.js)
668674
of the eventual-send shim:
669675
<details>
670676
<summary>Expand for { stackFiltering: 'concise' } log output</summary>
671677

672678
expected failure (Error#1)
673679
Nested error
674680
Error#1: Wut?
675-
at Object.bar (packages/eventual-send/test/test-deep-send.js:13:21)
681+
at Object.bar (packages/eventual-send/test/deep-send.test.js:13:21)
676682

677683
Error#1 ERROR_NOTE: Thrown from: (Error#2) : 2 . 0
678684
Error#1 ERROR_NOTE: Rejection from: (Error#3) : 1 . 1
679685
Nested 2 errors under Error#1
680686
Error#2: Event: 1.1
681-
at Object.foo (packages/eventual-send/test/test-deep-send.js:17:28)
687+
at Object.foo (packages/eventual-send/test/deep-send.test.js:17:28)
682688

683689
Error#2 ERROR_NOTE: Caused by: (Error#3)
684690
Nested error under Error#2
685691
Error#3: Event: 0.1
686-
at Object.test (packages/eventual-send/test/test-deep-send.js:21:22)
687-
at packages/eventual-send/test/test-deep-send.js:25:19
692+
at Object.test (packages/eventual-send/test/deep-send.test.js:21:22)
693+
at packages/eventual-send/test/deep-send.test.js:25:19
688694
at async Promise.all (index 0)
689695
</details>
690696

@@ -696,7 +702,7 @@ of the eventual-send shim:
696702
Error#1: Wut?
697703
at makeError (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/install-ses/node_modules/ses/dist/ses.cjs:2976:17)
698704
at Function.fail (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/install-ses/node_modules/ses/dist/ses.cjs:3109:19)
699-
at Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/test-deep-send.js:13:21)
705+
at Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/deep-send.test.js:13:21)
700706
at /Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:388:23
701707
at Object.applyMethod (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:353:14)
702708
at doIt (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:395:67)
@@ -713,7 +719,7 @@ of the eventual-send shim:
713719
at handle (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:396:27)
714720
at Function.applyMethod (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:312:14)
715721
at Proxy.&lt;anonymous&gt; (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/E.js:37:49)
716-
at Object.foo (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/test-deep-send.js:17:28)
722+
at Object.foo (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/deep-send.test.js:17:28)
717723
at /Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:388:23
718724
at Object.applyMethod (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:353:14)
719725
at doIt (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:395:67)
@@ -729,8 +735,8 @@ of the eventual-send shim:
729735
at handle (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:396:27)
730736
at Function.applyMethod (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/index.js:312:14)
731737
at Proxy.<anonymous> (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/src/E.js:37:49)
732-
at Object.test (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/test-deep-send.js:21:22)
733-
at /Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/test-deep-send.js:25:19
738+
at Object.test (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/deep-send.test.js:21:22)
739+
at /Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/deep-send.test.js:25:19
734740
at Test.callFn (/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ava/lib/test.js:610:21)
735741
at Test.run (/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ava/lib/test.js:623:23)
736742
at Runner.runSingle (/Users/markmiller/src/ongithub/agoric/agoric-sdk/node_modules/ava/lib/runner.js:280:33)

Diff for: packages/ses/docs/reference.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ below.
178178
</tr>
179179
<tr>
180180
<td><code>stackFiltering</code></td>
181-
<td><code>'concise'</code> (default) or <code>'verbose'</code></td>
182-
<td><code>'concise'</code> preserves important deep stack info,<br>
181+
<td><code>'concise'</code> (default) or <code>'omit-frames'</code> or <code>'shorten-paths'</code> or <code>'verbose'</code></td>
182+
<td><code>'concise'</code> preserves important deep stack info, omitting likely unimportant frames and shortening paths<br>
183+
<code>'omit-frames'</code> omits likely unimportant frames<br>
184+
<code>'shorten-paths'</code> shortens paths to text likely clickable in an IDE<br>
183185
<code>'verbose'</code> console shows full deep stacks</td>
184186
</tr>
185187
<tr>
@@ -314,7 +316,11 @@ option and the platform error behavior.
314316
```js
315317
lockdown(); // stackFiltering defaults to 'concise'
316318
// or
317-
lockdown({ stackFiltering: 'concise' }); // Preserve important deep stack info
319+
lockdown({ stackFiltering: 'concise' }); // Preserve important deep stack info, omitting likely unimportant frames and shortening paths
320+
// vs
321+
lockdown({ stackFiltering: 'omit-frames' }); // Omit likely uninteresting frames
322+
// vs
323+
lockdown({ stackFiltering: 'shorten-paths' }); // Shorten paths to text likely clickable in an IDE
318324
// vs
319325
lockdown({ stackFiltering: 'verbose' }); // Console shows full deep stacks
320326
```

0 commit comments

Comments
 (0)