Browse documentation

Hidden paths show a diagnostic's file relative to the config's directory, and any other as <external>/<name>

Date: 2026-11-30 Area: errors, cli, modules Related: #2452, ADR 0217, Errors — Hidden paths

Context

ADR 0217 made stack traces and diagnostics name a module by its absolute real path, which suits debugging and local development. On 2026-11-29 Johannes asked for an option that hides paths "for deployed and sandboxed environment", and on 2026-11-30 chose its form ("Agreed with A"): a file inside a root is shown relative to the root, a file outside it as <external>/<file name>, and the root is the directory of the config in use, or the working directory without one.

The name a diagnostic shows is also the name the engine and the host key things by. A template's source name finds the code frame's source (ModuleSourcePathSince), keys coverage and the profiler, is the base of a Script's import(), and marks engine-internal code when it starts with <. Compiling a module under a shown name would break those and change values the program computes.

Decision

  • --hide-paths and the hide-paths config key turn the option on, off by default, for every runner that takes engine options, resolved per file as any flag is (a nested config's false turns it off for its files). The root is the directory of the root config (the one --config names or the one found from the entry), or the working directory without one; a nested config does not move it. A file is inside the root when its expanded path is, or its real path is inside the root's real path. Inside, it is shown relative to the root with / separators; outside, as <external>/<file name>. A name that is not a host file (<stdin>, a virtual module's address) is shown as it is.
  • Names are mapped where they are shown, never where they are kept (Goccia.DiagnosticPaths). A template keeps its source name and an error its provenance. The stack a script reads gets each frame's file mapped when it is made (AttachStack, SetEngineErrorStack), under the root the running engine sets for its thread (TGocciaEngine.DiagnosticPathRoot); StackFramesText writes each frame's file in its shown form, and a stack made as text (a link error's) has its frame lines mapped. The thread keeps its root's real path and the last names it showed, so a stack costs a few lookups. The host maps the file of the uncaught error's location, its Resolved to: line, parse warnings and the JSON reports' file names when it prints them, after the code frame has been read from the real file.
  • What the program computes for itself is unchanged: import.meta.url, import.meta.resolve() and relative imports. Error messages, a permission error's suggestion, the lines that echo an input as it was given, the audit log and coverage and profile reports are not diagnostics' locations and keep their text.
  • Sandbox mode is unchanged: its paths are virtual and already the guest's own.

Consequences

  • One host file can appear with two spellings in one run's output: relative in a location, absolute in a message or a suggestion that names it.
  • A frame's file the script reads from stack no longer resolves as a path from the program's own directory when it is <external>/...; code that parses its own stack for file names should not run with the option on.
  • The option costs nothing when it is off: one empty-string test per stack made. On, a stack's frames are walked twice (the provenance's real names and the shown ones).