Mystify7777 / Mystify7777/devlens

Console: preserve Error stack from multi-argument calls

Open
#22 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Goal

Improve Console event diagnostics when an Error is logged as an argument after the first argument, without changing the existing Console event shape or passthrough behavior.

Current gap

normalizeConsoleCall() currently derives message and stack only from the first argument. Therefore:

console.error("Request failed", error);

produces the useful message but loses error.stack, even though the full argument array is retained in metadata.args.

The normalizer itself documents this as a deferred v2 TODO.

Proposed scope

Investigate and implement the narrowest deterministic rule for Error extraction across the argument list.

The implementation should answer before coding:

  1. Should the first Error anywhere in the arguments supply stack when the first argument is not an Error?
  2. Should its message affect the event message, or should message remain strictly tied to the first argument per ADR-0007?
  3. What should happen when multiple Error instances are present?
  4. Should subclassed/custom Error objects behave the same as ordinary Error instances?
  5. Does scanning arguments introduce any meaningful compatibility or performance concern for the five intercepted console methods?

Preserve the existing ADR-0007 contract unless evidence justifies an amendment:

  • message remains based on the first argument,
  • metadata.args remains the full structured argument list,
  • original console method runs first and unconditionally,
  • reporting reentrancy protection remains unchanged,
  • normalization bugs are not swallowed by the EventBus failure catch.

Tests

Add focused tests covering:

  • Error as second argument,
  • Error later in the argument list,
  • multiple Errors with the chosen deterministic rule,
  • no Error in arguments,
  • first argument already being an Error,
  • existing message semantics remaining unchanged.

Run full workspace verification before commit.

Out of scope

  • New console methods.
  • Object snapshotting/immutability semantics, which are tracked separately in Issue #19.
  • Generic argument serialization.
  • Panel visual changes.

Do not commit until the implementation and tests are reviewed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with normalizeConsoleCall() and ADR-0007 to understand the existing first-argument message, metadata.args, passthrough, and reentrancy contracts. Add focused tests for Error positions, multiple Errors, no Error, and unchanged message semantics, then run full workspace verification; done means the deterministic extraction rule is implemented without changing the stated contracts.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.