Skip to content

Document that source maps are off by default in 5.4, and how to turn them on - #714

Open
kriszyp wants to merge 7 commits into
mainfrom
kris/source-maps-default
Open

kriszyp wants to merge 7 commits into
mainfrom
kris/source-maps-default

Conversation

@kriszyp

@kriszyp kriszyp commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Documents that Harper v5.4.0 no longer enables source maps by default, and how to turn them on. Companion to HarperFast/harper#3072, which turns them off to save several megabytes of heap per thread.

⊙ Problem

After HarperFast/harper#3072, stack traces from Harper's core point at the compiled dist/*.js files unless source maps are enabled. Nothing in the docs says source maps exist, so an operator who upgrades sees different stack traces with no explanation.

🤔 Where operators look

The note sits on the debugging page next to the inspector settings. Should it also appear in the logging docs?

💡 Solution

A "Source Maps in Stack Traces" section tells operators how to turn source maps on (NODE_OPTIONS=--enable-source-maps), what it costs, and which stack traces it changes. It also says what Fabric users get, and the 5.4 release note points to it.

🤔 No opt-in on hosted Fabric

--enable-source-maps is a Node.js flag, not a V8 flag, so threads.v8Flags cannot carry it. A Harper config key (the main thread calling process.setSourceMapsEnabled(true), which workers already inherit) would give Fabric users a way in. That is a core change; this PR documents today's behavior.

🔧 Changes

  • debugging.md: a "Source Maps in Stack Traces" section (changed in v5.4.0). It leads with how to turn them on (NODE_OPTIONS=--enable-source-maps), then the memory cost. It scopes the effect to modules Node.js loads itself: Harper's core, natively loaded application code, and natively loaded npm packages. Harper's VM-based loaders were never mapped.
  • What Fabric users get: NODE_OPTIONS cannot be set on Fabric clusters that Harper hosts. Application code on the default loader is unaffected; only core and natively loaded package frames stay unmapped. Look hardest here.
  • overview.md: the See Also entry for Worker Thread Debugging mentions source maps.
  • 5.4.md: a "Smaller Per-Thread Baseline" note: idle heap drops from about 58 MB to 35 MB, some dependencies load on first use, and source maps are off by default.

✅ Verification

Not observable end-to-end in this repository; prettier is clean on the changed files. The behavior described was checked against HarperFast/harper#3072 on a running server: source maps are off in the main thread and workers by default, and on in all of them with NODE_OPTIONS=--enable-source-maps. Loader scoping was read from Harper's security/jsLoader.ts and server/threads/manageThreads.js. That no Fabric control sets NODE_OPTIONS was checked by searching the Fabric repos, not confirmed with the Fabric team.

🤖 Generated by Claude Code (Claude Opus 5.5); posted via @kriszyp.

Related PRs: #671 independent, #709 overlaps (also adds a 5.4 release note), #712 overlaps (also adds a 5.4 release note), #710 overlaps (merged; also edits the 5.4 release notes, merges cleanly), #727 overlaps (also edits the 5.4 release notes; keep both sections on rebase), #720 overlaps (merged; its 5.4 agent section sits beside this one), #715 independent
Complexity: easy

Review-Coverage: authored=claude; ran=gemini,codex; adjudicated=domain; declined=cursor-grok,cursor-composer,cursor-kimi,cursor-muse,muse; rounds=4; full=1 @ 5d79e30

Review-Attention: skim ~2m (decisions: release-note-placement, opt-in-surface, no-production-recommendation) @ 5d79e30

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation and release notes for Harper v5.4.0 to reflect changes in memory management and source map handling. Specifically, it documents that source maps are no longer enabled by default to reduce per-thread memory usage, and provides instructions on how to re-enable them using the NODE_OPTIONS=--enable-source-maps environment variable. It also highlights a 40% reduction in idle JavaScript heap usage due to optimized compiled code and lazy-loading of specific dependencies. No review comments were provided, so there is no additional feedback.

@github-actions
github-actions Bot temporarily deployed to pr-714 October 7, 2026 00:11 Inactive
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-714

This preview will update automatically when you push new commits.

kriszyp and others added 4 commits October 18, 2026 16:53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… maps, and add a 5.4 release note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kriszyp
kriszyp force-pushed the kris/source-maps-default branch from ebb3ed4 to 4939063 Compare October 18, 2026 22:58
@github-actions
github-actions Bot temporarily deployed to pr-714 October 18, 2026 23:04 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-714

This preview will update automatically when you push new commits.

Comment thread reference/configuration/debugging.md Outdated
To get stack traces that point at the original sources, set the Node.js `--enable-source-maps` flag through `NODE_OPTIONS`. Harper passes the setting on to every worker thread. It applies to modules Node.js loads itself: Harper's core, and application code loaded natively (for example with `applications.moduleLoader: native`). Modules run by Harper's VM-based loaders (`vm-current-context`, the default, as well as `vm` and `compartment`) are not mapped either way.

```bash
NODE_OPTIONS=--enable-source-maps harper

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If most people are running Harper on Fabric, how do they enable it? NODE_OPTIONS is not a great example for that use case.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. On Fabric clusters that Harper hosts there is no way to turn them on today:

  • NODE_OPTIONS: users don't control the process environment, and I found no Fabric control (central-manager, host-manager, studio) that sets it.
  • threads.v8Flags: --enable-source-maps is a Node.js flag, not a V8 flag, so it can't be passed this way.

What this costs a Fabric user is smaller than it looks. Application code on the default vm-current-context loader was never source-mapped. Harper strips TypeScript types there without moving code, so those stack traces are unchanged. What stays unmapped is frames from Harper's core and from npm packages Harper loads natively. The section now says this (debugging.md), and the release note limits NODE_OPTIONS to environments you control.

If we want Fabric users to have a way in, a small core change would do it: a Harper config key that makes the main thread call process.setSourceMapsEnabled(true) at startup. Workers already inherit that (manageThreads.js passes --enable-source-maps whenever process.sourceMapsEnabled is true). I left this thread open in case you'd like that before this merges, or know of a Fabric env-var control I missed.

— Claude Opus 5.5

kriszyp and others added 3 commits October 19, 2026 10:22
…ric users see

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dispatch-Task: fix-kriszyp_documentation_714-dcf91ad3
…-position promise, and carry the Fabric limit into the release note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dispatch-Task: fix-kriszyp_documentation_714-dcf91ad3
…hread promise from the release note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dispatch-Task: fix-kriszyp_documentation_714-dcf91ad3
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-714

This preview will update automatically when you push new commits.

This branch was successfully deployed

1 active deployment
pr-714 — 5d79e300 Deployed Oct 19, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants