Skip to content

chore: remove dead code and fix stale comments#322

Merged
jrothrock merged 1 commit into
masterfrom
chore/code-cleanup-comments-dead-code
May 29, 2026
Merged

chore: remove dead code and fix stale comments#322
jrothrock merged 1 commit into
masterfrom
chore/code-cleanup-comments-dead-code

Conversation

@jrothrock
Copy link
Copy Markdown
Collaborator

Summary

  • Dead code removed: clearAsyncNamespaceEntry() was unused after the cls-hooked → AsyncLocalStorage migration. AsyncLocalStorage stores are GC'd automatically so there's nothing to manually clear.
  • Bug fix: logFn was called directly in a catch block, throwing TypeError: this.logFn is not a function when no logger was configured (issue TypeError: this.logFn is not a function #275). Now routes through this.log() which guards against undefined.
  • Stale CLS terminology: Comments referencing "continuation local storage machinery" and "async namespace" updated to "async context" to match the current AsyncLocalStorage implementation.
  • Orphaned comment: JSDoc block for the deleted clearAsyncNamespaceEntry was left sitting above createAgentForExistingSocket — removed.
  • Typo sweep: Fixed curernt, stoped, bfore, likey, perofrming midleware, then then, ScoutOptsuration, correposnding across lib/scout/index.ts, lib/express.ts, lib/integrations/express.ts, lib/global.ts.
  • JSDoc fixes: Truncated sentence ("has been" → "has been sent"), duplicate text in sendTagSpan, and wrong log message in sendThroughAgent ("not sending tag request" → "not sending request").

Test plan

  • No functional changes — verify tsc compiles cleanly
  • Confirm clearAsyncNamespaceEntry has no callers (grep returns nothing)
  • Verify this.logFn is not a function error is no longer reproducible when no logFn is passed to new Scout()

🤖 Generated with Claude Code

@jrothrock jrothrock force-pushed the chore/code-cleanup-comments-dead-code branch from 1bbec67 to 03bcaec Compare May 28, 2026 19:56
- Remove clearAsyncNamespaceEntry() — unused after cls-hooked migration;
  AsyncLocalStorage stores are GC'd automatically, no manual clearing needed
- Fix logFn direct call in catch block — route through this.log() which
  guards against undefined logFn instead of throwing TypeError
- Replace CLS-era terminology in comments: "continuation local storage
  machinery" / "async namespace" → "async context"
- Remove orphaned JSDoc block left above createAgentForExistingSocket
  after clearAsyncNamespaceEntry was deleted
- Remove misleading "If the socket path exists..." comment that didn't
  describe the code below it
- Fix typos in comments: curernt, stoped, bfore, likey, perofrming,
  midleware, then then, ScoutOptsuration, correposnding
- Fix truncated JSDoc sentence ("has been" → "has been sent")
- Fix duplicate JSDoc text in sendTagSpan
- Fix log message in sendThroughAgent: "not sending tag request" →
  "not sending request" (function handles all request types)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jrothrock jrothrock force-pushed the chore/code-cleanup-comments-dead-code branch from 03bcaec to d530c30 Compare May 28, 2026 23:04
@jrothrock jrothrock merged commit 5d85756 into master May 29, 2026
14 checks passed
@jrothrock jrothrock deleted the chore/code-cleanup-comments-dead-code branch May 29, 2026 17:40
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