Make console exports readable with Markdown#407
Open
zzanzifeng wants to merge 1 commit into
Open
Conversation
Add a snapshot-only Markdown export path so long console objects can be reviewed outside the virtualized console without fetching atom details during export. Constraint: console atom details are lazy and virtualized in the UI, so export must use the click-time store snapshot only. Rejected: hydrating atom details during export | it can hang or chase logs while the target keeps printing. Confidence: high Scope-risk: narrow Directive: keep JSON export as the machine-readable format and keep Markdown export snapshot-only. Tested: targeted eslint; node scripts/check-i18n.mjs; yarn build:client; git diff --check; headless Chrome Vite module test for Markdown format and download metadata Not-tested: full repo lint, which has pre-existing unrelated lint failures
zzanzifeng
added a commit
to zzanzifeng/page-spy
that referenced
this pull request
Jun 3, 2026
Add an original-by-default consoleExportMode option so apps can export full console objects as log-time JSON snapshots without changing existing lazy atom behavior. Constraint: object expansion is lazy across PageSpy platforms, and complete export must not invoke getters or require debugger-side hydration. Rejected: making complete snapshots the default | it changes payload size and legacy console behavior for existing users. Confidence: high Scope-risk: moderate Directive: keep original mode as the default and preserve getter-safe serialization semantics across browser, MP, React Native, and Harmony paths. Related: HuolalaTech/page-spy-web#407 Tested: yarn workspace @huolala-tech/page-spy-base build; yarn workspace @huolala-tech/page-spy-browser build; yarn jest packages/page-spy-base/tests/atom.test.ts packages/page-spy-browser/tests/plugins/console.test.ts --runInBand; targeted eslint for modified SDK files; git diff --check Not-tested: full SDK lint/typecheck because existing unrelated Harmony/path issues are outside this change
zzanzifeng
added a commit
to zzanzifeng/page-spy
that referenced
this pull request
Jun 3, 2026
Add an original-by-default consoleExportMode option so apps can export common console values as getter-safe log-time snapshots without changing existing lazy atom behavior. Complete mode now falls back to original atom previews when a console argument contains values that cannot be fully snapshotted, such as DOM nodes or opaque host objects.
Constraint: object expansion is lazy across PageSpy platforms, and complete export must not invoke getters or require debugger-side hydration.
Rejected: making complete snapshots the default | it changes payload size and legacy console behavior for existing users.
Rejected: representing unsupported host objects as `{ "__type": "..." }` JSON | it hides the useful original atom preview for DOM and other opaque runtime values.
Confidence: high
Scope-risk: moderate
Directive: keep original mode as the default, use ConsoleExportMode instead of repeated string literals, and preserve getter-safe serialization semantics across browser, MP, React Native, and Harmony paths.
Related: HuolalaTech/page-spy-web#407
Tested: yarn workspace @huolala-tech/page-spy-base build; yarn workspace @huolala-tech/page-spy-browser build; yarn workspace @huolala-tech/page-spy-mp-base build; yarn workspace @huolala-tech/page-spy-react-native build; yarn jest packages/page-spy-base/tests/atom.test.ts packages/page-spy-browser/tests/plugins/console.test.ts --runInBand; targeted eslint for modified SDK files; git diff --check; real headless Chrome check for DOM fallback and array object JSON snapshot
Not-tested: full SDK lint/typecheck because existing unrelated Harmony/path issues are outside this change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
./node_modules/.bin/eslint --ext .js,.jsx,.ts,.tsx src/pages/Devtools/ConsolePanel/components/HeaderActions/index.tsx src/pages/Devtools/ConsolePanel/utils/export.ts --quietnode scripts/check-i18n.mjsyarn build:clientgit diff --checksrc/pages/Devtools/ConsolePanel/utils/export.tsverified Markdown structure, pretty JSON blocks, stack text blocks,.mddownload extension, Markdown MIME, preview warning, and unchanged JSON exportconsoleExportMode: 'complete', caches complete object/array snapshots, and falls back DOM values toHTMLBodyElementatom previewsNotes
This PR only exports the data already present in the Console panel store at click time. Complete snapshots for common serializable/reference console values require the companion SDK PR to enable
consoleExportMode: 'complete'on the debugged app.The export still cannot reconstruct values that the SDK sent as lazy atom previews or values whose runtime internals are not serializable/enumerable.