util.format %o passes the wrong showHidden flag to custom inspectors
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- backend
調査の方向性
Start with packages/runtime/src/scr_inspect.c near the custom inspector options object, where the issue identifies showHidden as hardcoded. Trace how the active inspection walk sets that value, then review the regression coverage for nested inspectors, thrown nested calls, and mixed %o/%O substitutions. Done means %o callbacks receive true, %O and default inspection receive false, and nested calls restore the surrounding walk; linked PR #2572 is already open.
索引モデルが issue の本文から書いたものです。
説明
We are trying to compile a full TypeScript CLI and its logger dependencies with scriptc while preserving their behavior under Node. During that compatibility work, we found that a custom inspector receives the wrong showHidden flag when util.format uses %o. A logger that chooses its output from this flag can therefore print different diagnostics after native compilation.
Reproduction
const util = require('node:util');
const value = {
[util.inspect.custom](depth, options) {
return options.showHidden ? 'hidden=true' : 'hidden=false';
}
};
console.log(util.format('%O', value));
console.log(util.format('%o', value));
console.log(util.format('%o', { nested: value }));
console.log(util.format('%O', value));
Node v24.22.0 prints:
hidden=false
hidden=true
{ nested: hidden=true }
hidden=false
A native binary built from current scriptc main prints:
hidden=false
hidden=false
{ nested: hidden=false }
hidden=false
Both programs exit successfully with empty stderr, so this is an output difference rather than a compilation refusal.
Cause and expected behavior
The %o runtime walk already enables hidden properties, but the options object passed to custom inspectors hardcodes showHidden: false. That value should describe the active walk. %O and default util.inspect should continue to pass false; %o should pass true, including for nested custom inspectors and class instances reached through unknown.
Nested inspect and format calls must still start with their own defaults and restore the surrounding walk when they finish or throw. Regression tests should check those transitions as well as mixed %o and %O substitutions in one call.
Related work and scope
The merged #1848 added hidden-property rendering over checked-dynamic values. The currently open #2562 addresses circular references and traversal limits in inspection; its current diff does not change the callback's showHidden value. Searches for showHidden and custom inspection found no separate issue or PR for this callback mismatch.
This report concerns the showHidden value in custom inspection callbacks. Support for explicitly requesting showHidden: true, the existing refusal for static typed %o calls over custom inspectors, other callback options such as showProxy, and numeric separators are separate compatibility work.
- 主要言語
- TypeScript
- スター
- 6.4k
- フォーク
- 201
- 平均マージ
- 6時間 56分
- マージ済み PR(30日)
- 916
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vercel-labs/scriptc のほかの issue
-
process.cwd.name keeps the main-thread name inside Workers対応中かも @MathurAditya724 が 1 日前に担当しました。 オープン
難易度 4/5 1〜2日 初心者へのやさしさ 35/100
vercel-labs/scriptc#2557 ·
メンテナーはふだん 1 日以内に返信
-
SC2003 'string | undefined' when a method returning an element of its array field is used inlineオープン
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
vercel-labs/scriptc#2400 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
vercel-labs/scriptc#2399 ·
メンテナーはふだん 1 日以内に返信
-
Large LLVM metadata tables crash compilation with a stack overflow対応中かも @MathurAditya724 が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 22/100
vercel-labs/scriptc#2394 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
vercel-labs/scriptc#2209 ·
メンテナーはふだん 1 日以内に返信
vercel-labs/scriptc の issue をすべて見る
似ている issue
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
hemi-earn
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
vetro-protocol/vetro-monorepo#1043 ·
メンテナーはふだん 1 日以内に返信
-
stage 2: bare names resolve against PATH differently from the shell (empty and relative entries)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
STRML/omp-classifier#206 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
atlassian-labs/mermaid-diagrams-viewer#188 ·
メンテナーはふだん 1 日以内に返信
-
dashboard enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Olanetsoft/agent-lookout#225 ·
メンテナーはふだん 1 日以内に返信