Repository navigation
fix(types,core): the 5xx fault log and ObjectLogger print an error's cause chain - #37652
Conversation
…cause chain logServerFault prints the cause chain as causes beside stack on its console fallback; ObjectLogger prints it as error.causes. Bounded at five links, cycle-safe, never on the wire. record-context drops its Caused-by stack suffix. Claude-Session: https://claude.ai/code/session_01Utp6CZHczeF42DiDgkJPmk Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check18 anchor(s) derived from 3 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 46 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 4683161efc6b538a75ecd2fb48e9426d2615ce88 && git checkout 4683161efc6b538a75ecd2fb48e9426d2615ce88
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 05563a57f00f60223ccb4974db444c8231f1fd9d d6092ff79df63ec50fcaa457ca84d2787029f838 && git checkout -B drift-repro 05563a57f00f60223ccb4974db444c8231f1fd9d && git merge --no-ff d6092ff79df63ec50fcaa457ca84d2787029f838
node scripts/docs-audit/affected-docs.mjs --json 05563a57f00f60223ccb4974db444c8231f1fd9d |
Claude-Session: https://claude.ai/code/session_01Utp6CZHczeF42DiDgkJPmk Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract-review-claim: session_01Utp6CYtTDvfPQDzMbZnN5X · head d12137d · 2026-11-26T17:59Z |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Read: card #37598 (body, triage, claim, os-dev-report), PR #37652 (body, 8 files), ① Derived judgmentsAccept-set: no change. Nothing under Public surface, each change the diff publishes:
Wire: no path puts Findings:
② Semver level
Clause-②: wrong as declared. It should read ③ Boundary flagsSecurity-touching: yes
Dev flag (out-of-scope finding, "noted, not filed"):
Seat questions:
SQL push-down (Prime Directive 5): the diff has no data access, no id materialisation and no in-app join. No finding. Implemented-by: VERDICT: FAIL |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对Head-sha:
|
… declare the widening Rework for the contract review: a link whose read throws ends the chain in a marker in both copies; object causes render under the same rules in both copies; Clause-2 reads yes (widening); docblocks name the parity test. Claude-Session: https://claude.ai/code/session_01Utp6CZHczeF42DiDgkJPmk Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZHczeF42DiDgkJPmk Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: Delta review: prior head ① Derived judgmentsAccept-set: unchanged and empty. There is no spec, schema or response-body change. Public surface: the same three new Prior ids:
New:
② Semver level
③ Boundary flagsSecurity-touching: yes
Host-configured words on the console fallback: a host's stricter list (for example, extra domain words) is not applied to object causes on the fallback line, which is the MCP doors' only sink. I accept this at this scope for four reasons:
Pre-existing, ungraded: when the top-level thrown value is a non-Error object, SQL push-down (Prime Directive 5): there is no data access in the diff. No finding. Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对 (delta)Head-sha:
|
…ectLogger does Claude-Session: https://claude.ai/code/session_01Utp6CZHczeF42DiDgkJPmk Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Contract reviewServed-tier: This is the second delta review. The prior head was I read:
Check-runs: 58 success, 13 skipped. One ① Derived judgmentsThe accept-set is unchanged and empty. The public surface is unchanged: the same three new Prior ids:
New:
② Semver levelUnchanged from the previous round, and still right. Every package is at ③ Boundary flagsSecurity-touching: yes
SQL push-down (Prime Directive 5): the diff has no data access. No finding. Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X 席位核对 (delta 2)Head-sha:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CYtTDvfPQDzMbZnN5X Adding |
|
repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc Landing: ACCEPT 7201440400 (delta contract record 7201430392, PASS;
Status: ready + auto-merge (merge queue). On MERGED, #37598 closes by |
Requested by Bill · project thread
Fixes #37598
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
packages/types/src/server-fault-log.ts: newfaultCauseChain(thrown)returns thecausechain under a thrown value, outermost first, each link{ message, stack? }(messageisName: textfor anError, the text itself for a string cause, JSON for an object cause). Bounded atFAULT_CAUSE_DEPTH_LIMIT(5) links and cycle-safe (stops at the first repeat); either cut ends in a marker link that says so. A throwingcausegetter ends the chain instead of costing the line.logServerFault's console fallback (the sinksendError/sendServerFaultand every un-wired door reach) now writescausesbesidestack. The injected-logger branch is unchanged: it hands the logger the thrown error with itscauseintact, and the logger renders it, so the chain is never printed twice.packages/core/src/logger.ts:ObjectLogger.writerecords an error as{ message, stack, causes? }(was{ message, stack }), same bounds and same shape, for everylogger.error/logger.fatalthat passes anError. Field is absent when there is no cause.name/message/stackgetter, a Proxy) ends the chain in a marker link ([cause chain link unreadable: reading it threw]) instead of costing the line or the record.corealready depends ontypes, but@objectstack/core/loggeris the browser-safe entry@objectstack/clientbundles, andclientdoes not depend on@objectstack/types; importing it would pull thetypesroot (and@objectstack/specvalue imports behind it) into the browser logger.logger-error-cause.test.tsruns eleven fixtures through both and asserts equal output.packages/services/service-record-context/src/record-context-tools.ts: drops theCaused by:suffix PR fix(record-context): a related object's read that fails is a failure, not a refusal #37550 appended to a failed related read's stack (and its now-unuseddescribeThrown). The original still rides oncause, which the fault line now prints..changeset/37598-fault-log-cause-chain.md(patch:@objectstack/types,@objectstack/core,@objectstack/service-record-context).Read first:
faultCauseChainand the console branch oflogServerFaultinserver-fault-log.ts;renderErrorinlogger.ts.Tests
packages/types/src/server-fault-log-cause.test.ts(15): console fallback logs each cause's message and stack (wrapper → mid → root); CONTROL no cause ⇒ nocauses; a declared capability absence (warn) carries none; cycle and self-cause stop with a marker; a 20-deep chain stops at 5 plus a marker; string and object causes; a throwing getter; a link whose message read throws ends in a marker and the line is still written; a cause is redacted like the error (an object cause, by whole words as the logger matches its redact list, inside an array in an object cause, and on the console fallback line); an injected logger receives the error withcauseintact and nocausesin meta;sendServerFault's body carries no cause text while its line carries the root.packages/core/src/logger-error-cause.test.ts(18): JSON record carrieserror.causesforerrorandfatal; CONTROL no cause; cycle; deep chain; a cause is redacted like the error (under a configuredredactlist); a link whose message read throws ends in a marker and the record is still written; parity withfaultCauseChainover eleven fixtures (nested Error, cycle, deep chain, string cause, object cause, a cause redacted like the error, field names under the default redact words whole-word matched, an array inside an object cause, an object cause that cannot be serialized, a link whose message read throws, a throwingcausegetter).packages/runtime/src/mcp-record-context-tools-bridge.test.ts: the real-kernel outage case now finds the original ascauses[0](Error: OUTAGE, stack carrying it) on all four fault lines, the stack carries noCaused by:, and the answer text on both doors carries no cause text.packages/services/service-record-context/src/__tests__/record-context-tools.test.ts: the suffix pin now assertscauseis the original and the stack carries noCaused by:.causesspread disabled, rebuilt, marker proved indist/):server-fault-log-cause.test.ts2 failed / 8 passed (the two that read the chain off the line), the runtime harness outage case failed (causes[0].messageundefined). Restored (blob = HEAD,git diff HEADempty, marker absent fromdist/): 10/10 and 28/28.Acceptance notes
server-fault-log-cause.test.ts,logger-error-cause.test.ts.mcp-record-context-tools-bridge.test.ts.sendServerFault's case.@objectstack/observability'sConsoleLogger/JsonLogger(the otherLoggerimplementations) still record an error as{ error, stack }without itscause(loggers.tslines 56 and 114 on this head); outside the claim's surface, and carried by 37598 跟进:可观测性包的控制台与 JSON 日志器也打印被包装的原始错误 #37658.Rework (contract review 7200020944, seat REWORK 7200035097)
Clause-②: yes (widening)in this body and the changeset (three new exports on@objectstack/types:faultCauseChain,FAULT_CAUSE_DEPTH_LIMIT,FaultCauseLine); every package stays atpatch.logger-error-cause.test.ts.Second delta (contract review 7200840843 PASS, seat REWORK 7200856706):
ObjectLogger's own whole-word matcher (the finding(core): ObjectLogger 的脱敏表按子串匹配,一个叫keys的普通字段会被整块换成***REDACTED***#5573 rule) over the same default words, copied besidefaultCauseChain; a parity fixture of the spellings that differ (keys,tokens,monkey,keyword,secretary,apiKey,apikey,accesstoken,refresh_tokens,clientSecret,API_KEY) fails on any drift. Drift check: with the fallback put back to a substring match and rebuilt, that fixture went red (1 failed / 17 passed); restored (blob = HEAD), 18/18.faultCauseChaindocblock says the fallback applies only the default words, never a host's ownredactlist.Verification
pnpm --filter @objectstack/types exec vitest run --project local src/server-fault-log-cause.test.ts, expected 10 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Utp6CZHczeF42DiDgkJPmk
Generated by Claude Code