fix(services): memoize getCliId and getDevHubId to prevent duplicate telemetry - W-22975411#7460
Draft
mshanemc wants to merge 5 commits into
Draft
fix(services): memoize getCliId and getDevHubId to prevent duplicate telemetry - W-22975411#7460mshanemc wants to merge 5 commits into
mshanemc wants to merge 5 commits into
Conversation
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…once - W-22975411 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ns once per devhub - W-22975411 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ookups retry - W-22975411 A failed AuthInfo.create was permanently cached per username for the session via Effect.cachedFunction, so devHubOrgId never recovered after the user authenticated the devhub. Catch failures inside buildDevHubId before memoizing so only successes are cached. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…cceed(undefined) - W-22975411 Replace untyped catch (e => e) with a tagged FetchCliIdError so the error channel is typed. Revert the web branch from Effect.void back to Effect.succeed(undefined) for type consistency with the node branch (Effect<string | undefined>). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
getCliIdat module scope sosf telemetry --jsonruns once per session instead of once pergetConnectioncallgetDevHubIdper username usingEffect.cachedFunctionsoAuthInfo.createruns once per distinct devhub instead of rebuilding on every callEffect.cachedper call, defeating memoization and emitting duplicate spansPlan
.claude/plans/W-22975411.md
Reviewer notes
connectionService.ts:359finding (effect LSeffectSucceedWithVoid→ useEffect.void) NOT applied: conflicts with the fourcliTelemetryfindings that mandate keepingEffect.succeed(undefined)for type consistency. Line 359 is the else branch ofbuildDevHubId's ternary; its success value is consumed asdevHubOrgId(string | undefined). Changing it toEffect.voidwould widen the success type tostring | voidand breakDefaultOrgInfoSchema/devHubOrgIdtyping. The LS message is non-blocking (exit 0, 'message' not warning/error) and is an inherent false positive here because the undefined value is meaningful. The sameeffectSucceedWithVoidmessage now also appears on the new line 362catchAll(() => Effect.succeed(undefined))for the same reason. Decision: design conflict between findings, surfaced per rules.cliTelemetry/getDevHubIdmemoization and CI does not enable span-file-export. Recommend manual verification: enable span file export, trigger multiplegetConnectioncalls in a session, confirm exactly onefetchCliIdspan and onegetDevHubIdspan per distinct devhub username. PR-body note only.packages/salesforcedx-vscode-services/src. As a subagent I cannot spawn another subagent; doc updates (if any) were not run. Parent may need to run doc-maintenance overconnectionService.tsandcliTelemetry.ts.Test plan
salesforcedx-vscode-servicesgetConnectioncalls (switch default org back and forth) and confirm exactly onefetchCliIdspan and onegetDevHubIdspan per distinct devhub username via span-file-export locally or app-insights span-count query post-mergeWhat issues does this PR fix or reference?
@W-22975411@
🤖 Generated by auto-build pipeline. Original WI: W-22975411