Fix unused code, array mutation bug, and TypeScript errors - #291
Open
aadityakumarsah wants to merge 2 commits into
Open
Fix unused code, array mutation bug, and TypeScript errors#291aadityakumarsah wants to merge 2 commits into
aadityakumarsah wants to merge 2 commits into
Conversation
…typescript error.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit f333ff0. Configure here.
|
|
||
| it("delivers events to the correct session without cross-contamination", async () => { | ||
| const { childA, childB, prefix, startRun, abortRun, subscribeToRun } = | ||
| const { childA, childB, prefix, startRun, _abortRun, subscribeToRun } = |
There was a problem hiding this comment.
Incorrect unused abort destructuring
Low Severity
These tests destructure _abortRun, but setupConcurrent returns abortRun. Unlike the childA: _childA rename nearby, this binds a missing property and leaves _abortRun always undefined, so the unused-binding cleanup does not actually reference the real export.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f333ff0. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
This issue addresses several bugs, code smells, and TypeScript errors discovered during static analysis (linting and type checking).
1. Unused Imports in Test Files
apps/web/lib/chat-agent-registry.test.tsexistsSyncandmkdirSyncfromnode:fsare declared but never used in the file, cluttering the import block.2. Dead Code (Unused Function and Variable)
apps/web/lib/denchclaw-state.tsdefaultEmailBodyHydrationAttemptedis defined but never invoked anywhere in the codebase.apps/web/lib/active-runs.tseverSentResponseActivityis declared and assigned values in thewireSubscribeOnlyProcessfunction, but it is never used in that scope.3. Array Mutation Bug
apps/web/lib/denchclaw-state.tsArray.from(current).sort(). Thesort()method mutates the array in place. WhileArray.fromcreates a new array, using.toSorted()is the more modern, idiomatic, and safer approach to ensure arrays are sorted without unintended side effects (as flagged byeslint-plugin-unicorn(no-array-sort)).4. TypeScript Error in AI Gateway
extensions/dench-ai-gateway/sync-trigger.tsElement implicitly has an 'any' type because expression of type '"syncTrigger"' can't be used to index type '{}'. This occurs becausepluginConfig?.configis not properly typed before attempting to access the["syncTrigger"]property.5. Arrow Function Body Formatting and Object Spreads
apps/web/lib/active-runs.test.tssubscribeToRun(idA, (e) => { if (e) eventsA.push(e); }, { replay: false });) that lack curly braces after theifstatement.apps/web/lib/active-runs.ts...(details ?? {})wheredetailsis already an object).Proposed Solution
chat-agent-registry.test.ts.defaultEmailBodyHydrationAttemptedfunction fromdenchclaw-state.tsand theeverSentResponseActivityvariable fromactive-runs.ts..sort()with.toSorted()indenchclaw-state.ts.as Record<string, unknown>) when accessing the config insync-trigger.tsto satisfy the TypeScript compiler.active-runs.test.ts.?? {}fallback in the object spread inactive-runs.ts.