fix: simplify @log decorator and defer debug serialization#172
Merged
fix: simplify @log decorator and defer debug serialization#172
Conversation
Remove eager JSON.stringify serialization from the @log decorator (stringify, hasCustomToString, replacer) that ran on every invocation. The decorator now only emits lightweight Logger.trace for entry/exit. Also defer JSON.stringify in run.ts debug calls using lazy evaluation, and add missing valueSettings test for 100% coverage. Port of scolladon/sfdx-git-delta#1215.
|
Published under $ sf plugins install sf-git-merge-driver@dev-172 |
yohanim
approved these changes
Feb 17, 2026
Collaborator
yohanim
left a comment
There was a problem hiding this comment.
Waow, that's some great heavy logging optimization.
Eager to compare run times impact in real life.
|
Shipped in release $ sf plugins install sf-git-merge-driver@latest-rc
# Or
$ sf plugins install sf-git-merge-driver@v1.5.3💡 Enjoying sf-git-merge-driver? |
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.
Explain your changes
The
@logdecorator eagerly serialized method arguments and results viaJSON.stringifyon every invocation (9 usages across 9 files). For large XML merge operations, hot-path methods likeXmlMerger.mergeThreeWayandMergeDriver.mergeFilesgenerated log entries with potentially MB-sized payloads (full XML trees). This could overwhelm pino's thread-stream transport, causing its hardcoded 10sflushSynctimeout to fail at process exit.Changes:
@logdecorator to only emit lightweightLogger.tracefor entry/exit (class name + method name, no serialization)stringify,hasCustomToString,replacer) that was only used by the removed debug callsJSON.stringifyinrun.tsdebug calls usinglazyevaluation so serialization only happens when debug logging is enabledvalueSettingstest case to reach 100% code coverageDoes this close any currently open issues?
Any particular element that can be tested locally
Run
sf git merge driver runwith debug logging enabled — the command should complete without_flushSync took too longerrors on large XML files.Any other comments
The root cause is that pino's
thread-streamhas a hardcoded 10s flush timeout (Atomics.waitwith 10 spins × 1s) that is not configurable through@salesforce/core. Rather than trying to work around the timeout, this fix eliminates the log volume that causes it.Trace-level entry/exit logging is preserved for execution flow debugging.