Skip to content

packages/rest logs 1,922 stack-frame lines per suite run from its OWN fault logging — logError hands Error objects to console.error, and 55.7% originate in error-response.ts #15484

Description

@os-litant

Blocked-by: #14366 — its PR #15673 holds packages/rest/src/rest-server.ts (41.7% of this card's population); released on MERGE, then the whole card lands in one round (maintainer ruling A, batch #49).

Split out of #15426 by the domain:cli execution PM seat after that card's premise was measured false. ⛔ Ungraded and unrouted on purpose — grading and routing are triage's.

⚠️ This is the population #15426 thought it was describing. It is a different population, in a different component, at roughly six times the volume, and — unlike #15426's — it is production logging, not test-runner output.

What was measured

On a full green packages/rest run (Test Files 178 passed (178) / Tests 3023 passed (3023)), output captured to a file and counted with stated patterns:

pattern count
total captured lines 5,971
all indented at stack-frame lines 1,922 (~32% of output)
at file:// frames 688
[sql-driver] DATABASE_ERROR lines 310
control — [Registry] 528

Frame attribution, by the header line preceding each block:

origin frames
packages/rest/src/error-response.ts:1960 713
rest-server.ts share errors 661
packages/rest/src/error-response.ts:2375 358
other [REST] 180

1,071 frames (55.7%) originate in error-response.ts alone.

The mechanism

packages/rest/src/log.ts's logError passes Error objects to console.error, and Node formats an Error argument with its full stack. ⇒ Every fault the REST layer reports at these sites prints its frames.

⚠️ This is the platform's own fault logging, not a test harness. The same code runs for a real caller — so changing it changes what an operator sees in production, and it is ⛔ not the "test output verbosity is lane discretion" class #15426 was graded under. Whoever takes this owes a Clause-② declaration, and the honest starting answer is yes until measured otherwise.

Why it is filed rather than fixed

Two independent reasons, both measured:

  1. 55.7% of the population sits in packages/rest/src/error-response.ts, which is held by open PR fix(rest): the generic declared-status passthrough names its object on both error doors #15452 (card rest: the GENERIC declared-status passthrough still disagrees on object between the two error doors — plus one bespoke arm (RECORD_NOT_FOUND) still reachable from one door only #14725, parked awaiting contract review and unable to move). Hot-file serial: same file is a hard serial, released on MERGE.
  2. ⛔ It is production logging, so the judgement is "should a reported fault print its stack?" — a real question with a real answer in both directions, ⛔ not a log-volume tidy-up.

What is NOT this card

[sql-driver] DATABASE_ERROR — measured disjoint from this population. Those 310 lines come from packages/drivers/driver-sql/src/sql-driver.ts (SqlDriver.backendStatementFault) via this.logger.warn(string), are handed one string, and carry no stack in any encoding. That was #15426's subject and its own premise; see #15426's closing comment.

Re-check

pnpm --filter '@objectstack/rest^...' build && pnpm --filter @objectstack/rest test  > out.txt 2>&1
grep -c '^\s*at '        out.txt      # the population
grep -c 'at file://'     out.txt      # its file:// subset
grep -c '\[Registry\]'   out.txt      # control — must be non-zero, or the capture failed
git grep -n 'logError'   packages/rest/src/log.ts

⚠️ Counts drift: the run total grew +50.7% against #13517's window (5,971 vs 3,963) while DATABASE_ERROR grew only +2.0% — ⇒ the growth is in this population, not the driver's. ⛔ Re-derive rather than quoting these.

Refs: #15426 (closed, premise falsified — the measurement lives there) · #13517 (the origin card for console volume) · #13986 (the structured-logger half) · PR #15452 (the hot-file hold on error-response.ts).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions